Skip to content

Commit af2abb8

Browse files
committed
Move the authentication check to inside the setup method
1 parent b0146d9 commit af2abb8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

WooCommerce/Classes/AppDelegate.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6363
setupCocoaLumberjack()
6464
setupLibraryLogger()
6565
setupLogLevel(.verbose)
66-
/// We're sending notifications for logged in state only.
67-
/// Revisit this check if a local notification in unauthenticated state is needed.
68-
if stores.isAuthenticated {
69-
setupPushNotificationsManagerIfPossible(pushNotesManager, stores: stores)
70-
}
66+
setupPushNotificationsManagerIfPossible(pushNotesManager, stores: stores)
7167
setupAppRatingManager()
7268
setupWormholy()
7369
setupKeyboardStateProvider()
@@ -276,6 +272,9 @@ extension AppDelegate {
276272
#if targetEnvironment(simulator)
277273
DDLogVerbose("👀 Push Notifications are not supported in the Simulator!")
278274
#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 }
279278
let pushNotesManager = ServiceLocator.pushNotesManager
280279
pushNotesManager.registerForRemoteNotifications()
281280
pushNotesManager.ensureAuthorizationIsRequested(includesProvisionalAuth: false, onCompletion: nil)

0 commit comments

Comments
 (0)