diff --git a/Andromida/App/Localization/Localizable.xcstrings b/Andromida/App/Localization/Localizable.xcstrings index ac23562..b6460c2 100644 --- a/Andromida/App/Localization/Localizable.xcstrings +++ b/Andromida/App/Localization/Localizable.xcstrings @@ -1962,6 +1962,9 @@ "Release shoulder tension" : { "comment" : "Habit title for releasing shoulder tension during mindfulness practice.", "isCommentAutoGenerated" : true + }, + "Reload Widget Timelines" : { + }, "Remaining" : { "comment" : "Label for the number of days remaining in a ritual's progress.", diff --git a/Andromida/App/Views/RootView.swift b/Andromida/App/Views/RootView.swift index d78d820..92def80 100644 --- a/Andromida/App/Views/RootView.swift +++ b/Andromida/App/Views/RootView.swift @@ -90,12 +90,20 @@ struct RootView: View { .onChange(of: scenePhase) { _, newPhase in if newPhase == .active { store.reminderScheduler.clearBadge() + + // Update time-of-day immediately (synchronously) before any UI refresh. + // This ensures the correct rituals are shown without a visible transition. + store.updateCurrentTimeOfDay() + let useDebugOverlay = UserDefaults.standard.bool(forKey: debugForegroundRefreshKey) if useDebugOverlay { UserDefaults.standard.set(false, forKey: debugForegroundRefreshKey) } + + // Only show overlay for debug refreshes. Normal foreground refreshes + // happen silently to avoid jarring transitions when crossing time boundaries. refreshAllTabs( - showOverlay: true, + showOverlay: useDebugOverlay, minimumSeconds: useDebugOverlay ? debugForegroundRefreshMinimumSeconds : foregroundRefreshMinimumSeconds ) } diff --git a/Andromida/App/Views/Settings/SettingsView.swift b/Andromida/App/Views/Settings/SettingsView.swift index 4d1cf54..d687e42 100644 --- a/Andromida/App/Views/Settings/SettingsView.swift +++ b/Andromida/App/Views/Settings/SettingsView.swift @@ -1,5 +1,6 @@ import SwiftUI import Bedrock +import WidgetKit struct SettingsView: View { @Bindable var store: SettingsStore @@ -173,6 +174,14 @@ struct SettingsView: View { UserDefaults.standard.set(true, forKey: "debugForegroundRefreshNextForeground") } + SettingsRow( + systemImage: "widget.small", + title: String(localized: "Reload Widget Timelines"), + iconColor: AppAccent.primary + ) { + WidgetCenter.shared.reloadAllTimelines() + } + if let ritualStore { TimeOfDayDebugPicker(store: ritualStore) }