Naïvely integrate to navigation

This commit is contained in:
Francisco Gindre 2022-01-07 13:33:12 -03:00
parent 137631705c
commit b72ece4828
3 changed files with 17 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import ComposableArchitecture
struct AppState: Equatable {
enum Route: Equatable {
case welcome
case startup
case onboarding
case home
@ -12,7 +13,7 @@ struct AppState: Equatable {
var onboardingState: OnboardingState
var phraseValidationState: RecoveryPhraseValidationState
var phraseDisplayState: RecoveryPhraseDisplayState
var route: Route = .startup
var route: Route = .welcome
}
enum AppAction: Equatable {
@ -42,6 +43,7 @@ extension AppReducer {
)
private static let routeReducer = AppReducer { state, action, _ in
switch action {
case let .updateRoute(route):
state.route = route

View File

@ -30,6 +30,7 @@ struct AppView: View {
case .startup:
ZStack(alignment: .topTrailing) {
StartupView(sendAction: viewStore.send)
.transition(.opacity)
}
case .phraseValidation:
@ -64,6 +65,16 @@ struct AppView: View {
)
)
}
case .welcome:
WelcomeView()
.transition(.opacity)
.onAppear(perform: {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
withAnimation(.easeInOut(duration: 1)) {
viewStore.send(.updateRoute(.startup))
}
}
})
}
}
}
@ -87,8 +98,8 @@ private struct StartupView: View {
sendAction(.updateRoute(.phraseValidation))
}
Button("Go To Phrase Display Demo") {
sendAction(.updateRoute(.phraseDisplay))
Button("Go To Welcome Screen") {
sendAction(.updateRoute(.welcome))
}
}
}

View File

@ -31,6 +31,7 @@ struct WelcomeView: View {
}
.frame(alignment: .center)
.applyScreenBackground()
.animation(.easeInOut, value: 3)
}
}
}