[P0-①] Theme follows system + keyboard background transparent

- Split Palette.dark / Palette.light into a ThemePalette struct
- Add EnvironmentKey<ThemePalette> + ThemedRoot<Content>
- Wrap OSGKeyboardApp root in ThemedRoot so main App follows system
- Remove 6 .preferredColorScheme(.dark) overrides from main App views
- KeyboardRootView drops its Palette.background fill, uses .background(Color.clear)
- Drop the unused 'background' computed property from KeyboardRootView
- Legacy 'Palette.xxx' static accessors still resolve to dark values,
  so 2000 lines of existing call sites stay untouched

xcodebuild iOS Simulator: SUCCEEDED
This commit is contained in:
Zhongshu
2026-06-18 10:38:23 +08:00
parent bec36befa2
commit e0b92ff35a
9 changed files with 168 additions and 61 deletions
+10 -11
View File
@@ -1,7 +1,5 @@
// OSGKeyboardApp.swift
// OSGKeyboard · Main App
//
// DEBUG VERSION 2: restore real flow but instrument every step.
import SwiftUI
import OSGKeyboardShared
@@ -11,21 +9,22 @@ struct OSGKeyboardApp: App {
@StateObject private var config = ProviderConfig.shared
init() {
#if DEBUG
print("🔥 [OSGKeyboardApp] init()")
#endif
}
var body: some Scene {
WindowGroup {
Group {
if config.isConfigured {
HomeView()
.onAppear { print("🔥 [OSGKeyboardApp] → HomeView appeared") }
} else {
OnboardingView(config: config)
.onAppear { print("🔥 [OSGKeyboardApp] → OnboardingView appeared") }
ThemedRoot {
Group {
if config.isConfigured {
HomeView()
} else {
OnboardingView(config: config)
}
}
}
.onAppear { print("🔥 [OSGKeyboardApp] body appeared") }
}
}
}
}
-1
View File
@@ -33,7 +33,6 @@ struct HomeView: View {
.sheet(isPresented: $showKeyboardPreview) {
KeyboardPreviewSheet()
}
.preferredColorScheme(.dark)
}
// MARK: - Header
@@ -42,7 +42,6 @@ struct KeyboardPreviewSheet: View {
keyboardBlock
}
}
.preferredColorScheme(.dark)
}
private var mockTextField: some View {
@@ -30,7 +30,6 @@ struct KeyboardPreviewStub: View {
.padding(.bottom, 6)
}
.frame(height: 280)
.preferredColorScheme(.dark)
}
// MARK: - Top bar
-1
View File
@@ -37,7 +37,6 @@ struct OnboardingView: View {
.padding(.bottom, Spacing.lg)
}
}
.preferredColorScheme(.dark)
}
private var pageDots: some View {
-1
View File
@@ -37,7 +37,6 @@ struct SettingsView: View {
.foregroundStyle(Palette.accent)
}
}
.preferredColorScheme(.dark)
}
.confirmationDialog(
"Reset all settings?",