Phase 2 aus dem Native-Auth-Vollausbau-Plan (Option A, siehe ../mana/docs/MANA_SWIFT.md). Entstanden weil drei Apps fast- byte-identische LoginView.swift hatten und Sign-Up/Forgot-PW komplett fehlten. ManaAuthUI-Library mit: - ManaBrandConfig — App-injizierte Theme-Werte (forest für Cards/ Manaspur, mana-default für Memoro), Environment-Key, View-Modifier - Base-Components: ManaAuthScaffold, ManaPrimaryButton, ManaTextField, ManaSecureField + .manaEmailField()-Modifier - ManaLoginView + LoginViewModel — Email/PW-Login, schaltet bei AuthError.emailNotVerified automatisch auf ManaEmailVerifyGateView - ManaSignUpView + SignUpViewModel — Email/Name/PW + awaiting- Verification-Hinweis-Screen - ManaEmailVerifyGateView + ViewModel — Resend-Verification - ManaForgotPasswordView + ViewModel — Reset-Mail anfordern (immer generischer Hinweis, User-Enumeration-Schutz) - ManaResetPasswordView + ViewModel — neues PW mit Token aus Universal-Link - ManaChangeEmailView, ManaChangePasswordView, ManaDeleteAccountView + internal ViewModels — Account-Bausteine - ManaDeleteAccountView ist zweistufig (Bestätigungs-Wort tippen + Passwort) → App-Store-Guideline 5.1.1(v) Pflicht-Surface 26/26 ViewModel-Tests grün via per-test-ID URLProtocol-Routing (löst Parallel-Pollution zwischen .serialized Suites). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
67 lines
2.3 KiB
Swift
67 lines
2.3 KiB
Swift
import SwiftUI
|
|
|
|
/// Gemeinsames Layout-Gerüst für alle Auth-Screens: brand-getöntes
|
|
/// Background, scrollbarer Content-Stack mit max-width, optional
|
|
/// ein zentriertes Logo + App-Name + Tagline-Block am Anfang.
|
|
///
|
|
/// Apps brauchen keine eigene NavigationStack-Wrapper — das ist die
|
|
/// Aufgabe der konsumierenden View (Login/SignUp etc. sitzen ggf.
|
|
/// in einer Sheet oder einem NavigationStack der App).
|
|
public struct ManaAuthScaffold<Content: View>: View {
|
|
@Environment(\.manaBrand) private var brand
|
|
private let showsHeader: Bool
|
|
private let content: Content
|
|
|
|
/// - Parameters:
|
|
/// - showsHeader: Wenn `true`, wird oben Logo + AppName + Tagline
|
|
/// gerendert. Default `true`. Auf Account-Sub-Views (Change-
|
|
/// Password etc.) sinnvollerweise `false`.
|
|
public init(showsHeader: Bool = true, @ViewBuilder content: () -> Content) {
|
|
self.showsHeader = showsHeader
|
|
self.content = content()
|
|
}
|
|
|
|
public var body: some View {
|
|
ZStack {
|
|
brand.background.ignoresSafeArea()
|
|
|
|
ScrollView {
|
|
VStack(spacing: 24) {
|
|
if showsHeader {
|
|
header
|
|
}
|
|
content
|
|
}
|
|
.padding(.horizontal, 24)
|
|
.padding(.top, showsHeader ? 64 : 24)
|
|
.padding(.bottom, 32)
|
|
.frame(maxWidth: 480)
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
#if os(iOS)
|
|
.scrollDismissesKeyboard(.interactively)
|
|
#endif
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var header: some View {
|
|
VStack(spacing: 12) {
|
|
if let symbol = brand.logoSymbol {
|
|
Image(systemName: symbol)
|
|
.font(.system(size: 44, weight: .medium))
|
|
.foregroundStyle(brand.primary)
|
|
}
|
|
Text(brand.appName)
|
|
.font(.system(size: 40, weight: .bold))
|
|
.foregroundStyle(brand.primary)
|
|
.multilineTextAlignment(.center)
|
|
if let tagline = brand.tagline {
|
|
Text(tagline)
|
|
.font(.subheadline)
|
|
.foregroundStyle(brand.mutedForeground)
|
|
.multilineTextAlignment(.center)
|
|
}
|
|
}
|
|
}
|
|
}
|