Skip to content

Commit

Permalink
fix: SplashViewReactor 화면 전환 issue 수정 (#702)
Browse files Browse the repository at this point in the history
* fix: App.Repository 중복 이벤트 방출 막기 위한 Take operator 추가

* fix: SplashReactor 최상위 Closure context unowned self 코드 명시

* fix: github Action release 조건절 수정
  • Loading branch information
Do-hyun-Kim authored Nov 7, 2024
1 parent 5878518 commit 406dd0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
run: tuist generate

- name: fastlane upload_prd_testflight
if: ${{ github.base_ref == 'release' && github.event_name == 'push' }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') }}
env:
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
Expand Down
27 changes: 14 additions & 13 deletions 14th-team5-iOS/App/Sources/Presentation/Splash/SplashReactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class SplashReactor: Reactor {
}

// MARK: - Properties
private let meRepository = MeUseCase(meRepository: MeAPIs.Worker()) // TODO: - Injected로 수정하기
private let meRepository: MeUseCaseProtocol = MeUseCase(meRepository: MeAPIs.Worker()) // TODO: - Injected로 수정하기
@Injected var familyUseCase: FamilyUseCaseProtocol

@Injected var fetchFamilyCreatedAtUseCase: FetchFamilyCreatedAtUseCaseProtocol
Expand All @@ -45,14 +45,17 @@ public final class SplashReactor: Reactor {
// MARK: - Intializer
init() { }

deinit {
print(#function)
}

// MARK: - Mutate
public func mutate(action: Action) -> Observable<Mutation> {
switch action {
case .viewDidLoad:
return meRepository.getAppVersion()
.asObservable()
.withUnretained(self)
.flatMap { owner, appVersionInfo in
.flatMap { [unowned self] appVersionInfo -> Observable<Mutation> in
guard let appVersionInfo = appVersionInfo else {
return Observable.just(Mutation.setUpdateNeeded(nil))
}
Expand All @@ -63,35 +66,33 @@ public final class SplashReactor: Reactor {
App.Repository.token.accessToken
.flatMap { token -> Observable<Mutation> in
guard let _ = token else {
owner.splashNavigator.toSignIn()
self.splashNavigator.toSignIn()
return Observable.just(Mutation.setMemberInfo(nil))
}

return self.meRepository.getMemberInfo()
.asObservable()
.withUnretained(self)
.flatMap { owner, memberInfo in
.flatMap { memberInfo -> Observable<Mutation> in
guard let memberInfo = memberInfo,
let _ = memberInfo.familyId else {
owner.splashNavigator.toSignIn()
self.splashNavigator.toSignIn()
return Observable.just(Mutation.setMemberInfo(nil))
}

return owner.fetchFamilyCreatedAtUseCase.execute()
.withUnretained(self)
.flatMap { owner, familyInfo -> Observable<Mutation> in
return self.fetchFamilyCreatedAtUseCase.execute()
.flatMap { familyInfo -> Observable<Mutation> in

if memberInfo.familyId != nil {
if UserDefaults.standard.inviteCode != nil {
owner.splashNavigator.toJoined()
self.splashNavigator.toJoined()
return .just(.setMemberInfo(memberInfo))
} else {
owner.splashNavigator.toHome()
self.splashNavigator.toHome()
return .just(.setMemberInfo(nil))
}
}

owner.splashNavigator.toJoinFamily()
self.splashNavigator.toJoinFamily()
return .just(.setMemberInfo(memberInfo))
}
}
Expand Down

0 comments on commit 406dd0e

Please sign in to comment.