From cbc9af6bb041cab91e6af85f0ab544e746770d35 Mon Sep 17 00:00:00 2001 From: Till JS Date: Fri, 15 May 2026 13:59:49 +0200 Subject: [PATCH] =?UTF-8?q?fix(launch):=20drei=20Layer=20wei=C3=9Fen=20Fla?= =?UTF-8?q?sh=20beim=20Start=20gefixt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit System-Launch-Screen war default-weiß (UILaunchScreen leer), WKWebView malt vor first paint opaque weiß, und das HTML selbst hat keinen Background bevor das CSS-Bundle lädt. Alle drei Layer jetzt auf den Paper-Theme-Background gesetzt — sRGB-konvertiert aus `--color-background` in mana/packages/themes/paper.css. - LaunchBackground.colorset mit Light + Dark Variante - project.yml: UILaunchScreen.UIColorName: LaunchBackground - WKWebView: isOpaque=false + clear backgrounds (iOS), drawsBackground=false (macOS) Co-Authored-By: Claude Opus 4.7 (1M context) --- Sources/Features/WebShell/WebShellView.swift | 9 +++++ .../LaunchBackground.colorset/Contents.json | 38 +++++++++++++++++++ project.yml | 8 +++- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 Sources/Resources/Assets.xcassets/LaunchBackground.colorset/Contents.json diff --git a/Sources/Features/WebShell/WebShellView.swift b/Sources/Features/WebShell/WebShellView.swift index e6c1859..2d7e9e7 100644 --- a/Sources/Features/WebShell/WebShellView.swift +++ b/Sources/Features/WebShell/WebShellView.swift @@ -112,6 +112,12 @@ final class WebNavState { webView.navigationDelegate = context.coordinator webView.uiDelegate = context.coordinator webView.allowsBackForwardNavigationGestures = true + // Ohne diese drei flackert WKWebView bis zum first paint weiß + // gegen das Paper-Theme — egal was die SwiftUI-Hülle als + // Background setzt. + webView.isOpaque = false + webView.backgroundColor = .clear + webView.scrollView.backgroundColor = .clear webView.scrollView.refreshControl = makeRefreshControl( webView: webView, coordinator: context.coordinator @@ -162,6 +168,9 @@ final class WebNavState { webView.navigationDelegate = context.coordinator webView.uiDelegate = context.coordinator webView.allowsBackForwardNavigationGestures = true + // macOS-Pendant zu UIView.isOpaque=false — sonst weißer + // Flash vor first paint. + webView.setValue(false, forKey: "drawsBackground") context.coordinator.observe(webView: webView) context.coordinator.load(target.url, into: webView) return webView diff --git a/Sources/Resources/Assets.xcassets/LaunchBackground.colorset/Contents.json b/Sources/Resources/Assets.xcassets/LaunchBackground.colorset/Contents.json new file mode 100644 index 0000000..95677a8 --- /dev/null +++ b/Sources/Resources/Assets.xcassets/LaunchBackground.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.936", + "green" : "0.954", + "red" : "0.964" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.077", + "green" : "0.087", + "red" : "0.103" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/project.yml b/project.yml index f79e71c..f5ed973 100644 --- a/project.yml +++ b/project.yml @@ -66,7 +66,13 @@ targets: # ist die Info.plist XcodeGen-getrieben, also explizit hier. CFBundleIconName: AppIcon LSApplicationCategoryType: "public.app-category.reference" - UILaunchScreen: {} + # Paper-Theme-Background als Launch-Screen statt System-Weiß, + # damit zwischen Tap und first SwiftUI-paint kein weißer Flash + # mehr sichtbar ist. Asset hat Light + Dark Variante, matcht + # `--color-background` aus mana/packages/themes/paper.css und + # `ZitareTheme.background` im Native-Code. + UILaunchScreen: + UIColorName: LaunchBackground UISupportedInterfaceOrientations: - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft