Working stuff with revamped UI

This commit is contained in:
Hariharan Mudaliar 2025-12-09 17:03:17 +05:30
commit 5a8c592157
No known key found for this signature in database
GPG key ID: D04F1C2B9194DDFC
11 changed files with 646 additions and 279 deletions

View file

@ -47,6 +47,7 @@ struct ExpandedItem {
class DynamicIslandViewCoordinator: ObservableObject {
static let shared = DynamicIslandViewCoordinator()
private var cancellables = Set<AnyCancellable>()
@Published var currentView: NotchViews = .home {
didSet {
@ -64,6 +65,9 @@ class DynamicIslandViewCoordinator: ObservableObject {
@AppStorage("showWhatsNew") var showWhatsNew: Bool = true
@AppStorage("musicLiveActivityEnabled") var musicLiveActivityEnabled: Bool = true
@AppStorage("timerLiveActivityEnabled") var timerLiveActivityEnabled: Bool = true
@Default(.enableTimerFeature) private var enableTimerFeature
@Default(.timerDisplayMode) private var timerDisplayMode
@AppStorage("alwaysShowTabs") var alwaysShowTabs: Bool = true {
didSet {
@ -99,6 +103,19 @@ class DynamicIslandViewCoordinator: ObservableObject {
private init() {
selectedScreen = preferredScreen
Defaults.publisher(.timerDisplayMode)
.receive(on: DispatchQueue.main)
.sink { [weak self] change in
self?.handleTimerDisplayModeChange(change.newValue)
}
.store(in: &cancellables)
Defaults.publisher(.enableTimerFeature)
.receive(on: DispatchQueue.main)
.sink { [weak self] change in
self?.handleTimerFeatureToggle(change.newValue)
}
.store(in: &cancellables)
}
private func handleStatsTabTransition(from oldValue: NotchViews, to newValue: NotchViews) {
@ -121,6 +138,20 @@ class DynamicIslandViewCoordinator: ObservableObject {
}
}
}
private func handleTimerDisplayModeChange(_ mode: TimerDisplayMode) {
guard mode == .popover, currentView == .timer else { return }
withAnimation(.smooth) {
currentView = .home
}
}
private func handleTimerFeatureToggle(_ isEnabled: Bool) {
guard !isEnabled, currentView == .timer else { return }
withAnimation(.smooth) {
currentView = .home
}
}
func toggleSneakPeek(status: Bool, type: SneakContentType, duration: TimeInterval = 1.5, value: CGFloat = 0, icon: String = "") {
let resolvedDuration: TimeInterval