feat: add iOS support and harden receipt scanning
This commit is contained in:
34
app/ios/ScanReceipts/Features/Auth/AuthFlowView.swift
Normal file
34
app/ios/ScanReceipts/Features/Auth/AuthFlowView.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
import SwiftUI
|
||||
|
||||
/// Shown for `AppState.phase == .signedOut` (see `App/RootView.swift`, which
|
||||
/// depends on this exact type name and its zero-argument initializer). Owns
|
||||
/// simple in-feature navigation between "Anmelden", "Registrieren", and the
|
||||
/// post-signup "bitte bestätige deine E-Mail" screen — none of that belongs
|
||||
/// in `AppState` since none of it affects whether the user is actually
|
||||
/// signed in; `AppState.phase` only changes once a real session exists.
|
||||
struct AuthFlowView: View {
|
||||
private enum Screen: Equatable {
|
||||
case login
|
||||
case signup
|
||||
case verificationPending(email: String)
|
||||
}
|
||||
|
||||
@State private var screen: Screen = .login
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
switch screen {
|
||||
case .login:
|
||||
LoginView(onSwitchToSignup: { screen = .signup })
|
||||
case .signup:
|
||||
SignupView(
|
||||
onSignupSucceeded: { email in screen = .verificationPending(email: email) },
|
||||
onSwitchToLogin: { screen = .login }
|
||||
)
|
||||
case .verificationPending(let email):
|
||||
VerificationPendingView(email: email, onGoToLogin: { screen = .login })
|
||||
}
|
||||
}
|
||||
.animation(.default, value: screen)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user