Skip to content

Commit d846bd2

Browse files
authored
Push notification: Request permission only when authenticated (#16428)
2 parents 9eb56f4 + 47d2f60 commit d846bd2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
23.9
55
-----
6+
- [Internal] Moved the request for push notification authorization after login [https://github.com/woocommerce/woocommerce-ios/pull/16428]
67
- [*] Fixed possible sync issue in POS (https://github.com/woocommerce/woocommerce-ios/pull/16423)
78

89
23.8

WooCommerce/Classes/AppDelegate.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ extension AppDelegate {
272272
#if targetEnvironment(simulator)
273273
DDLogVerbose("👀 Push Notifications are not supported in the Simulator!")
274274
#else
275+
/// We're sending notifications for logged in state only.
276+
/// Revisit this check if a local notification in unauthenticated state is needed.
277+
guard stores.isAuthenticated else { return }
275278
let pushNotesManager = ServiceLocator.pushNotesManager
276279
pushNotesManager.registerForRemoteNotifications()
277280
pushNotesManager.ensureAuthorizationIsRequested(includesProvisionalAuth: false, onCompletion: nil)

0 commit comments

Comments
 (0)