v0.1.0 — initialer Sprint, vollständige Auth-Reise als SwiftUI
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>
This commit is contained in:
commit
0a2cb349b4
29 changed files with 2614 additions and 0 deletions
50
Sources/ManaAuthUI/Verify/EmailVerifyGateViewModel.swift
Normal file
50
Sources/ManaAuthUI/Verify/EmailVerifyGateViewModel.swift
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import Foundation
|
||||
import ManaCore
|
||||
import Observation
|
||||
|
||||
/// State-Maschine für ``ManaEmailVerifyGateView``. Wraps
|
||||
/// `AuthClient.resendVerification`.
|
||||
@MainActor
|
||||
@Observable
|
||||
public final class EmailVerifyGateViewModel {
|
||||
public enum Status: Equatable, Sendable {
|
||||
case idle
|
||||
case resending
|
||||
case resent(String)
|
||||
case error(String)
|
||||
}
|
||||
|
||||
public let email: String
|
||||
public private(set) var status: Status = .idle
|
||||
|
||||
private let auth: AuthClient
|
||||
private let sourceAppUrl: URL?
|
||||
|
||||
public init(email: String, auth: AuthClient, sourceAppUrl: URL? = nil) {
|
||||
self.email = email
|
||||
self.auth = auth
|
||||
self.sourceAppUrl = sourceAppUrl
|
||||
}
|
||||
|
||||
public var canResend: Bool {
|
||||
if case .resending = status { return false }
|
||||
return true
|
||||
}
|
||||
|
||||
public var isResending: Bool {
|
||||
if case .resending = status { return true }
|
||||
return false
|
||||
}
|
||||
|
||||
public func resend() async {
|
||||
status = .resending
|
||||
do {
|
||||
try await auth.resendVerification(email: email, sourceAppUrl: sourceAppUrl)
|
||||
status = .resent("Bestätigungs-Mail wurde verschickt. Schau in deinen Posteingang.")
|
||||
} catch let error as AuthError {
|
||||
status = .error(error.errorDescription ?? "Senden fehlgeschlagen")
|
||||
} catch {
|
||||
status = .error(String(describing: error))
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue