Fix Timer Bug for UI Layout

This commit is contained in:
Hariharan Mudaliar 2025-12-21 13:45:38 +05:30
commit 6e365c1b11
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
5 changed files with 100 additions and 67 deletions

View file

@ -51,6 +51,10 @@ class DynamicIslandViewCoordinator: ObservableObject {
@Published var currentView: NotchViews = .home {
didSet {
if Defaults[.enableMinimalisticUI] && currentView != .home {
currentView = .home
return
}
handleStatsTabTransition(from: oldValue, to: currentView)
}
}
@ -116,6 +120,13 @@ class DynamicIslandViewCoordinator: ObservableObject {
self?.handleTimerFeatureToggle(change.newValue)
}
.store(in: &cancellables)
Defaults.publisher(.enableMinimalisticUI)
.receive(on: DispatchQueue.main)
.sink { [weak self] change in
self?.handleMinimalisticModeChange(change.newValue)
}
.store(in: &cancellables)
}
private func handleStatsTabTransition(from oldValue: NotchViews, to newValue: NotchViews) {
@ -152,6 +163,15 @@ class DynamicIslandViewCoordinator: ObservableObject {
currentView = .home
}
}
private func handleMinimalisticModeChange(_ isEnabled: Bool) {
guard isEnabled else { return }
if currentView != .home {
withAnimation(.smooth) {
currentView = .home
}
}
}
func toggleSneakPeek(status: Bool, type: SneakContentType, duration: TimeInterval = 1.5, value: CGFloat = 0, icon: String = "") {
let resolvedDuration: TimeInterval