From 048895368010badf32e9a290142484d919c452aa Mon Sep 17 00:00:00 2001 From: YuGeonHui Date: Thu, 15 Feb 2024 11:04:09 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20App=20=EB=B2=84=EC=A0=84=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=EA=B0=95=EC=A0=9C=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=ED=8C=9D=EC=97=85=20=ED=91=9C=EC=B6=9C=20?= =?UTF-8?q?=ED=95=AD=EB=AA=A9=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/Presentation/Splash/SplashReactor.swift | 9 +++++++-- .../Presentation/Splash/SplashViewController.swift | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift index af906c9d4..7d495ce1e 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift @@ -27,7 +27,7 @@ public final class SplashViewReactor: Reactor { // MARK: - State public struct State { var memberInfo: MemberInfo? - var updatedNeeded: AppVersionInfo? + @Pulse var updatedNeeded: AppVersionInfo? } // MARK: - Properties @@ -47,7 +47,12 @@ public final class SplashViewReactor: Reactor { return meRepository.getAppVersion() .asObservable() .flatMap { appVersionInfo in - Observable.concat([ + + guard let appVersionInfo = appVersionInfo else { + return Observable.just(Mutation.setUpdateNeeded(nil)) + } + + return Observable.concat([ Observable.just(Mutation.setUpdateNeeded(appVersionInfo)), self.meRepository.getMemberInfo() .asObservable() diff --git a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift index 48348876a..7b598a8ef 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift @@ -77,8 +77,9 @@ public final class SplashViewController: BaseViewController { .bind(onNext: { $0.0.showNextPage(with: $0.1.0)}) .disposed(by: disposeBag) - reactor.state.map { $0.updatedNeeded } - .compactMap { $0?.inService } + reactor.pulse(\.$updatedNeeded) + .skip(1) + .filter { $0 == nil } .withUnretained(self) .observe(on: Schedulers.main) .bind(onNext: { $0.0.showUpdateAlert($0.1) }) @@ -133,8 +134,7 @@ public final class SplashViewController: BaseViewController { sceneDelegate.window?.makeKeyAndVisible() } - private func showUpdateAlert(_ inService: Bool) { - guard !inService else { return } + private func showUpdateAlert(_ appVersionInfo: AppVersionInfo?) { let updateAlertController = UIAlertController( title: "업데이트가 필요해요", message: "더 나은 삐삐를 위해\n업데이트를 부탁드려요.", From c8ce08975ef14080330b23fad603911b441c3580 Mon Sep 17 00:00:00 2001 From: YuGeonHui Date: Thu, 15 Feb 2024 16:52:42 +0900 Subject: [PATCH 2/3] =?UTF-8?q?hotfix:=20=EA=B0=81=EC=A2=85=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - refreshToken이슈 해결 - Widget 딥링크 이슈 해결 - 기존 사용자 프로세스 로직 재개편 --- .../ViewControllers/HomeViewController.swift | 16 +++--- .../ViewControllers/PostViewController.swift | 1 + .../Presentation/Splash/SplashReactor.swift | 26 ++++++---- .../Splash/SplashViewController.swift | 51 ++++++++----------- .../Data/Sources/API/APIWorker.swift | 2 +- .../Sources/Account/MeAPI/MeAPIWorker.swift | 3 +- .../Sources/Service/AccountSignInHelper.swift | 2 +- .../Service/Kakao/KakaoSignInHelper.swift | 2 +- 8 files changed, 54 insertions(+), 49 deletions(-) diff --git a/14th-team5-iOS/App/Sources/Presentation/Home/ViewControllers/HomeViewController.swift b/14th-team5-iOS/App/Sources/Presentation/Home/ViewControllers/HomeViewController.swift index 180da2a31..e64290c23 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Home/ViewControllers/HomeViewController.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Home/ViewControllers/HomeViewController.swift @@ -31,7 +31,9 @@ final class HomeViewController: BaseViewController, UICollectio override func viewDidLoad() { super.viewDidLoad() + self.hideCameraButton(true) + UserDefaults.standard.inviteCode = nil } override func viewWillAppear(_ animated: Bool) { @@ -251,10 +253,10 @@ extension HomeViewController { .bind(to: postCollectionView.rx.items(dataSource: createPostDataSource())) .disposed(by: disposeBag) - postStream - .withUnretained(self) - .bind(onNext: { _ in App.Repository.member.postId.accept(UserDefaults.standard.postId) }) - .disposed(by: disposeBag) +// postStream +// .withUnretained(self) +// .bind(onNext: { _ in App.Repository.member.postId.accept(UserDefaults.standard.postId) }) +// .disposed(by: disposeBag) reactor.pulse(\.$isRefreshEnd) .withUnretained(self) @@ -269,7 +271,9 @@ extension HomeViewController { reactor.pulse(\.$postSection) .withUnretained(self) - .bind(onNext: { $0.0.timerView.reactor = TimerDIContainer().makeReactor(isSelfUploaded: reactor.currentState.isSelfUploaded, isAllUploaded: reactor.currentState.isAllFamilyMembersUploaded) + .bind(onNext: { + $0.0.timerView.reactor = TimerDIContainer().makeReactor(isSelfUploaded: reactor.currentState.isSelfUploaded, isAllUploaded: reactor.currentState.isAllFamilyMembersUploaded) + App.Repository.member.postId.accept(UserDefaults.standard.postId) }) .disposed(by: disposeBag) @@ -352,7 +356,7 @@ extension HomeViewController { case .main(let postListData): if postListData.postId == postId { let indexPath = IndexPath(row: index, section: 0) - self.navigationController?.pushViewController(PostListsDIContainer().makeViewController(postLists: reactor.currentState.postSection, selectedIndex: indexPath), animated: false) + self.navigationController?.pushViewController(PostListsDIContainer().makeViewController(postLists: reactor.currentState.postSection, selectedIndex: indexPath), animated: true) } } } diff --git a/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift b/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift index 248cb9fe8..8f36bc2fe 100644 --- a/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift +++ b/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift @@ -69,6 +69,7 @@ final class PostViewController: BaseViewController { .disposed(by: disposeBag) reactor.state.map { $0.isPop } + .filter { $0 } .distinctUntilChanged() .observe(on: MainScheduler.instance) .withUnretained(self) diff --git a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift index 7d495ce1e..a7e5f6199 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift @@ -26,7 +26,7 @@ public final class SplashViewReactor: Reactor { // MARK: - State public struct State { - var memberInfo: MemberInfo? + @Pulse var memberInfo: MemberInfo? @Pulse var updatedNeeded: AppVersionInfo? } @@ -41,7 +41,6 @@ public final class SplashViewReactor: Reactor { // MARK: - Mutate public func mutate(action: Action) -> Observable { - switch action { case .viewDidLoad: return meRepository.getAppVersion() @@ -54,10 +53,18 @@ public final class SplashViewReactor: Reactor { return Observable.concat([ Observable.just(Mutation.setUpdateNeeded(appVersionInfo)), - self.meRepository.getMemberInfo() - .asObservable() - .flatMap { memberInfo in - Observable.just(Mutation.setMemberInfo(memberInfo)) + + App.Repository.token.accessToken + .flatMap { token -> Observable in + guard let _ = token else { + return Observable.just(Mutation.setMemberInfo(nil)) + } + + return self.meRepository.getMemberInfo() + .asObservable() + .flatMap { memberInfo in + Observable.just(Mutation.setMemberInfo(memberInfo)) + } } ]) } @@ -69,9 +76,10 @@ public final class SplashViewReactor: Reactor { var newState = state switch mutation { case .setMemberInfo(let memberInfo): - App.Repository.member.memberID.accept(memberInfo?.memberId) - App.Repository.member.familyId.accept(memberInfo?.familyId) - + if let memberInfo = memberInfo { + App.Repository.member.memberID.accept(memberInfo.memberId) + App.Repository.member.familyId.accept(memberInfo.familyId) + } newState.memberInfo = memberInfo case .setUpdateNeeded(let appVersion): newState.updatedNeeded = appVersion diff --git a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift index 7b598a8ef..54ea4f216 100644 --- a/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift +++ b/14th-team5-iOS/App/Sources/Presentation/Splash/SplashViewController.swift @@ -58,7 +58,6 @@ public final class SplashViewController: BaseViewController { override public func bind(reactor: SplashViewReactor) { Observable.just(()) - .take(1) .map { Reactor.Action.viewDidLoad } .bind(to: reactor.action) .disposed(by: disposeBag) @@ -69,12 +68,11 @@ public final class SplashViewController: BaseViewController { .bind(onNext: { $0.0.openAppStore() }) .disposed(by: disposeBag) - reactor.state.map { ($0.memberInfo, $0.updatedNeeded) } - .delay(.seconds(1), scheduler: Schedulers.main) + reactor.pulse(\.$memberInfo) + .skip(1) .withUnretained(self) .observe(on: Schedulers.main) - .filter { $0.1.1?.inService == true } - .bind(onNext: { $0.0.showNextPage(with: $0.1.0)}) + .bind(onNext: { $0.0.showNextPage(with: $0.1)}) .disposed(by: disposeBag) reactor.pulse(\.$updatedNeeded) @@ -94,44 +92,39 @@ public final class SplashViewController: BaseViewController { } private func showNextPage(with member: MemberInfo?) { - guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate else { return } - let container: UINavigationController - - if let _ = member?.familyId { - var container: UINavigationController - if UserDefaults.standard.finishTutorial { - if let _ = UserDefaults.standard.inviteCode { - container = UINavigationController(rootViewController: JoinedFamilyDIContainer().makeViewController()) - } else { - container = UINavigationController(rootViewController: HomeDIContainer().makeViewController()) - } - } else { - container = UINavigationController(rootViewController: OnBoardingDIContainer().makeViewController()) - } - sceneDelegate.window?.rootViewController = container - sceneDelegate.window?.makeKeyAndVisible() - return - } + var container: UINavigationController - guard let isTemporary = App.Repository.token.accessToken.value?.isTemporaryToken else { + guard let member = member else { container = UINavigationController(rootViewController: AccountSignInDIContainer().makeViewController()) sceneDelegate.window?.rootViewController = container sceneDelegate.window?.makeKeyAndVisible() return } - if isTemporary { + let isTemporary = App.Repository.token.accessToken.value?.isTemporaryToken + if isTemporary == true { container = UINavigationController(rootViewController: AccountSignUpDIContainer().makeViewController()) sceneDelegate.window?.rootViewController = container sceneDelegate.window?.makeKeyAndVisible() return } else { - container = UINavigationController(rootViewController: OnBoardingDIContainer().makeViewController()) + if let _ = member.familyId { + if UserDefaults.standard.inviteCode != nil { + container = UINavigationController(rootViewController: JoinedFamilyDIContainer().makeViewController()) + } else { + container = UINavigationController(rootViewController: HomeDIContainer().makeViewController()) + } + sceneDelegate.window?.rootViewController = container + sceneDelegate.window?.makeKeyAndVisible() + return + } else { + container = UINavigationController(rootViewController: OnBoardingDIContainer().makeViewController()) + sceneDelegate.window?.rootViewController = container + sceneDelegate.window?.makeKeyAndVisible() + return + } } - - sceneDelegate.window?.rootViewController = container - sceneDelegate.window?.makeKeyAndVisible() } private func showUpdateAlert(_ appVersionInfo: AppVersionInfo?) { diff --git a/14th-team5-iOS/Data/Sources/API/APIWorker.swift b/14th-team5-iOS/Data/Sources/API/APIWorker.swift index c257bce33..7b53925ad 100644 --- a/14th-team5-iOS/Data/Sources/API/APIWorker.swift +++ b/14th-team5-iOS/Data/Sources/API/APIWorker.swift @@ -61,7 +61,7 @@ public final class BibbiRequestInterceptor: RequestInterceptor, BibbiRouterInter completion(.success(urlRequest)) } - public func retry(_ request: Request, for session: Session, dueTo error: Error, retryCount: Int = 0, completion: @escaping (RetryResult) -> Void) { + public func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -> Void) { guard let response = request.task?.response as? HTTPURLResponse, response.statusCode == 401 else { completion(.doNotRetryWithError(error)) diff --git a/14th-team5-iOS/Data/Sources/Account/MeAPI/MeAPIWorker.swift b/14th-team5-iOS/Data/Sources/Account/MeAPI/MeAPIWorker.swift index 3900e11e0..dd6c623d1 100644 --- a/14th-team5-iOS/Data/Sources/Account/MeAPI/MeAPIWorker.swift +++ b/14th-team5-iOS/Data/Sources/Account/MeAPI/MeAPIWorker.swift @@ -89,8 +89,7 @@ extension MeAPIWorker: MeRepositoryProtocol, JoinFamilyRepository { } private func getMemberInfo(spec: APISpec) -> Single { - - return request(spec: spec, headers: [BibbiAPI.Header.xAppKey]) + return request(spec: spec) .subscribe(on: Self.queue) .do(onNext: { if let str = String(data: $0.1, encoding: .utf8) { diff --git a/14th-team5-iOS/Data/Sources/Service/AccountSignInHelper.swift b/14th-team5-iOS/Data/Sources/Service/AccountSignInHelper.swift index 9f1d99bcc..8ba38b9d6 100644 --- a/14th-team5-iOS/Data/Sources/Service/AccountSignInHelper.swift +++ b/14th-team5-iOS/Data/Sources/Service/AccountSignInHelper.swift @@ -93,7 +93,7 @@ extension AccountSignInHelper { guard let signOut = self?.signInHelper[sns]?.signOut() else { return Disposables.create() } observer.onNext(signOut) - + App.Repository.token.clearAccessToken() return Disposables.create() } diff --git a/14th-team5-iOS/Data/Sources/Service/Kakao/KakaoSignInHelper.swift b/14th-team5-iOS/Data/Sources/Service/Kakao/KakaoSignInHelper.swift index 903756b07..9e933db88 100644 --- a/14th-team5-iOS/Data/Sources/Service/Kakao/KakaoSignInHelper.swift +++ b/14th-team5-iOS/Data/Sources/Service/Kakao/KakaoSignInHelper.swift @@ -57,7 +57,7 @@ final class KakaoSignInHelper: AccountSignInHelperType { UserApi.shared.rx.logout() .subscribe(onCompleted: { // Token 제거시 확인 - App.Repository.token.clearAccessToken() + debugPrint("Kakao logout completed!") }, onError: { error in debugPrint("Kakao logout error!") From a309f3ba3089d14c7d802ef975a8559cdb8ab314 Mon Sep 17 00:00:00 2001 From: YuGeonHui Date: Thu, 15 Feb 2024 17:32:03 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=EC=85=80=ED=94=BC=20=EC=9D=B4?= =?UTF-8?q?=EB=AA=A8=EC=A7=80=202=EB=B2=88=20=ED=98=B8=EC=B6=9C=201?= =?UTF-8?q?=ED=9A=8C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/PostViewController.swift | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift b/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift index 8f36bc2fe..86e4f9de1 100644 --- a/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift +++ b/14th-team5-iOS/App/Sources/Presentation/PostDetail/ViewControllers/PostViewController.swift @@ -47,6 +47,9 @@ final class PostViewController: BaseViewController { } .withUnretained(self) .bind { owner, emoji in + + print("emoji: \(emoji)") + let cameraViewController = CameraDIContainer(cameraType: .realEmoji, realEmojiType: emoji).makeViewController() owner.navigationController?.pushViewController(cameraViewController, animated: true) }.disposed(by: disposeBag) @@ -99,7 +102,7 @@ final class PostViewController: BaseViewController { .disposed(by: disposeBag) didTapProfileImageNotificationHandler() - didTapSelectableCameraButtonNotifcationHandler() +// didTapSelectableCameraButtonNotifcationHandler() } override func setupUI() { @@ -230,14 +233,14 @@ extension PostViewController { } extension PostViewController { - private func didTapSelectableCameraButtonNotifcationHandler() { - NotificationCenter.default - .rx.notification(.didTapSelectableCameraButton) - .withUnretained(self) - .bind { owner, _ in - owner.pushCameraViewController(cameraType: .realEmoji) - }.disposed(by: disposeBag) - } +// private func didTapSelectableCameraButtonNotifcationHandler() { +// NotificationCenter.default +// .rx.notification(.didTapSelectableCameraButton) +// .withUnretained(self) +// .bind { owner, _ in +// owner.pushCameraViewController(cameraType: .realEmoji) +// }.disposed(by: disposeBag) +// } private func didTapProfileImageNotificationHandler() { NotificationCenter.default