Skip to content

feat(push): add foregroundRegistrationMode to re-register all users on foreground (W-20800537)#2935

Open
wmathurin wants to merge 3 commits into
forcedotcom:devfrom
wmathurin:push-notifications-foreground-mode
Open

feat(push): add foregroundRegistrationMode to re-register all users on foreground (W-20800537)#2935
wmathurin wants to merge 3 commits into
forcedotcom:devfrom
wmathurin:push-notifications-foreground-mode

Conversation

@wmathurin

Copy link
Copy Markdown
Contributor

Summary

  • Adds PushNotificationForegroundRegistrationMode enum (ALL_USERS / CURRENT_USER) to PushService
  • Adds PushService.foregroundRegistrationMode companion property (default ALL_USERS)
  • Changes SalesforceSDKManager.onResume to branch on foregroundRegistrationMode: passes account = null for ALL_USERS (worker iterates all authenticated users) or the current user for CURRENT_USER
  • Updates docs/push/README.md with a new "Foreground Registration Mode" section
  • Adds 6 new tests in PushServiceTest covering default value, setter, and all foreground re-registration scenarios

Behaviour change

Pre-14.0: foreground re-registration re-registers the current user only.
14.0+: foreground re-registration re-registers all authenticated users by default.
Apps that need the old behaviour (e.g. Publisher customers billed per login) set PushService.foregroundRegistrationMode = CURRENT_USER.

iOS counterpart

forcedotcom/SalesforceMobileSDK-iOS#4030

GUS

W-20800537

Test plan

  • ./gradlew :libs:SalesforceSDK:build — passes
  • ./gradlew :libs:SalesforceSDK:assembleAndroidTest — passes
  • Run PushServiceTest on device / Firebase Test Lab and confirm all 6 new foreground mode tests pass
  • Confirm existing PushServiceTest and PushMessagingTest tests are unaffected

Documents the push package in libs/SalesforceSDK: all key classes,
registration lifecycle, re-registration modes, encryption, and testing.
…n foreground (W-20800537)

Adds PushNotificationForegroundRegistrationMode enum (ALL_USERS / CURRENT_USER)
and foregroundRegistrationMode property to PushService. Changes the default
foreground re-registration behaviour to re-register all authenticated users
rather than only the current user, matching the existing periodic mode.

CURRENT_USER preserves pre-14.0 behaviour for Publisher customers billed per login.

Android counterpart to iOS PR forcedotcom/SalesforceMobileSDK-iOS#4030.
…ssaging

Extract foregroundPushRegistrationTarget() from onResume so tests can assert
on the account-selection logic directly, avoiding MockK object mocking of
PushMessaging which fails with 'Failed matching mocking signature' on CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant