iOS: ask for the background refresh as the app leaves, too (#421)

Build 5. The badge's refresh was requested only when the app came
forward; iOS asks for it as the app goes to the background. The
request made on coming forward stays. The timing is still iOS's.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Ray Slakinski
2026-11-08 14:31:21 -05:00
parent 9541f6c6f4
commit 05e522ac93
2 changed files with 7 additions and 1 deletions

View File

@@ -23,6 +23,12 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
self.window = window self.window = window
} }
/// iOS wants the request made as the app leaves, with the user's last look at the list; the
/// one made on coming forward stays for a run that was cut short.
func sceneDidEnterBackground(_ scene: UIScene) {
Badge.scheduleBackgroundRefresh()
}
func sceneDidBecomeActive(_ scene: UIScene) { func sceneDidBecomeActive(_ scene: UIScene) {
Badge.requestPermission() Badge.requestPermission()
Badge.scheduleBackgroundRefresh() Badge.scheduleBackgroundRefresh()

View File

@@ -25,7 +25,7 @@ targets:
properties: properties:
CFBundleDisplayName: iPX CFBundleDisplayName: iPX
CFBundleShortVersionString: $(MARKETING_VERSION) CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: "4" CFBundleVersion: "5"
# Playing on with the screen locked. A plist key, not a signed entitlement, so it works on # Playing on with the screen locked. A plist key, not a signed entitlement, so it works on
# a free personal team; CarPlay's own dashboard app is an entitlement Apple has to grant. # a free personal team; CarPlay's own dashboard app is an entitlement Apple has to grant.
UIBackgroundModes: [audio, fetch] UIBackgroundModes: [audio, fetch]