Reading experience:
- Body text #CECECE (dark) / #1A1916 (light) — was near-invisible #4A4A4A
- 30pt heavy headline, 17pt body at 8.5pt line-spacing
- Skeleton pulse loading state replaces dark spinner box
- Hero image fades in on load (0.3s ease-in)
- Orange reading progress bar (2pt) below nav bar
- Max reading width 680pt for iPad legibility
Appearance:
- AppearanceMode enum (system/light/dark) in Theme.swift
- @AppStorage("appearanceMode") applied once in JarvisApp root
- Appearance picker (Picker in Menu) in reader toolbar
- Removed .preferredColorScheme(.dark) from all 12 child views
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60 lines
2.2 KiB
Swift
60 lines
2.2 KiB
Swift
// JarvisApp.swift
|
|
|
|
import SwiftUI
|
|
import SwiftData
|
|
import UIKit
|
|
import BackgroundTasks
|
|
|
|
final class AppDelegate: NSObject, UIApplicationDelegate {
|
|
func application(_ application: UIApplication,
|
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
|
// Register the briefing background-refresh handler before launch completes.
|
|
BGTaskScheduler.shared.register(forTaskWithIdentifier: jarvisBriefingRefreshID, using: nil) { task in
|
|
Task { @MainActor in
|
|
await NotificationManager.shared.applySettings()
|
|
NotificationManager.shared.scheduleBackgroundRefresh()
|
|
task.setTaskCompleted(success: true)
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
|
|
@main
|
|
struct JarvisApp: App {
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
|
@AppStorage("appearanceMode") private var appearanceMode: AppearanceMode = .dark
|
|
@StateObject private var settings = ServerSettings.shared
|
|
@StateObject private var store = StoryStore.shared
|
|
@StateObject private var ws = WebSocketManager.shared
|
|
@StateObject private var connectivity = ConnectivitySettings.shared
|
|
@StateObject private var connManager = ConnectivityManager.shared
|
|
@StateObject private var notifications = NotificationManager.shared
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
Group {
|
|
if settings.isConfigured {
|
|
RootTabView()
|
|
} else {
|
|
OnboardingView()
|
|
}
|
|
}
|
|
.preferredColorScheme(appearanceMode.colorScheme)
|
|
.environmentObject(settings)
|
|
.environmentObject(store)
|
|
.environmentObject(ws)
|
|
.environmentObject(connectivity)
|
|
.environmentObject(connManager)
|
|
.environmentObject(notifications)
|
|
.task {
|
|
connManager.start()
|
|
await connManager.resolveAndActivate()
|
|
await notifications.bootstrap()
|
|
}
|
|
}
|
|
.modelContainer(for: [CachedStory.self, CachedArticle.self, ReadStory.self,
|
|
SavedStory.self, SeenStory.self])
|
|
}
|
|
}
|