Naïvely integrate to navigation
This commit is contained in:
parent
137631705c
commit
b72ece4828
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ struct WelcomeView: View {
|
|||
}
|
||||
.frame(alignment: .center)
|
||||
.applyScreenBackground()
|
||||
.animation(.easeInOut, value: 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue