ζ-1 abgeschlossen: DeepLinkRouter + Web-Header-Hide

- DeepLinkRouter als pure-Logic-Enum aus RootView extrahiert
  (resolveToWebURL, isExplorePath, route)
- 11 DeepLinkRouterTests grün: custom-scheme, https passthrough,
  Erkunden-vs-Lesen-Routing, Substring-Guard
- WebShellScripts.hideWebHeader: WKUserScript injiziert at
  document.start CSS, das den zitare-Web-Header
  (body header:has(a.brand)) ausblendet. Native TabBar
  übernimmt globale Navigation, Content bleibt sichtbar.
- Simulator-Verifikation: Quote rendert ohne doppelte Nav-Leiste,
  17 (UI + Unit) Tests grün

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till 2026-05-14 13:06:37 +02:00
parent 75b5e7113f
commit dd10f85cca
6 changed files with 166 additions and 36 deletions

View file

@ -0,0 +1,30 @@
import Foundation
import WebKit
/// User-Scripts, die in jeden `WKWebView` injiziert werden.
///
/// `WKUserScript` ist MainActor-isolated; deshalb sind die Factory-
/// Methoden hier ebenfalls MainActor. Aufrufer leben sowieso auf Main
/// (SwiftUI `makeUIView`/`makeNSView` sind MainActor).
@MainActor
enum WebShellScripts {
/// Versteckt den zitare-Web-Header (`<header>` mit `<a class="brand">`),
/// weil die native TabBar bereits global navigiert. Footer und
/// Hauptinhalt bleiben sichtbar.
///
/// CSS wird at document.start als `<style>`-Tag injiziert vor dem
/// First Paint, kein Flicker.
static let hideWebHeader: WKUserScript = .init(
source: """
(function() {
var css = 'body header:has(a.brand) { display: none !important; }';
var style = document.createElement('style');
style.setAttribute('data-zitare-native', 'hide-web-header');
style.textContent = css;
(document.head || document.documentElement).appendChild(style);
})();
""",
injectionTime: .atDocumentStart,
forMainFrameOnly: true
)
}