Add foregroundRegistrationMode enum to re-register all users on app foreground#4030
Open
sfdctaka wants to merge 3 commits intoforcedotcom:devfrom
Open
Add foregroundRegistrationMode enum to re-register all users on app foreground#4030sfdctaka wants to merge 3 commits intoforcedotcom:devfrom
sfdctaka wants to merge 3 commits intoforcedotcom:devfrom
Conversation
Contributor
sfdctaka
commented
May 6, 2026
- New enum PushNotificationForegroundRegistrationMode (before PushNotificationManagerError):
- .none — no re-registration on foreground
- .currentUser — re-register only the current user (preserves pre-14.0 behavior)
- .allUsers — re-register all logged-in users (new default)
- Doc comment calls out the Publisher/per-login billing concern explicitly
- New property foregroundRegistrationMode: .allUsers replaces the old Bool
- Deprecated shim for registerOnForeground: Bool — kept as a computed property that maps to the new enum, so existing apps don't break with a compiler error, just a deprecation warning
- onAppWillEnterForeground — now switches on the mode: iterates UserAccountManager.shared.userAccounts() for .allUsers, falls back to current-user-only for .currentUser
|
||||||||||||||||||
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #4030 +/- ##
==========================================
- Coverage 70.34% 68.26% -2.09%
==========================================
Files 245 245
Lines 21449 21457 +8
==========================================
- Hits 15089 14647 -442
- Misses 6360 6810 +450
🚀 New features to boost your workflow:
|
|
||||||||||||||||
|
||||||||||||||
bbirman
reviewed
May 8, 2026
| pushNotificationManager.foregroundRegistrationMode = .currentUser | ||
| mockRestClient.jsonResponse = """ | ||
| {"success": true, "id": "test-sf-id"} | ||
| """.data(using: .utf8)! |
Member
There was a problem hiding this comment.
nit: even though it's just test code, I'd like to avoid force unwraps (here and in test_givenModeAllUsers_whenAppEntersForeground_thenAllUsersAreRegistered)
|
|
||
| @available(*, deprecated, renamed: "foregroundRegistrationMode", | ||
| message: "Use foregroundRegistrationMode instead. Set .none for false, .allUsers for true.") | ||
| public var registerOnForeground: Bool { |
Member
There was a problem hiding this comment.
nice way to have a migration from the old to new property!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.