diff --git a/YELLO-iOS/YELLO-iOS.xcodeproj/project.pbxproj b/YELLO-iOS/YELLO-iOS.xcodeproj/project.pbxproj index 417d7fae..8ac4ff57 100644 --- a/YELLO-iOS/YELLO-iOS.xcodeproj/project.pbxproj +++ b/YELLO-iOS/YELLO-iOS.xcodeproj/project.pbxproj @@ -2438,7 +2438,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.1; + MARKETING_VERSION = 1.4.2; PRODUCT_BUNDLE_IDENTIFIER = YELLO.iOS.dev; PRODUCT_NAME = "$(Yello_Bundle_Name)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2599,7 +2599,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.1; + MARKETING_VERSION = 1.4.2; PRODUCT_BUNDLE_IDENTIFIER = YELLO.iOS; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2639,7 +2639,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.4.1; + MARKETING_VERSION = 1.4.2; PRODUCT_BUNDLE_IDENTIFIER = YELLO.iOS; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/YELLO-iOS/YELLO-iOS/Application/AppDelegate.swift b/YELLO-iOS/YELLO-iOS/Application/AppDelegate.swift index b427460a..dcac4dc7 100644 --- a/YELLO-iOS/YELLO-iOS/Application/AppDelegate.swift +++ b/YELLO-iOS/YELLO-iOS/Application/AppDelegate.swift @@ -115,19 +115,21 @@ extension AppDelegate: MessagingDelegate { print("FirebaseMessaging") guard let fcmToken = fcmToken else { return } let deviceToken:[String: String] = ["token": fcmToken] - - let requestDTO = DeviceTokenRefreshRequestDTO(deviceToken: fcmToken) - NetworkService.shared.onboardingService.putRefreshDeviceToken(requsetDTO: requestDTO) { result in - switch result { - case .success(let data): - if data.status == 200 || data.status == 201 { - User.shared.deviceToken = fcmToken + if fcmToken != User.shared.deviceToken { + let requestDTO = DeviceTokenRefreshRequestDTO(deviceToken: fcmToken) + NetworkService.shared.onboardingService.putRefreshDeviceToken(requsetDTO: requestDTO) { result in + switch result { + case .success(let data): + if data.status == 200 || data.status == 201 { + User.shared.deviceToken = fcmToken + print("Device token 재발급 완료:", deviceToken) + } + default: + print("deviceToken 재발급 오류") } - default: - print("deviceToken 재발급 오류") } } User.shared.deviceToken = fcmToken - print("Device token 재발급 완료:", deviceToken) + print("Device token:", deviceToken) } } diff --git a/YELLO-iOS/YELLO-iOS/Network/Base/MyRequestInterceptor.swift b/YELLO-iOS/YELLO-iOS/Network/Base/MyRequestInterceptor.swift index 7e4c259a..e43af5ff 100644 --- a/YELLO-iOS/YELLO-iOS/Network/Base/MyRequestInterceptor.swift +++ b/YELLO-iOS/YELLO-iOS/Network/Base/MyRequestInterceptor.swift @@ -51,11 +51,8 @@ final class MyRequestInterceptor: RequestInterceptor { print("재발급 출발") if retryCount < maxRetryCount { - let accessToken = KeychainHandler.shared.accessToken - let refreshToken = KeychainHandler.shared.refreshToken - let dto = TokenRefreshRequestDTO(accessToken: "Bearer \(accessToken)", refreshToken: "Bearer \(refreshToken)") - NetworkService.shared.onboardingService.postRefreshToken(requsetDTO: dto) { result in + NetworkService.shared.onboardingService.postRefreshToken() { result in switch result { case .success(let data): guard let decodedData = data.data else { return } diff --git a/YELLO-iOS/YELLO-iOS/Network/Onboarding/Router/OnboardingTarget.swift b/YELLO-iOS/YELLO-iOS/Network/Onboarding/Router/OnboardingTarget.swift index 55dc0553..61a4596a 100644 --- a/YELLO-iOS/YELLO-iOS/Network/Onboarding/Router/OnboardingTarget.swift +++ b/YELLO-iOS/YELLO-iOS/Network/Onboarding/Router/OnboardingTarget.swift @@ -16,7 +16,7 @@ enum OnboardingTarget { case getCheckDuplicate(_ dto: IdValidRequestQueryDTO) /// 아이디 중복 확인 case postFirendsList( _ query: JoinedFriendsRequestQueryDTO, _ dto: JoinedFriendsRequestDTO) /// 가입한 친구 목록 불러오기 case postUserInfo(_ dto: SignUpRequestDTO ) /// 회원가입 - case postRefreshToken(_ dto: TokenRefreshRequestDTO) + case postRefreshToken case putDeviceToken(_ dto: DeviceTokenRefreshRequestDTO) } @@ -36,7 +36,7 @@ extension OnboardingTarget: TargetType { case .postUserInfo: return .unauthorization case .postRefreshToken: - return .unauthorization + return .authorization case .putDeviceToken: return .authorization } @@ -119,8 +119,8 @@ extension OnboardingTarget: TargetType { return .requestQuery(dto) case .postFirendsList(let query, let dto): return .requestQueryWithBody(query, bodyParameter: dto) - case .postRefreshToken(let dto): - return .requestWithBody(dto) + case .postRefreshToken: + return .requestPlain case .putDeviceToken(let dto): return .requestWithBody(dto) } diff --git a/YELLO-iOS/YELLO-iOS/Network/Onboarding/Service/OnboardingService.swift b/YELLO-iOS/YELLO-iOS/Network/Onboarding/Service/OnboardingService.swift index 160c77c2..5b6be854 100644 --- a/YELLO-iOS/YELLO-iOS/Network/Onboarding/Service/OnboardingService.swift +++ b/YELLO-iOS/YELLO-iOS/Network/Onboarding/Service/OnboardingService.swift @@ -16,8 +16,8 @@ protocol OnboardingServiceProtocol { func getSchoolList(queryDTO: SchoolSearchRequestQueryDTO, completion: @escaping (NetworkResult>) -> Void) func getMajorList(queryDTO: MajorSearchRequestQueryDTO, completion: @escaping (NetworkResult>) -> Void) func postJoinedFriends(queryDTO: JoinedFriendsRequestQueryDTO, requestDTO: JoinedFriendsRequestDTO, completion: @escaping (NetworkResult>) -> Void) - func postRefreshToken(requsetDTO: TokenRefreshRequestDTO, completion: @escaping (NetworkResult>) -> Void) - func putRefreshDeviceToken(requsetDTO: DeviceTokenRefreshRequestDTO, completion: @escaping (NetworkResult>) ->Void) + func postRefreshToken(completion: @escaping (NetworkResult>) -> Void) + func putRefreshDeviceToken(requsetDTO: DeviceTokenRefreshRequestDTO, completion: @escaping (NetworkResult>) -> Void) } @@ -47,11 +47,11 @@ final class OnboardingService: APIRequestLoader, OnboardingSer fetchData(target: .postFirendsList(queryDTO, requestDTO), responseData: BaseResponse.self, completion: completion) } - func postRefreshToken(requsetDTO: TokenRefreshRequestDTO, completion: @escaping (NetworkResult>)->Void) { - fetchData(target: .postRefreshToken(requsetDTO), responseData: BaseResponse.self, completion: completion) + func postRefreshToken(completion: @escaping (NetworkResult>) -> Void) { + fetchData(target: .postRefreshToken, responseData: BaseResponse.self, completion: completion) } - func putRefreshDeviceToken(requsetDTO: DeviceTokenRefreshRequestDTO, completion: @escaping (NetworkResult>)->Void) { + func putRefreshDeviceToken(requsetDTO: DeviceTokenRefreshRequestDTO, completion: @escaping (NetworkResult>) -> Void) { fetchData(target: .putDeviceToken(requsetDTO), responseData: BaseResponse.self, completion: completion) } diff --git a/YELLO-iOS/YELLO-iOS/Network/Search/Router/SearchTarget.swift b/YELLO-iOS/YELLO-iOS/Network/Search/Router/SearchTarget.swift index a85b80d7..93bc5e16 100644 --- a/YELLO-iOS/YELLO-iOS/Network/Search/Router/SearchTarget.swift +++ b/YELLO-iOS/YELLO-iOS/Network/Search/Router/SearchTarget.swift @@ -10,7 +10,7 @@ import Alamofire @frozen enum SearchTarget { - case friendSearch(_ dto: FriendSearchRequestQueryDTO) /// 학교 검색 + case friendSearch(_ query: FriendSearchRequestQueryDTO) } extension SearchTarget: TargetType { @@ -45,8 +45,8 @@ extension SearchTarget: TargetType { var parameters: RequestParams { switch self { - case .friendSearch(let dto): - return .requestQuery(dto) + case .friendSearch(let query): + return .requestQuery(query) } } } diff --git a/YELLO-iOS/YELLO-iOS/Presentation/Payment/ViewController/PaymentPlusViewController.swift b/YELLO-iOS/YELLO-iOS/Presentation/Payment/ViewController/PaymentPlusViewController.swift index 794eb74e..305d83e2 100644 --- a/YELLO-iOS/YELLO-iOS/Presentation/Payment/ViewController/PaymentPlusViewController.swift +++ b/YELLO-iOS/YELLO-iOS/Presentation/Payment/ViewController/PaymentPlusViewController.swift @@ -60,7 +60,6 @@ final class PaymentPlusViewController: BaseViewController { setDelegate() getProducts() setNotification() - purchaseSubscribeNeed() } override func viewWillAppear(_ animated: Bool) { @@ -68,6 +67,7 @@ final class PaymentPlusViewController: BaseViewController { tabBarController?.tabBar.isHidden = true paymentPlusView.paymentView.bannerTimer() + purchaseSubscribeNeed() } func getProducts() { diff --git a/YELLO-iOS/YELLO-iOS/Presentation/Profile/Main/ViewController/ProfileViewController.swift b/YELLO-iOS/YELLO-iOS/Presentation/Profile/Main/ViewController/ProfileViewController.swift index 40aebda2..209ba30e 100644 --- a/YELLO-iOS/YELLO-iOS/Presentation/Profile/Main/ViewController/ProfileViewController.swift +++ b/YELLO-iOS/YELLO-iOS/Presentation/Profile/Main/ViewController/ProfileViewController.swift @@ -116,9 +116,12 @@ extension ProfileViewController: HandleDeleteFriendButtonDelegate { func deleteFriendButtonTapped() { profileView.showToast(message: profileView.myProfileFriendModelDummy[profileView.indexNumber].name + StringLiterals.Profile.Friend.toastMessage) - friendProfileViewController.friendProfileView.profileDeleteFriend(id: profileView.myProfileFriendModelDummy[profileView.indexNumber].userId) - bottomSheetViewController.friendProfileView.profileDeleteFriend(id: profileView.myProfileFriendModelDummy[profileView.indexNumber].userId) - + if #available(iOS 15.0, *) { + friendProfileViewController.friendProfileView.profileDeleteFriend(id: profileView.myProfileFriendModelDummy[profileView.indexNumber].userId) + } else { + bottomSheetViewController.friendProfileView.profileDeleteFriend(id: profileView.myProfileFriendModelDummy[profileView.indexNumber].userId) + } + // 삭제 작업이 적용된 후에 UI 업데이트 DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { self.profileView.myProfileFriendModelDummy.remove(at: self.profileView.indexNumber) diff --git a/YELLO-iOS/YELLO-iOS/Presentation/Recommending/Search/ViewController/FriendSearchViewController.swift b/YELLO-iOS/YELLO-iOS/Presentation/Recommending/Search/ViewController/FriendSearchViewController.swift index 8b217c4a..c3e1cae0 100644 --- a/YELLO-iOS/YELLO-iOS/Presentation/Recommending/Search/ViewController/FriendSearchViewController.swift +++ b/YELLO-iOS/YELLO-iOS/Presentation/Recommending/Search/ViewController/FriendSearchViewController.swift @@ -61,7 +61,7 @@ final class FriendSearchViewController: BaseViewController { friendSearchView.friendSearchTextfield.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged) } - func searchFriend(_ word: String) { + func searchFriend(_ word: String?) { if fetchingMore { // 이미 데이터를 가져오는 중이면 리턴 return } @@ -70,7 +70,7 @@ final class FriendSearchViewController: BaseViewController { return } - let queryDTO: FriendSearchRequestQueryDTO = FriendSearchRequestQueryDTO(keyword: word, page: pageCount) + let queryDTO: FriendSearchRequestQueryDTO = FriendSearchRequestQueryDTO(keyword: word ?? "", page: pageCount) self.fetchingMore = true if !self.isScroll { @@ -85,7 +85,12 @@ final class FriendSearchViewController: BaseViewController { switch result { case .success(let data): guard let data = data.data else { return } - self.allFriend.append(contentsOf: data.friendList) + // 중복되는 모델 필터 처리 + let uniqueFriendModels = data.friendList.filter { model in + !self.allFriend.contains { $0.id == model.id } + } + + self.allFriend.append(contentsOf: uniqueFriendModels) self.fetchingMore = false if !self.isScroll { @@ -96,15 +101,18 @@ final class FriendSearchViewController: BaseViewController { self.totalItemCount = data.totalCount if data.totalCount == 0 { - if word.isEmpty { + if word == "" { + // 전부 지웠을 때 self.allFriend.removeAll() self.friendSearchView.noResultView.isHidden = true self.friendSearchView.loadingStackView.isHidden = true } else { + // 검색 결과 없을 때 self.allFriend.removeAll() self.friendSearchView.noResultView.isHidden = false } } else { + // 검색 결과 있을 떄 self.friendSearchView.noResultView.isHidden = true } @@ -159,6 +167,7 @@ extension FriendSearchViewController: UITextFieldDelegate { @objc func textFieldDidChange(_ textField: UITextField) { guard let text = textField.text else { return } isFinishPaging = false + fetchingMore = false pageCount = 0 allFriend.removeAll() searchFriend(text) diff --git a/YELLO-iOS/YELLO-iOS/Presentation/Voting/VotingTimer/VotingTimerViewController.swift b/YELLO-iOS/YELLO-iOS/Presentation/Voting/VotingTimer/VotingTimerViewController.swift index 32b86dac..1096e921 100644 --- a/YELLO-iOS/YELLO-iOS/Presentation/Voting/VotingTimer/VotingTimerViewController.swift +++ b/YELLO-iOS/YELLO-iOS/Presentation/Voting/VotingTimer/VotingTimerViewController.swift @@ -307,14 +307,26 @@ extension VotingTimerViewController { result in switch result { case .success(let data): - guard let data = data.data else { return } - if data.isPossible { - let viewController = VotingStartViewController() - viewController.myPoint = String(data.point) - UIView.transition(with: self.navigationController?.view ?? UIView(), duration: 0.001, options: .transitionCrossDissolve, animations: { - // 전환 시 스르륵 바뀌는 애니메이션 적용 - self.navigationController?.pushViewController(viewController, animated: false) - }) + let status = data.status + guard let data = data.data else { + if status == 400 { + let viewController = VotingLockedViewController() + UIView.transition(with: self.navigationController?.view ?? UIView(), duration: 0.001, options: .transitionCrossDissolve, animations: { + // 전환 시 스르륵 바뀌는 애니메이션 적용 + self.navigationController?.pushViewController(viewController, animated: false) + }) + } + return + } + if status == 200 { + if data.isPossible { + let viewController = VotingStartViewController() + viewController.myPoint = String(data.point) + UIView.transition(with: self.navigationController?.view ?? UIView(), duration: 0.001, options: .transitionCrossDissolve, animations: { + // 전환 시 스르륵 바뀌는 애니메이션 적용 + self.navigationController?.pushViewController(viewController, animated: false) + }) + } } self.myPoint = data.point self.originView.topOfMyPoint.setTextWithLineHeight(text: String(self.myPoint), lineHeight: 24)