refactor: Migration auf ManaWebShell + ManaTheme.paper aus mana-swift-* v1.6.0/v0.6.0
ManaWebShell aus mana-swift-ui v0.6.0 ersetzt den lokalen `Sources/Features/WebShell/`-Ordner. WebShellCoordinator, WebShell- View, WebShellScripts geloescht (~430 LOC). CookieBridge bleibt lokal (App-spezifischer Cookie-SSO-Pfad fuer .mana.how), wandert nach `Sources/Core/WebShell/CookieBridge.swift`. `RootView.makeWebShellConfig()` baut Config mit Host-Whitelist `zitare.com` + `www.zitare.com` + `*.mana.how`, ZitareTheme-Hints, `syncDarkMode(localStorageKey: "zitare-mode")` und `hideElements` fuer den zitare-web-Header. ZitareTheme forwarded auf ManaTheme.paper aus mana-swift-core v1.6.0 (~90 LOC weg, paper-Werte jetzt single-source in `mana/packages/themes/src/variants/paper.css`). AppConfig.userAgent als plattform-spezifischer Helper hinzu. 20/20 Unit-Tests gruen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e139a382d8
commit
4b00c4ecdf
8 changed files with 72 additions and 534 deletions
|
|
@ -1,6 +1,41 @@
|
|||
import ManaCore
|
||||
import ManaWebShell
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
private func makeWebShellConfig() -> WebShellConfig {
|
||||
WebShellConfig(
|
||||
allowedHosts: [
|
||||
"zitare.com",
|
||||
"www.zitare.com",
|
||||
"*.mana.how",
|
||||
],
|
||||
userAgent: AppConfig.userAgent,
|
||||
backgroundColor: ZitareTheme.background,
|
||||
progressTint: ZitareTheme.primary,
|
||||
errorBackgroundColor: ZitareTheme.muted,
|
||||
errorForegroundColor: ZitareTheme.foreground,
|
||||
errorIconColor: ZitareTheme.warning,
|
||||
userScripts: [
|
||||
// Syncs System-Dark-Mode in den WebView; zitare-web liest
|
||||
// `localStorage['zitare-mode']` beim First Paint und toggelt
|
||||
// dann `.dark` auf <html>.
|
||||
WebShellScripts.syncDarkMode(localStorageKey: "zitare-mode"),
|
||||
// Versteckt den zitare-web-Header (Brand-Logo + Nav), weil
|
||||
// die native TabBar bereits global navigiert.
|
||||
WebShellScripts.hideElements(
|
||||
selectors: [
|
||||
"header[data-app-nav]",
|
||||
"body header:has(a.brand)",
|
||||
"body > header:first-of-type",
|
||||
"body > div > header:first-of-type",
|
||||
],
|
||||
tagName: "hide-web-header"
|
||||
),
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
/// Top-Level-View: TabView mit drei Tabs.
|
||||
///
|
||||
/// **Phase ζ-1:** Lesen + Erkunden laden `zitare.com` via `WebShellView`.
|
||||
|
|
@ -16,13 +51,15 @@ struct RootView: View {
|
|||
@State private var reloadCounter: Int = 0
|
||||
@State private var healthStatus: HealthStatus = .unknown
|
||||
|
||||
private var webShellConfig: WebShellConfig { makeWebShellConfig() }
|
||||
|
||||
var body: some View {
|
||||
TabView(selection: $selectedTab) {
|
||||
WebShellView(target: readTarget)
|
||||
WebShellView(target: readTarget, config: webShellConfig)
|
||||
.tabItem { Label("Lesen", systemImage: "book") }
|
||||
.tag(AppTab.read)
|
||||
|
||||
WebShellView(target: exploreTarget)
|
||||
WebShellView(target: exploreTarget, config: webShellConfig)
|
||||
.tabItem { Label("Erkunden", systemImage: "sparkle.magnifyingglass") }
|
||||
.tag(AppTab.explore)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue