fix(account): Anmelden-Button + ManaAuthGate-Wiring
AccountView hatte zwar einen Status-Text aber keinen Login-Button,
und der ManaAuthGate war überhaupt nicht im App-Tree eingebaut —
Guest-Mode-User konnten sich nirgends anmelden.
- ZitareNativeApp: ManaAuthGate(auth:) instantiiert + via environment
durchgereicht
- RootView: .manaBrand(ZitareBrand.manaBrand) +
.manaAuthGate(authGate) { ManaLoginView(…) } für globales
Sign-In-Sheet
- AccountView: authActionCard mit "Mit mana-Konto anmelden" /
"Abmelden" (keepGuestMode: true)
- ZitareBrand neu (paper-Theme-Brücke zu ManaBrandConfig)
- project.yml: platformFilter: iOS für Widget+Share-Extensions
(macOS-Build war pre-existing kaputt mit "embedded iOS content")
iOS + macOS BUILD SUCCEEDED.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d8f3a1402c
commit
7ba8684074
5 changed files with 76 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import ManaAuthUI
|
||||
import ManaCore
|
||||
import ManaWebShell
|
||||
import SwiftUI
|
||||
|
|
@ -43,6 +44,7 @@ private func makeWebShellConfig() -> WebShellConfig {
|
|||
/// die App und routen in den passenden Tab.
|
||||
struct RootView: View {
|
||||
@Environment(AuthClient.self) private var auth
|
||||
@Environment(ManaAuthGate.self) private var authGate
|
||||
@State private var selectedTab: AppTab = .read
|
||||
@State private var readTarget = WebTarget(url: AppConfig.webBaseURL)
|
||||
@State private var exploreTarget = WebTarget(
|
||||
|
|
@ -76,6 +78,17 @@ struct RootView: View {
|
|||
.toolbarBackground(ZitareTheme.background, for: .windowToolbar)
|
||||
.toolbarBackground(.visible, for: .windowToolbar)
|
||||
#endif
|
||||
.manaBrand(ZitareBrand.manaBrand)
|
||||
.manaAuthGate(authGate) {
|
||||
NavigationStack {
|
||||
ManaLoginView(
|
||||
auth: auth,
|
||||
onSignUpTapped: {},
|
||||
onForgotTapped: {}
|
||||
)
|
||||
.manaBrand(ZitareBrand.manaBrand)
|
||||
}
|
||||
}
|
||||
.task {
|
||||
await probeHealth()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import ManaAuthUI
|
||||
import ManaCore
|
||||
import SwiftData
|
||||
import SwiftUI
|
||||
|
|
@ -6,12 +7,14 @@ import WidgetKit
|
|||
@main
|
||||
struct ZitareNativeApp: App {
|
||||
@State private var auth: AuthClient
|
||||
@State private var authGate: ManaAuthGate
|
||||
private let snapshotContainer: ModelContainer?
|
||||
|
||||
init() {
|
||||
let auth = AuthClient(config: AppConfig.manaAppConfig)
|
||||
auth.bootstrap()
|
||||
_auth = State(initialValue: auth)
|
||||
_authGate = State(initialValue: ManaAuthGate(auth: auth))
|
||||
do {
|
||||
snapshotContainer = try SnapshotContainer.make()
|
||||
} catch {
|
||||
|
|
@ -29,6 +32,7 @@ struct ZitareNativeApp: App {
|
|||
WindowGroup {
|
||||
RootView()
|
||||
.environment(auth)
|
||||
.environment(authGate)
|
||||
.tint(ZitareTheme.primary)
|
||||
.task {
|
||||
await refreshSnapshot()
|
||||
|
|
|
|||
21
Sources/Core/Theme/ZitareBrand.swift
Normal file
21
Sources/Core/Theme/ZitareBrand.swift
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import ManaAuthUI
|
||||
|
||||
/// Brücke zwischen `ZitareTheme` (paper-Variant) und der
|
||||
/// `ManaBrandConfig` von `ManaAuthUI`. Im App-Body als Environment-Wert
|
||||
/// gesetzt — Login-Sheet bekommt damit das paper-Theme statt mana-Default.
|
||||
enum ZitareBrand {
|
||||
static let manaBrand = ManaBrandConfig(
|
||||
appName: "Zitare",
|
||||
tagline: "Öffentlicher Zitat-Korpus von mana e.V.",
|
||||
logoSymbol: "quote.opening",
|
||||
background: ZitareTheme.background,
|
||||
foreground: ZitareTheme.foreground,
|
||||
surface: ZitareTheme.surface,
|
||||
mutedForeground: ZitareTheme.mutedForeground,
|
||||
border: ZitareTheme.border,
|
||||
primary: ZitareTheme.primary,
|
||||
primaryForeground: ZitareTheme.primaryForeground,
|
||||
error: ZitareTheme.error,
|
||||
success: ZitareTheme.success
|
||||
)
|
||||
}
|
||||
|
|
@ -1,13 +1,21 @@
|
|||
import ManaAuthUI
|
||||
import ManaCore
|
||||
import SwiftUI
|
||||
|
||||
/// Phase ζ-0 minimal: zeigt Auth-Status und Healthz-Probe-Ergebnis.
|
||||
/// Phase ζ-3 erweitert um ManaAuthUI-Login-Sheet und Submission-
|
||||
/// History-Link (via WebShell auf `zitare.mana.how/me`).
|
||||
/// Phase ζ-3 erweitert um Submission-History-Link (via WebShell auf
|
||||
/// `zitare.mana.how/me`). Login-Sheet schon hier, damit Guests einen
|
||||
/// Anmelden-Button finden.
|
||||
struct AccountView: View {
|
||||
@Environment(AuthClient.self) private var auth
|
||||
@Environment(ManaAuthGate.self) private var authGate
|
||||
let healthStatus: HealthStatus
|
||||
|
||||
private var isSignedIn: Bool {
|
||||
if case .signedIn = auth.status { return true }
|
||||
return false
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 24) {
|
||||
|
|
@ -15,6 +23,8 @@ struct AccountView: View {
|
|||
|
||||
statusCard
|
||||
|
||||
authActionCard
|
||||
|
||||
Spacer(minLength: 32)
|
||||
|
||||
aboutCard
|
||||
|
|
@ -25,6 +35,30 @@ struct AccountView: View {
|
|||
.background(ZitareTheme.background)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var authActionCard: some View {
|
||||
if isSignedIn {
|
||||
Button(role: .destructive) {
|
||||
Task { await auth.signOut(keepGuestMode: true) }
|
||||
} label: {
|
||||
Label("Abmelden", systemImage: "arrow.left.square")
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.controlSize(.large)
|
||||
} else {
|
||||
Button {
|
||||
authGate.isPresentingSignIn = true
|
||||
} label: {
|
||||
Label("Mit mana-Konto anmelden", systemImage: "arrow.right.square")
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.controlSize(.large)
|
||||
.tint(ZitareTheme.primary)
|
||||
}
|
||||
}
|
||||
|
||||
private var header: some View {
|
||||
VStack(spacing: 12) {
|
||||
// Eigenes Anführungszeichen-Glyph in der gleichen Variante
|
||||
|
|
|
|||
|
|
@ -46,8 +46,10 @@ targets:
|
|||
product: ManaWebShell
|
||||
- target: ZitareWidgetExtension
|
||||
embed: true
|
||||
platformFilter: iOS
|
||||
- target: ZitareShareExtension
|
||||
embed: true
|
||||
platformFilter: iOS
|
||||
sources:
|
||||
- path: Sources/App
|
||||
- path: Sources/Features
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue