feat(auth): DEBUG-Auto-Login (Memoro-Pattern)
Bei lokalen Xcode-Run-Builds wird beim Start automatisch eingeloggt wenn der Keychain leer ist. Spart das manuelle Login bei jedem Re-Install via Xcode. - Sources/Core/Auth/DebugCredentials.swift — #if DEBUG-gewrappte Founder-Credentials (tills95@gmail.com / Aa-123456789) - Sources/Core/Auth/AuthClient+EnsureSignedIn.swift — Extension ensureSignedIn() prüft .signedOut → signIn() in DEBUG - RootView.task ruft auth.ensureSignedIn() — Release-Builds No-Op (Release/TestFlight/App-Store bleiben unverändert, User muss manuell einloggen) Pattern 1:1 von memoro-native (gleiches File-Layout + Klassennamen). Build 9 → 10. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
505aa9db19
commit
33101d703d
4 changed files with 52 additions and 12 deletions
18
Sources/Core/Auth/AuthClient+EnsureSignedIn.swift
Normal file
18
Sources/Core/Auth/AuthClient+EnsureSignedIn.swift
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import ManaCore
|
||||
|
||||
extension AuthClient {
|
||||
/// Stellt sicher, dass der User eingeloggt ist. Nur in DEBUG-Builds
|
||||
/// aktiv: wenn die Session nach `bootstrap()` `.signedOut` ist,
|
||||
/// wird automatisch mit den DEBUG-Credentials angemeldet. In
|
||||
/// Release-Builds No-Op — User muss manuell einloggen.
|
||||
///
|
||||
/// Vorbild: memoro-native — wird in `RootView.task` aufgerufen.
|
||||
func ensureSignedIn() async {
|
||||
#if DEBUG
|
||||
if case .signedOut = status {
|
||||
Log.auth.notice("DEBUG auto-login: signing in with DebugCredentials")
|
||||
await signIn(email: DebugCredentials.email, password: DebugCredentials.password)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
17
Sources/Core/Auth/DebugCredentials.swift
Normal file
17
Sources/Core/Auth/DebugCredentials.swift
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#if DEBUG
|
||||
/// Dev-only Auto-Login-Credentials.
|
||||
///
|
||||
/// **Nur in DEBUG-Builds aktiv** — der ganze File ist hinter
|
||||
/// `#if DEBUG` gewrapped und wird in Release-Builds (TestFlight/
|
||||
/// App-Store) nicht kompiliert. Wird beim App-Start von
|
||||
/// `AuthClient.ensureSignedIn()` verwendet, falls die Session-Token
|
||||
/// im Keychain abgelaufen oder leer sind — damit Till während der
|
||||
/// Entwicklung nicht jedes Mal manuell einloggen muss.
|
||||
///
|
||||
/// Identisches Pattern wie `memoro-native/Sources/Core/Auth/
|
||||
/// DebugCredentials.swift`.
|
||||
enum DebugCredentials {
|
||||
static let email = "tills95@gmail.com"
|
||||
static let password = "Aa-123456789"
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue