diff --git a/BeMe/BeMe.xcodeproj/project.pbxproj b/BeMe/BeMe.xcodeproj/project.pbxproj index 6e4a4b7..32f715e 100644 --- a/BeMe/BeMe.xcodeproj/project.pbxproj +++ b/BeMe/BeMe.xcodeproj/project.pbxproj @@ -165,6 +165,10 @@ EC813F7B2599F88D00BBCE25 /* PastCardCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC813F7A2599F88D00BBCE25 /* PastCardCVC.swift */; }; EC813F7E2599F89A00BBCE25 /* NewCardCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC813F7D2599F89A00BBCE25 /* NewCardCVC.swift */; }; EC813F812599F8A800BBCE25 /* AddCardCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC813F802599F8A800BBCE25 /* AddCardCVC.swift */; }; + EC85D4F125B02DAD00185E4A /* dailyblue.json in Resources */ = {isa = PBXBuildFile; fileRef = EC85D4F025B02DAD00185E4A /* dailyblue.json */; }; + EC85D4F525B07B9A00185E4A /* FollowingNewAnswerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC85D4F425B07B9A00185E4A /* FollowingNewAnswerData.swift */; }; + EC85D4F825B07CA300185E4A /* FollowingNewAnswerService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC85D4F725B07CA300185E4A /* FollowingNewAnswerService.swift */; }; + EC85D4FF25B0BF4B00185E4A /* CustomToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC85D4FE25B0BF4B00185E4A /* CustomToastView.swift */; }; EC89E306259C1CA600DBAFE5 /* FollowSearch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EC89E305259C1CA600DBAFE5 /* FollowSearch.storyboard */; }; EC89E309259C1CC700DBAFE5 /* FollowSearchVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC89E308259C1CC700DBAFE5 /* FollowSearchVC.swift */; }; EC89E30C259C273400DBAFE5 /* FollowingSearchVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC89E30B259C273400DBAFE5 /* FollowingSearchVC.swift */; }; @@ -385,6 +389,10 @@ EC813F7A2599F88D00BBCE25 /* PastCardCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PastCardCVC.swift; sourceTree = ""; }; EC813F7D2599F89A00BBCE25 /* NewCardCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewCardCVC.swift; sourceTree = ""; }; EC813F802599F8A800BBCE25 /* AddCardCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddCardCVC.swift; sourceTree = ""; }; + EC85D4F025B02DAD00185E4A /* dailyblue.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = dailyblue.json; sourceTree = ""; }; + EC85D4F425B07B9A00185E4A /* FollowingNewAnswerData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingNewAnswerData.swift; sourceTree = ""; }; + EC85D4F725B07CA300185E4A /* FollowingNewAnswerService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingNewAnswerService.swift; sourceTree = ""; }; + EC85D4FE25B0BF4B00185E4A /* CustomToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomToastView.swift; sourceTree = ""; }; EC89E305259C1CA600DBAFE5 /* FollowSearch.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = FollowSearch.storyboard; sourceTree = ""; }; EC89E308259C1CC700DBAFE5 /* FollowSearchVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowSearchVC.swift; sourceTree = ""; }; EC89E30B259C273400DBAFE5 /* FollowingSearchVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingSearchVC.swift; sourceTree = ""; }; @@ -1034,6 +1042,7 @@ children = ( EC75A25325A8A71800F4E160 /* FollowingGetData.swift */, ECC6310525A9987A009E4FD4 /* FollowingAnswersData.swift */, + EC85D4F425B07B9A00185E4A /* FollowingNewAnswerData.swift */, ); path = Following; sourceTree = ""; @@ -1045,6 +1054,7 @@ ECC6310225A99404009E4FD4 /* FollowingFollowService.swift */, ECC6310825A999DB009E4FD4 /* FollowingGetAnswersService.swift */, ECB44D4C25AC886800F491F2 /* FollowerDeleteService.swift */, + EC85D4F725B07CA300185E4A /* FollowingNewAnswerService.swift */, ); path = Following; sourceTree = ""; @@ -1059,6 +1069,7 @@ ECB44D5425AC9CD800F491F2 /* CustomLoadingView.swift */, ECB44D6625ACCB4500F491F2 /* CustomEmtpyView.swift */, D4C5872825AF77970089BD18 /* CustomMailView.swift */, + EC85D4FE25B0BF4B00185E4A /* CustomToastView.swift */, ); path = CustomViews; sourceTree = ""; @@ -1414,6 +1425,7 @@ ECB44D5125AC968A00F491F2 /* loading.json */, ECC6312B25A9E98E009E4FD4 /* data1.json */, ECC6312825A9E8A0009E4FD4 /* animation_test.json */, + EC85D4F025B02DAD00185E4A /* dailyblue.json */, ECB44D6025ACAF4A00F491F2 /* animation_love_final.json */, ECB44D5F25ACAF4A00F491F2 /* animation_relation_final.json */, ); @@ -1506,6 +1518,7 @@ ECC6311525A9E69A009E4FD4 /* HomeLottietest.storyboard in Resources */, D44F6DC425A5784A002A9761 /* Answer.storyboard in Resources */, D4C5873B25AF84170089BD18 /* Setting.storyboard in Resources */, + EC85D4F125B02DAD00185E4A /* dailyblue.json in Resources */, EC7FEFA525A38AE200C61147 /* Search.storyboard in Resources */, ECB44D6225ACAF4A00F491F2 /* animation_love_final.json in Resources */, ); @@ -1707,10 +1720,12 @@ A53C28A025AE11E10054DA7E /* MyAnswer.swift in Sources */, A57F708C25A1ACB100152E89 /* MypageResultTVC.swift in Sources */, D4F1992925A4E804000AF0E7 /* SecretTVC.swift in Sources */, + EC85D4F825B07CA300185E4A /* FollowingNewAnswerService.swift in Sources */, D4C5875F25B0165A0089BD18 /* ExploreWrite.swift in Sources */, ECB44D6725ACCB4500F491F2 /* CustomEmtpyView.swift in Sources */, D4E07CBA259F22C10075E616 /* MoreTVC.swift in Sources */, EC75A24E25A88AC400F4E160 /* AnswerModifyService.swift in Sources */, + EC85D4FF25B0BF4B00185E4A /* CustomToastView.swift in Sources */, D4475F0725AA1B6E00426591 /* ExploreDetailAnswerService.swift in Sources */, D492E41A25A0A0DE0088A181 /* ExploreDetailVC.swift in Sources */, EC7F0EA125A05460008EB88A /* CustomHomeActionSheetAlert.swift in Sources */, @@ -1737,6 +1752,7 @@ EC813F262599A15100BBCE25 /* SceneDelegate.swift in Sources */, EC89E30F259C274200DBAFE5 /* FollowerSearchVC.swift in Sources */, EC7C1634259BAD0600A5BA4C /* FollowerPersonCVC.swift in Sources */, + EC85D4F525B07B9A00185E4A /* FollowingNewAnswerData.swift in Sources */, D405E8C025ADD80E004CC60F /* AlarmService.swift in Sources */, D44F6DFC25A5BDAD002A9761 /* QuestionAnswerTVC.swift in Sources */, D44F6DC525A5784A002A9761 /* AnswerVC.swift in Sources */, @@ -1888,16 +1904,18 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 6ZTQ76LJPZ; INFOPLIST_FILE = BeMe/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe; + MARKETING_VERSION = 1.02; + PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe1; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; @@ -1908,16 +1926,18 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 6ZTQ76LJPZ; INFOPLIST_FILE = BeMe/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe; + MARKETING_VERSION = 1.02; + PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe1; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; diff --git a/BeMe/BeMe/APIService/APIConstants.swift b/BeMe/BeMe/APIService/APIConstants.swift index 1bf2ed6..68824e2 100644 --- a/BeMe/BeMe/APIService/APIConstants.swift +++ b/BeMe/BeMe/APIService/APIConstants.swift @@ -27,7 +27,7 @@ struct APIConstants{ static let searchHistoryURL = baseURL+"/users/search/history" static let searchDeleteURL = baseURL+"/users/search/" static let followerDeleteURL = baseURL+"/follow/" - + static let followingNewAnswerURL = baseURL+"/answers/question" static let explorationCategoryURL = baseURL + "/exploration/category" static let explorationDiffThoughtURL = baseURL + "/exploration/another" @@ -43,8 +43,8 @@ struct APIConstants{ static let othersPageAnswerURL = baseURL + "/profiles/answers/" static let myPageProfileURL = baseURL + "/profiles" - static let myPageAnswerURL = baseURL + "/profiles/answers?" - static let myPageScrapURL = baseURL + "/profiles/scraps?" + static let myPageAnswerURL = baseURL + "/profiles/answers" + static let myPageScrapURL = baseURL + "/profiles/scraps" // static let settingMyPageProfileURL = baseURL + "/profiles" diff --git a/BeMe/BeMe/APIService/Following/FollowingNewAnswerService.swift b/BeMe/BeMe/APIService/Following/FollowingNewAnswerService.swift new file mode 100644 index 0000000..381795d --- /dev/null +++ b/BeMe/BeMe/APIService/Following/FollowingNewAnswerService.swift @@ -0,0 +1,90 @@ +// +// LogInService.swift +// BeMe +// +// Created by Yunjae Kim on 2021/01/06. +// + +import Foundation +import Alamofire + +struct FollowingNewAnswerService{ + static let shared = FollowingNewAnswerService() + + func getNewData(questionID: Int, completion : @escaping (NetworkResult) -> (Void) ){ + let url = APIConstants.followingNewAnswerURL + + let header : HTTPHeaders = [ + "Content-Type":"application/json", + "token":UserDefaults.standard.string(forKey: "token")! + ] + + let body : Parameters = [ + "question_id": questionID + ] + + let dataRequest = AF.request(url, + method: .post, + parameters: body, + encoding: JSONEncoding.default, + headers: header) + + + dataRequest.responseData{ response in + switch response.result { + case .success: + guard let statusCode = response.response?.statusCode else{ + return + } + guard let data = response.value else{ + return + + } + + completion(judge(status: statusCode, data: data)) + + + + + + case .failure(let err): + print(err) + completion(.networkFail) + } + + } + + + + } + + private func judge(status : Int, data : Data) -> NetworkResult { + let decoder = JSONDecoder() + guard let decodedData = try? decoder.decode(GenericResponse.self, from : data) else{ + + + return .pathErr + + } + + switch status{ + case 200..<300: + + print("성공성공") + + return .success(decodedData.data) + case 400..<500 : + return .requestErr(decodedData.message) + case 500 : + return .serverErr + + default : + return .networkFail + + + } + + + } + +} diff --git a/BeMe/BeMe/APIService/Home/HomeChangePublicService.swift b/BeMe/BeMe/APIService/Home/HomeChangePublicService.swift index acdd65c..1dbf626 100644 --- a/BeMe/BeMe/APIService/Home/HomeChangePublicService.swift +++ b/BeMe/BeMe/APIService/Home/HomeChangePublicService.swift @@ -23,6 +23,9 @@ struct HomeChangePublicService{ "public_flag": publicFlag, ] + print("HomeChangePublicService") + print(url) + print(body) let dataRequest = AF.request(url, method: .put, parameters: body, diff --git a/BeMe/BeMe/APIService/LogIn/LogInService.swift b/BeMe/BeMe/APIService/LogIn/LogInService.swift index e418801..b076abc 100644 --- a/BeMe/BeMe/APIService/LogIn/LogInService.swift +++ b/BeMe/BeMe/APIService/LogIn/LogInService.swift @@ -11,6 +11,8 @@ import Alamofire struct LogInService{ static let shared = LogInService() + + func login(nickName: String, password: String, completion : @escaping (NetworkResult) -> (Void) ){ let url = APIConstants.loginURL @@ -40,7 +42,8 @@ struct LogInService{ return } - + UserDefaults.standard.setValue(nickName, forKey: "nickName") + UserDefaults.standard.setValue(password, forKey: "password") completion(judgeLogInData(status: statusCode, data: data)) @@ -70,6 +73,7 @@ struct LogInService{ switch status{ case 200..<300: print(decodedData.data?.token) + UserDefaults.standard.setValue(decodedData.data?.token, forKey: "token") return .success(decodedData.data) diff --git a/BeMe/BeMe/APIService/MyPage/MyPageAnswerService.swift b/BeMe/BeMe/APIService/MyPage/MyPageAnswerService.swift index a9764c5..dc0ac9f 100644 --- a/BeMe/BeMe/APIService/MyPage/MyPageAnswerService.swift +++ b/BeMe/BeMe/APIService/MyPage/MyPageAnswerService.swift @@ -15,20 +15,28 @@ struct MyPageAnswerService { func getMyAnswer(availability: String?, category: Int?, page: Int, query: String?, completion : @escaping (NetworkResult) -> (Void) ){ let category = category == nil ? "" : String(category!) + let availability = availability == nil ? "" : String(availability!) + let query = query == nil ? "" : String(query!) - let url = APIConstants.myPageAnswerURL+"public="+availability!+"&category="+category+"&page="+String(page)+"&query="+query! + + let url = APIConstants.myPageAnswerURL + + let params: Parameters = [ + "public": "\(availability)", + "category": "\(category)", + "page": "\(page)", + "query": "\(query)" + ] + + print("getMyAnswer URll") + print(url) let header : HTTPHeaders = [ "Content-Type":"application/json", "token":UserDefaults.standard.string(forKey: "token")! - // "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjEwMDk5MjQwLCJleHAiOjE2MzYwMTkyNDAsImlzcyI6ImJlbWUifQ.JeYfzJsg-kdatqhIOqfJ4oXUvUdsiLUaGHwLl1mJRvQ" ] - - let dataRequest = AF.request(url, - method: .get, - encoding: JSONEncoding.default, - headers: header) + let dataRequest = AF.request(url, method: .get, parameters: params, headers: header) dataRequest.responseData{ response in @@ -61,12 +69,9 @@ struct MyPageAnswerService { print("디코딩 실패") return .pathErr } - switch status{ case 200..<300: print("통신 성공") - // print(decodedData.message) - // print(decodedData.data?.answers[0].isScrapped) return .success(decodedData.data) case 400..<500 : return .requestErr(decodedData.message) diff --git a/BeMe/BeMe/APIService/MyPage/MyPageProfileService.swift b/BeMe/BeMe/APIService/MyPage/MyPageProfileService.swift index 5586a94..4fa8a15 100644 --- a/BeMe/BeMe/APIService/MyPage/MyPageProfileService.swift +++ b/BeMe/BeMe/APIService/MyPage/MyPageProfileService.swift @@ -59,8 +59,8 @@ struct MyPageProfileService { let header : HTTPHeaders = [ // "Content-Type":"application/json", "Content-Type":"multipart/form-data", - // "token":UserDefaults.standard.string(forKey: "token")! - "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNjA5Nzc3ODg2LCJleHAiOjE2MzU2OTc4ODYsImlzcyI6ImJlbWUifQ.34mc263uDc9vYq9N8BVzfqVdsgKzL51Ld03kB0afcSQ" + "token":UserDefaults.standard.string(forKey: "token")! +// "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNjA5Nzc3ODg2LCJleHAiOjE2MzU2OTc4ODYsImlzcyI6ImJlbWUifQ.34mc263uDc9vYq9N8BVzfqVdsgKzL51Ld03kB0afcSQ" ] AF.upload(multipartFormData: { multiPartFormData in let imageData = image.jpegData(compressionQuality: 1.0)! @@ -100,6 +100,7 @@ struct MyPageProfileService { case 200..<300: // print(decodedData.message) // print(decodedData.data) + print("profile editing") return .success(decodedData.data) case 400..<500 : return .requestErr(decodedData.message) diff --git a/BeMe/BeMe/APIService/MyPage/MyPageScrapService.swift b/BeMe/BeMe/APIService/MyPage/MyPageScrapService.swift index 987c5e9..24a384f 100644 --- a/BeMe/BeMe/APIService/MyPage/MyPageScrapService.swift +++ b/BeMe/BeMe/APIService/MyPage/MyPageScrapService.swift @@ -13,24 +13,30 @@ struct MyPageScrapService { // getMyAnswer - overLoading Method : 쿼리 개수에 따라서 매개변수 개수가 바뀜 func getMyScrap(availability: String?, category: Int?, query: String?, page: Int, completion : @escaping (NetworkResult) -> (Void)){ - + let category = category == nil ? "" : String(category!) + let availability = availability == nil ? "" : String(availability!) + let query = query == nil ? "" : String(query!) + + + let url = APIConstants.myPageScrapURL + + let params: Parameters = [ + "public": "\(availability)", + "category": "\(category)", + "page": "\(page)", + "query": "\(query)" + ] - let url = APIConstants.myPageScrapURL+"public="+availability!+"&category="+category+"&page="+String(page)+"&query="+query! - print("getMyScrap nURll") + print("getMyScrap URll") print(url) - + let header : HTTPHeaders = [ "Content-Type":"application/json", "token":UserDefaults.standard.string(forKey: "token")! -// "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjEwMDk5MjQwLCJleHAiOjE2MzYwMTkyNDAsImlzcyI6ImJlbWUifQ.JeYfzJsg-kdatqhIOqfJ4oXUvUdsiLUaGHwLl1mJRvQ" ] - - let dataRequest = AF.request(url, - method: .get, - encoding: JSONEncoding.default, - headers: header) + let dataRequest = AF.request(url, method: .get, parameters: params, headers: header) dataRequest.responseData{ response in @@ -67,8 +73,6 @@ struct MyPageScrapService { switch status{ case 200..<300: print("통신 성공") -// print(decodedData.message) -// print(decodedData.data?.answers[0].isScrapped) return .success(decodedData.data) case 400..<500 : return .requestErr(decodedData.message) diff --git a/BeMe/BeMe/Answer/VCs/AnswerVC.swift b/BeMe/BeMe/Answer/VCs/AnswerVC.swift index 7d8153e..1e107ac 100644 --- a/BeMe/BeMe/Answer/VCs/AnswerVC.swift +++ b/BeMe/BeMe/Answer/VCs/AnswerVC.swift @@ -40,7 +40,7 @@ class AnswerVC: UIViewController { // var answerData: AnswerDataForViewController? - + var followScrapButtonDelegate: FollowScrapButtonDelegate? // AnswerVC 에서 init var answer: String? var isAnswerPublic: Bool = true @@ -52,7 +52,8 @@ class AnswerVC: UIViewController { var answerDataDelegate: HomeGetDataFromAnswerDelegate? var curCardIdx : Int? var isRegister: Bool? - + var isFromFollowingTab = false + var indexInFollowingVC: Int? //MARK:**- Constraint Part** /// 스토리보드에 있는 layout 에 대한 @IBOutlet 을 선언합니다. (Height, Leading, Trailing 등등..)  // 변수명 lowerCamelCase 사용 @@ -71,7 +72,7 @@ class AnswerVC: UIViewController { // answerTextView.text = "" // answerTextView.becomeFirstResponder() registerForKeyboardNotifications() - + FollowingVC.fromWhichView = 1 self.navigationController?.interactivePopGestureRecognizer?.delegate = nil } @@ -184,7 +185,8 @@ class AnswerVC: UIViewController { finishButton.setTitleColor(.veryLightPink, for: .normal) answerTextView.text = answerData?.answer textViewDidChange(answerTextView) - answerTextView.becomeFirstResponder() +// answerTextView.becomeFirstResponder() + answerSwitch.isOn = !answerData!.lock! @@ -222,10 +224,17 @@ class AnswerVC: UIViewController { @IBAction func finishButtonAction(_ sender: Any) { answerData!.answer = answerTextView.text if isRegister! == true{ + print("글쓰기 시도") AnswerRegistService.shared.regist(answerID: answerData!.id!, content: answerData!.answer!, commentBlocked: commentSwitch.isOn, isPublic: answerSwitch.isOn) {(networkResult) -> (Void) in switch networkResult{ case .success(let data) : - print("success") + print("글쓰기 성공") + print("bbbbbbbbb") + print(self.isFromFollowingTab) + if self.isFromFollowingTab { + print("yyyyy") + self.followScrapButtonDelegate?.fromAnswerVC(indexInVC: self.indexInFollowingVC!) + } case .requestErr(let msg): if let message = msg as? String { print(message) @@ -344,6 +353,12 @@ extension AnswerVC: UITextViewDelegate { textView.text = initialText textView.textColor = .black } + if textView.text != "" { + finishButton.setTitleColor(.black, for: .normal) + } + else{ + finishButton.setTitleColor(.veryLightPink, for: .normal) + } inputText = textView.text UserDefaults.standard.set(textView.text, forKey: "answer") diff --git a/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/Contents.json b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/Contents.json new file mode 100644 index 0000000..6a6e590 --- /dev/null +++ b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "scale" : "1x", + "idiom" : "universal", + "filename" : "beMeLogo.png" + }, + { + "scale" : "2x", + "idiom" : "universal", + "filename" : "beMeLogo@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "beMeLogo@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo.png b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo.png new file mode 100644 index 0000000..fb521ba Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo.png differ diff --git a/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo@2x.png b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo@2x.png new file mode 100644 index 0000000..c20d875 Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo@2x.png differ diff --git a/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo@3x.png b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo@3x.png new file mode 100644 index 0000000..8615f9c Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/beMeLogo.imageset/beMeLogo@3x.png differ diff --git a/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/Contents.json b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/Contents.json new file mode 100644 index 0000000..46ea493 --- /dev/null +++ b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "scale" : "1x", + "idiom" : "universal", + "filename" : "btnUnlockExploreBlack.png" + }, + { + "filename" : "btnUnlockExploreBlack@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "btnUnlockExploreBlack@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack.png b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack.png new file mode 100644 index 0000000..04cb0b7 Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack.png differ diff --git a/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack@2x.png b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack@2x.png new file mode 100644 index 0000000..5a0f43f Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack@2x.png differ diff --git a/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack@3x.png b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack@3x.png new file mode 100644 index 0000000..8360a08 Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/btnUnlockExploreBlack.imageset/btnUnlockExploreBlack@3x.png differ diff --git a/BeMe/BeMe/Assets.xcassets/mypageDefault.imageset/Contents.json b/BeMe/BeMe/Assets.xcassets/mypageDefault.imageset/Contents.json index 5534f5e..52b5489 100644 --- a/BeMe/BeMe/Assets.xcassets/mypageDefault.imageset/Contents.json +++ b/BeMe/BeMe/Assets.xcassets/mypageDefault.imageset/Contents.json @@ -2,18 +2,18 @@ "images" : [ { "scale" : "1x", - "filename" : "mypageDefault.png", - "idiom" : "universal" + "idiom" : "universal", + "filename" : "mypageDefault.png" }, { - "filename" : "mypageDefault@2x.png", "scale" : "2x", - "idiom" : "universal" + "idiom" : "universal", + "filename" : "mypageDefault@2x.png" }, { - "scale" : "3x", "idiom" : "universal", - "filename" : "mypageDefault@3x.png" + "filename" : "mypageDefault@3x.png", + "scale" : "3x" } ], "info" : { diff --git a/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/Contents.json b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/Contents.json new file mode 100644 index 0000000..a9cd193 --- /dev/null +++ b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "rectangle279.png", + "scale" : "1x", + "idiom" : "universal" + }, + { + "filename" : "rectangle279@2x.png", + "scale" : "2x", + "idiom" : "universal" + }, + { + "scale" : "3x", + "filename" : "rectangle279@3x.png", + "idiom" : "universal" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279.png b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279.png new file mode 100644 index 0000000..9967421 Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279.png differ diff --git a/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279@2x.png b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279@2x.png new file mode 100644 index 0000000..c097c4f Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279@2x.png differ diff --git a/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279@3x.png b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279@3x.png new file mode 100644 index 0000000..670fdbe Binary files /dev/null and b/BeMe/BeMe/Assets.xcassets/rectangle279.imageset/rectangle279@3x.png differ diff --git a/BeMe/BeMe/Base.lproj/LaunchScreen.storyboard b/BeMe/BeMe/Base.lproj/LaunchScreen.storyboard index 865e932..b4ee1b2 100644 --- a/BeMe/BeMe/Base.lproj/LaunchScreen.storyboard +++ b/BeMe/BeMe/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,11 @@ - - + + + - + + + @@ -11,10 +14,23 @@ - + - + + + + + + + + + + + + + + @@ -22,4 +38,10 @@ + + + + + + diff --git a/BeMe/BeMe/CustomActionSheet/Cell/FilterCVC.swift b/BeMe/BeMe/CustomActionSheet/Cell/FilterCVC.swift index bbc6afc..7a7e0d9 100644 --- a/BeMe/BeMe/CustomActionSheet/Cell/FilterCVC.swift +++ b/BeMe/BeMe/CustomActionSheet/Cell/FilterCVC.swift @@ -11,33 +11,68 @@ class FilterCVC: UICollectionViewCell { @IBOutlet weak var categoryButton: UIButton! @IBAction func categoryButtonTapped(_ sender: UIButton) { - setButton(isSelected: true) - filterCVCDelegate?.setSelectedCategory(index: indexPath) + print(category) +// filterCVCDelegate?.setSelectedCategory(index: indexPath) } static let identifier: String = "FilterCVC" - var categoryArray: [ExploreCategory] = [] + var category: ExploreCategory? var indexPath = -1 - private var filterCVCDelegate: FilterCVCDelegate? +// var filterCVCDelegate: FilterCVCDelegate? - override class func awakeFromNib() { + + override var isSelected: Bool { + didSet{ + if isSelected { + categoryButton.setBorderWithRadius(borderColor: .black, borderWidth: 1, cornerRadius: 4) + categoryButton.backgroundColor = UIColor.black + categoryButton.setTitleColor(.white, for: .normal) + + } else { + categoryButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + categoryButton.backgroundColor = UIColor.white + categoryButton.setTitleColor(.slateGrey, for: .normal) + } + } + } + override func awakeFromNib() { + + categoryButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + categoryButton.backgroundColor = UIColor.white + categoryButton.setTitleColor(.slateGrey, for: .normal) + + } + + func setButton() { + if !(category?.selected)! { + print(category) + + categoryButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + categoryButton.backgroundColor = UIColor.white + categoryButton.setTitleColor(.slateGrey, for: .normal) + } else { + categoryButton.setBorderWithRadius(borderColor: .black, borderWidth: 1, cornerRadius: 4) + categoryButton.backgroundColor = UIColor.black + categoryButton.setTitleColor(.white, for: .normal) + } } - func setButton(isSelected: Bool) { - if !isSelected { - + func setButton(selected: Bool) { + if !selected { + print(category) + categoryButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) categoryButton.backgroundColor = UIColor.white categoryButton.setTitleColor(.slateGrey, for: .normal) } else { - categoryButton.setBorderWithRadius(borderColor: .black, borderWidth: 1, cornerRadius: 4) categoryButton.backgroundColor = UIColor.black categoryButton.setTitleColor(.white, for: .normal) } } + func setButton(text: String) { categoryButton.setTitle(text, for: .normal) categoryButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) @@ -46,6 +81,6 @@ class FilterCVC: UICollectionViewCell { } } -protocol FilterCVCDelegate { - func setSelectedCategory(index: Int) -} +//protocol FilterCVCDelegate { +// func setSelectedCategory(index: Int) +//} diff --git a/BeMe/BeMe/CustomActionSheet/Storyboard/CustomActionSheet.storyboard b/BeMe/BeMe/CustomActionSheet/Storyboard/CustomActionSheet.storyboard index b574fd5..c72e90d 100644 --- a/BeMe/BeMe/CustomActionSheet/Storyboard/CustomActionSheet.storyboard +++ b/BeMe/BeMe/CustomActionSheet/Storyboard/CustomActionSheet.storyboard @@ -590,7 +590,7 @@ - diff --git a/BeMe/BeMe/CustomActionSheet/VC/CustomActionSheetFilterVC.swift b/BeMe/BeMe/CustomActionSheet/VC/CustomActionSheetFilterVC.swift index 38b6e28..0fe8af2 100644 --- a/BeMe/BeMe/CustomActionSheet/VC/CustomActionSheetFilterVC.swift +++ b/BeMe/BeMe/CustomActionSheet/VC/CustomActionSheetFilterVC.swift @@ -16,44 +16,135 @@ class CustomActionSheetFilterVC: UIViewController { @IBOutlet weak var availablityLabel: UILabel! @IBOutlet weak var categoryLabel: UILabel! - // 서버통신을 통해 받아오는 값 - private var categoryArray: [ExploreCategory] = [] - var selecetedAvailablity: [Bool] = [false, false, false] - private var filterCVCDelegate: FilterCVCDelegate? -// var selecetedCategry: [Bool] = [] + var categoryArray: [ExploreCategory] = [] +// private var filterCVCDelegate: FilterCVCDelegate? + var fromServer = true + + private var selectedCategory: Int? + = nil + + private var selectedAvailablity: String? = nil override func viewDidLoad() { super.viewDidLoad() setLabel() setButton(view: allButton, isSelected: false) - setButton(view: publicButton, isSelected: true) + setButton(view: publicButton, isSelected: false) setButton(view: unpublicButton, isSelected: false) + categoryCollectionView.showsHorizontalScrollIndicator = false categoryCollectionView.delegate = self categoryCollectionView.dataSource = self - - - // Do any additional setup after loading the view. + + availablityButtonSet(availablity: selectedAvailablity) } override func viewWillAppear(_ animated: Bool) { +// getSelectedFilterInfo() setCategoryData() -// print(categoryArray[0].name) + selectedAvailablity = MypageVC.selectedAvailablity + selectedCategory = MypageVC.selectedCategory + availablityButtonSet(availablity: selectedAvailablity) } + @IBAction func dismissButtonTapped(_ sender: UIButton) { NotificationCenter.default.post(name: .init("categoryClose"), object: nil) self.dismiss(animated: true, completion: nil) } @IBAction func allButtonTapped(_ sender: UIButton) { + selectedAvailablity = "all" + availablityButtonSet(availablity: selectedAvailablity) } @IBAction func publicButtonTapped(_ sender: UIButton) { + selectedAvailablity = "public" + availablityButtonSet(availablity: selectedAvailablity) } @IBAction func unpublicButtonTapped(_ sender: UIButton) { + selectedAvailablity = "unpublic" + availablityButtonSet(availablity: selectedAvailablity) + } + + + @IBAction func applyButtonTapped(_ sender: Any) { + + NotificationCenter.default.post(name: .init("categoryClose"), object: nil, userInfo: ["categoryId": selectedCategory , "selectedAv": selectedAvailablity ?? "all"]) + self.dismiss(animated: true, completion: nil) + + } + +// @objc func getSelectedFilterInfo(_ notification: Notification) { +// guard let userInfo = notification.userInfo as? [String: Any] else { return } +// guard let categoryId = userInfo["categoryId"] as? Int else { return } +// guard let selectedAv = userInfo["selectedAv"] as? String else { return } +// +// self.selectedAvailablity = selectedAv +// self.selectedCategory = categoryId +// +// } +// func categoryButtonSet(category: Int){ +// <#function body#> +// } + func availablityButtonSet(availablity: String?){ + switch availablity { + case "all": + allButton.backgroundColor = .black + allButton.setTitleColor(.white, for: .normal) + allButton.setBorderWithRadius(borderColor: .black, borderWidth: 1, cornerRadius: 4) + + publicButton.backgroundColor = .white + publicButton.setTitleColor(.slateGrey, for: .normal) + publicButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + + unpublicButton.backgroundColor = .white + unpublicButton.setTitleColor(.slateGrey, for: .normal) + unpublicButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + + case "public": + allButton.backgroundColor = .white + allButton.setTitleColor(.slateGrey, for: .normal) + allButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + + publicButton.backgroundColor = .black + publicButton.setTitleColor(.white, for: .normal) + publicButton.setBorderWithRadius(borderColor: .black, borderWidth: 1, cornerRadius: 4) + + + + unpublicButton.backgroundColor = .white + unpublicButton.setTitleColor(.slateGrey, for: .normal) + unpublicButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + case "unpublic": + allButton.backgroundColor = .white + allButton.setTitleColor(.slateGrey, for: .normal) + allButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + + publicButton.backgroundColor = .white + publicButton.setTitleColor(.slateGrey, for: .normal) + publicButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + + + unpublicButton.backgroundColor = .black + unpublicButton.setTitleColor(.white, for: .normal) + unpublicButton.setBorderWithRadius(borderColor: .black, borderWidth: 1, cornerRadius: 4) + + default: + allButton.backgroundColor = .black + allButton.setTitleColor(.white, for: .normal) + allButton.setBorderWithRadius(borderColor: .black, borderWidth: 1, cornerRadius: 4) + + publicButton.backgroundColor = .white + publicButton.setTitleColor(.slateGrey, for: .normal) + publicButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + + unpublicButton.backgroundColor = .white + unpublicButton.setTitleColor(.slateGrey, for: .normal) + unpublicButton.setBorderWithRadius(borderColor: .veryLightPink, borderWidth: 1, cornerRadius: 4) + } } func setLabel() { @@ -80,14 +171,14 @@ class CustomActionSheetFilterVC: UIViewController { extension CustomActionSheetFilterVC: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - - + selectedCategory = indexPath.item + } } extension CustomActionSheetFilterVC: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - print(categoryArray.count) + return categoryArray.count } @@ -97,20 +188,44 @@ extension CustomActionSheetFilterVC: UICollectionViewDataSource { for: indexPath) as? FilterCVC else { return UICollectionViewCell()} cell.indexPath = indexPath.row - cell.categoryArray = self.categoryArray - cell.setButton(isSelected: categoryArray[indexPath.row].selected!) - cell.setButton(text: categoryArray[indexPath.row].name) - print(indexPath.row) - print(categoryArray[indexPath.row].name) + + cell.category = self.categoryArray[indexPath.item] + + cell.setButton(text: categoryArray[indexPath.item].name) +// if selectedCategory != nil { +// if self.categoryArray[indexPath.item].id == selectedCategory!+1 { +// cell.setButton(selected: true) +// } +// } else { +// +// } -// categoryCollectionView.reloadData() +// cell.filterCVCDelegate = self + + return cell + } + + func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) { } + func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { + guard let cell = collectionView.cellForItem(at: indexPath) as? FilterCVC else { + return true + } + + if cell.isSelected { + selectedCategory = 0 + collectionView.deselectItem(at: indexPath, animated: false) + return false + } else { + return true + } + } } @@ -121,18 +236,16 @@ extension CustomActionSheetFilterVC: UICollectionViewDelegateFlowLayout { extension CustomActionSheetFilterVC { private func setCategoryData() { + fromServer = true ExploreCategoryService.shared.getExploreCategory { (result) in switch result { case .success(let data): guard let dt = data as? GenericResponse<[ExploreCategory]> else { return } if let categories = dt.data { self.categoryArray = categories - - for var category in self.categoryArray { - category.selected = false - } } self.categoryCollectionView.reloadData() + case .requestErr(let message): guard let message = message as? String else { return } let alertViewController = UIAlertController(title: "통신 실패", message: message, preferredStyle: .alert) @@ -158,17 +271,10 @@ extension CustomActionSheetFilterVC { } } } - -extension CustomActionSheetFilterVC: FilterCVCDelegate { - func setSelectedCategory(index: Int) { - - for var category in self.categoryArray { - category.selected = false - } - - categoryArray[index].selected = true - categoryCollectionView.reloadData() - } - - -} +// +//extension CustomActionSheetFilterVC: FilterCVCDelegate { +// func setSelectedCategory(index: Int) { +// +// } +// +//} diff --git a/BeMe/BeMe/CustomViews/CustomToastView.swift b/BeMe/BeMe/CustomViews/CustomToastView.swift new file mode 100644 index 0000000..e798477 --- /dev/null +++ b/BeMe/BeMe/CustomViews/CustomToastView.swift @@ -0,0 +1,47 @@ +// +// CustomToastView.swift +// BeMe +// +// Created by Yunjae Kim on 2021/01/15. +// + +import UIKit + +class ToastView: UIView { + + var toastBackground: UIImageView = UIImageView().then { +// $0.backgroundColor = .charcoalGrey + $0.image = UIImage(named: "rectangle279") + } + var toastLabel: UILabel = UILabel().then { + $0.font = UIFont(name: "AppleSDGothicNeo-Medium", size: 14) + $0.textColor = .white + } + override init(frame: CGRect) { + super.init(frame: frame) + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func setLayout(){ + self.addSubview(toastBackground) + self.addSubview(toastLabel) + + toastBackground.snp.makeConstraints { + $0.top.bottom.leading.trailing.equalToSuperview() + } + + toastLabel.snp.makeConstraints { + $0.bottom.equalToSuperview().offset(-16) + $0.centerX.equalToSuperview() + } + } + + func setLabel(text: String){ + toastLabel.text = text + } +} + diff --git a/BeMe/BeMe/Explore/VCs/ExploreHomeVC.swift b/BeMe/BeMe/Explore/VCs/ExploreHomeVC.swift index 05ee710..ce42dad 100644 --- a/BeMe/BeMe/Explore/VCs/ExploreHomeVC.swift +++ b/BeMe/BeMe/Explore/VCs/ExploreHomeVC.swift @@ -641,11 +641,34 @@ extension ExploreHomeVC: UITableViewButtonSelectedDelegate { } func goToTodayAnswerButtonDidTapped() { - + ExploreWriteService.shared.getExploreWrite { (result) in switch result { case .success(let data): guard let dt = data as? GenericResponse else { return } + if let answerData = dt.data as? ExploreWrite { + var createdAt = answerData.createdAt ?? "" + if createdAt != "" { + let index = createdAt.index(createdAt.startIndex, offsetBy: 10) + createdAt = createdAt.substring(to: index) + } + let inputData = AnswerDataForViewController(lock: true, questionCategory: answerData.questionCategoryName, answerDate: "", question: answerData.questionTitle, answer: "", index: 0, answerIdx: answerData.answerIdx, questionID: answerData.questionID, createdTime: createdAt, categoryID: answerData.questionCategoryID, id: answerData.id) + + guard let answerVC = UIStoryboard(name: "Answer", + bundle: nil).instantiateViewController( + withIdentifier: "AnswerVC") as? AnswerVC + else{ + + return + } + + + + answerVC.answerData = inputData + + self.navigationController?.pushViewController(answerVC, animated: true) + + } print(dt) diff --git a/BeMe/BeMe/Extensions/UIViewController+Extensions.swift b/BeMe/BeMe/Extensions/UIViewController+Extensions.swift index 435e93b..39a4d0c 100644 --- a/BeMe/BeMe/Extensions/UIViewController+Extensions.swift +++ b/BeMe/BeMe/Extensions/UIViewController+Extensions.swift @@ -11,7 +11,64 @@ import UIKit extension UIViewController { + func showToast(text: String, completion: @escaping ()->()) { + let toast = ToastView(frame: CGRect(x: 0, y: 0, width: 343, height: 84)) + toast.setLabel(text: text) + toast.alpha = 0 + self.view.addSubview(toast) + + toast.snp.makeConstraints { + $0.leading.equalToSuperview().offset(16) + $0.trailing.equalToSuperview().offset(-16) + $0.bottom.equalToSuperview().offset(-101) + } + + + UIView.animate(withDuration: 0.3, animations: { + toast.alpha = 1 + + },completion: { finish in + UIView.animate(withDuration: 0.3, delay: 0.7, animations: { + toast.alpha = 0 + + }, completion: { finish in + if finish { + toast.removeFromSuperview() + completion() + } + }) + }) + } + func showToast(text: String){ + let toast = ToastView(frame: CGRect(x: 0, y: 0, width: 343, height: 52)) +// let toast = ToastView(frame: self.view.frame) + toast.setLabel(text: text) + toast.alpha = 0 + self.view.addSubview(toast) + + toast.snp.makeConstraints { + $0.leading.equalToSuperview().offset(16) + $0.trailing.equalToSuperview().offset(-16) + $0.bottom.equalToSuperview().offset(-101) + $0.height.equalTo(52) + } + + + UIView.animate(withDuration: 0.3, animations: { + toast.alpha = 1 + + },completion: { finish in + UIView.animate(withDuration: 0.3, delay: 0.7, animations: { + toast.alpha = 0 + + }, completion: { finish in + if finish { +// toast.removeFromSuperview() + } + }) + }) + } diff --git a/BeMe/BeMe/Following/Cells/FollowNotAnsweredCVC.swift b/BeMe/BeMe/Following/Cells/FollowNotAnsweredCVC.swift index 64ac77b..9ad7cd0 100644 --- a/BeMe/BeMe/Following/Cells/FollowNotAnsweredCVC.swift +++ b/BeMe/BeMe/Following/Cells/FollowNotAnsweredCVC.swift @@ -20,6 +20,7 @@ class FollowNotAnsweredCVC: UICollectionViewCell { @IBOutlet weak var replyButton: UIButton! var answerData: FollowingAnswers? var followScrapButtonDelegate: FollowScrapButtonDelegate? + var indexInVC: Int? override func awakeFromNib() { containView.setBorder(borderColor: .lightGray, borderWidth: 1.0) containView.makeRounded(cornerRadius: 6) @@ -44,7 +45,9 @@ class FollowNotAnsweredCVC: UICollectionViewCell { categoryLabel.text = "[ \(inputAnswer.category)에 관한 질문 ] ·" categoryLabel.textColor = .slateGrey answerDateLabel.textColor = .slateGrey - answerTextView.text = "아직 송현님이 답하지 않은 질문입니다.\n답변을 하시고 글을 보시겠습니까?" + let myName = UserDefaults.standard.string(forKey: "nickName") + + answerTextView.text = "아직 \(myName!)님이 답하지 않은 질문입니다.\n답변을 하시고 글을 보시겠습니까?" @@ -53,8 +56,9 @@ class FollowNotAnsweredCVC: UICollectionViewCell { @IBAction func replyButtonAction(_ sender: Any) { - - followScrapButtonDelegate?.replyButtonTap(answerData: answerData!) + print("엥") + print(indexInVC!) + followScrapButtonDelegate?.replyButtonTap(answerData: answerData!,indexInVC: indexInVC!) } diff --git a/BeMe/BeMe/Following/Cells/FollowerListCVC.swift b/BeMe/BeMe/Following/Cells/FollowerListCVC.swift index d533dc7..57991cf 100644 --- a/BeMe/BeMe/Following/Cells/FollowerListCVC.swift +++ b/BeMe/BeMe/Following/Cells/FollowerListCVC.swift @@ -15,14 +15,16 @@ class FollowerListCVC: UICollectionViewCell { @IBOutlet weak var userNameLabel: UILabel! @IBOutlet weak var moreButton: UIButton! var tableViewDelegate: FollowMoreButtonMidDelegate? - + var followSearchProfileDelegate: FollowSearchProfileDelegate? override func awakeFromNib() { userNameLabel.text = followerPerson?.nickname profileImageView.imageFromUrl(followerPerson?.profileImg, defaultImgPath: "") moreButton.tintColor = .black profileImageView.makeRounded(cornerRadius: 18) profileImageView.contentMode = .scaleAspectFill - + profileImageView.isUserInteractionEnabled = true + let profileTabGesture = UITapGestureRecognizer(target: self, action: #selector(touchUpProfile)) + profileImageView.addGestureRecognizer(profileTabGesture) } func setItems(){ @@ -39,4 +41,10 @@ class FollowerListCVC: UICollectionViewCell { print("callll") tableViewDelegate?.settingButtonDidTapped(id: (followerPerson?.id)!) } + + @objc func touchUpProfile(){ + print("tttttt") + followSearchProfileDelegate?.profileSelectedTap(userID: (followerPerson?.id)!) + + } } diff --git a/BeMe/BeMe/Following/Cells/FollowingListCVC.swift b/BeMe/BeMe/Following/Cells/FollowingListCVC.swift index 7aca335..15cad05 100644 --- a/BeMe/BeMe/Following/Cells/FollowingListCVC.swift +++ b/BeMe/BeMe/Following/Cells/FollowingListCVC.swift @@ -16,7 +16,7 @@ class FollowingListCVC: UICollectionViewCell { @IBOutlet weak var followButton: UIButton! var followingPerson: FollowingFollows? var findPeopleSearchData: FindPeopleSearchData? - + var followSearchProfileDelegate: FollowSearchProfileDelegate? override func awakeFromNib() { profileImageView.imageFromUrl(followingPerson?.profileImg, defaultImgPath: "") profileImageView.makeRounded(cornerRadius: 18) @@ -26,7 +26,10 @@ class FollowingListCVC: UICollectionViewCell { followButton.makeRounded(cornerRadius: 3) followButton.setBorder(borderColor: .lightGray, borderWidth: 1.0) profileImageView.contentMode = .scaleAspectFill - + profileImageView.isUserInteractionEnabled = true + let profileTabGesture = UITapGestureRecognizer(target: self, action: #selector(touchUpProfile)) + profileImageView.addGestureRecognizer(profileTabGesture) + } @@ -103,6 +106,11 @@ class FollowingListCVC: UICollectionViewCell { userNameLabel.text = findPeopleSearchData?.nickname } - + @objc func touchUpProfile(){ + print("tttttt") + followSearchProfileDelegate?.profileSelectedTap(userID: (followingPerson?.id)!) + + } + } diff --git a/BeMe/BeMe/Following/Cells/FollowingWholeCV.swift b/BeMe/BeMe/Following/Cells/FollowingWholeCV.swift index a098a1a..d3dba8b 100644 --- a/BeMe/BeMe/Following/Cells/FollowingWholeCV.swift +++ b/BeMe/BeMe/Following/Cells/FollowingWholeCV.swift @@ -13,7 +13,6 @@ class FollowingWholeCV: UICollectionView { func reloadDataWithCompletion(_ complete: @escaping () -> Void) { reloadDataCompletionBlock = complete - print("callled") super.reloadData() } diff --git a/BeMe/BeMe/Following/Storyboards/FollowSearch.storyboard b/BeMe/BeMe/Following/Storyboards/FollowSearch.storyboard index 73e7dbf..a458f05 100644 --- a/BeMe/BeMe/Following/Storyboards/FollowSearch.storyboard +++ b/BeMe/BeMe/Following/Storyboards/FollowSearch.storyboard @@ -310,10 +310,10 @@ @@ -500,6 +504,9 @@ + + +