Refresh the shared snapshot in the background so widgets stop going stale
publishWidgetSnapshot() only ever ran from a user action, so an event created on the web or on Android did not reach the widgets until the app was opened again. A BGAppRefreshTask now republishes without the foreground. The two keys this needs are arrays, which Xcode does not expose as INFOPLIST_KEY_ build settings — verified by building and inspecting the result. Hence a partial Calendarr-Info.plist that generation merges into. It sits at the project root rather than inside the target folder: that folder is a synchronized group, which would also copy the file as a resource and collide with the processed one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c8a36c161f
commit
ad7a405f32
@@ -4,10 +4,17 @@ import SwiftUI
|
||||
struct CalendarrApp: App {
|
||||
@State private var appState = AppState()
|
||||
|
||||
init() {
|
||||
// Registration has to happen before the app finishes launching, which
|
||||
// is why it is here and not in a .task modifier.
|
||||
BackgroundRefresh.register()
|
||||
}
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
RootView()
|
||||
.environment(appState)
|
||||
.task { BackgroundRefresh.schedule() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user