Skip to content

Commit 58fa0f8

Browse files
committed
Call initializeAfterDependenciesAreInitialized in SceneDelegaet
1 parent 2cb584a commit 58fa0f8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

WooCommerce/Classes/AppDelegate.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5454
// Setup Components
5555
setupStartupWaitingTimeTracker()
5656

57-
let stores = ServiceLocator.stores
5857
let analytics = ServiceLocator.analytics
5958
let pushNotesManager = ServiceLocator.pushNotesManager
60-
stores.initializeAfterDependenciesAreInitialized()
6159
setupAnalytics(analytics)
6260

6361
setupCocoaLumberjack()
6462
setupLibraryLogger()
6563
setupLogLevel(.verbose)
66-
setupPushNotificationsManagerIfPossible(pushNotesManager, stores: stores)
64+
setupPushNotificationsManagerIfPossible(pushNotesManager)
6765
setupAppRatingManager()
6866
setupWormholy()
6967
setupKeyboardStateProvider()
@@ -268,7 +266,7 @@ extension AppDelegate {
268266
/// Push Notifications: Authorization + Registration!
269267
///
270268
// periphery: ignore - Fails when build on simulator
271-
func setupPushNotificationsManagerIfPossible(_ pushNotesManager: PushNotesManager, stores: StoresManager) {
269+
func setupPushNotificationsManagerIfPossible(_ pushNotesManager: PushNotesManager) {
272270
#if targetEnvironment(simulator)
273271
DDLogVerbose("👀 Push Notifications are not supported in the Simulator!")
274272
#else
@@ -417,7 +415,7 @@ extension AppDelegate {
417415
/// Runs whenever the Authentication Flow is completed successfully.
418416
///
419417
func authenticatorWasDismissed() {
420-
setupPushNotificationsManagerIfPossible(ServiceLocator.pushNotesManager, stores: ServiceLocator.stores)
418+
setupPushNotificationsManagerIfPossible(ServiceLocator.pushNotesManager)
421419
requirementsChecker.checkEligibilityForDefaultStore()
422420
}
423421
}

WooCommerce/Classes/SceneDelegate.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
2121
self.appCoordinator = coordinator
2222
coordinator.start()
2323

24+
/// IMPORTANT:
25+
/// `AppCoordinator.start()` must be called before this, so that
26+
/// AuthenticationManager.initialize() has already initialized WordPressAuthenticator.
27+
/// See AuthenticationManager.hasInitializedAuthenticator and restoreWordPressSite().
28+
ServiceLocator.stores.initializeAfterDependenciesAreInitialized()
29+
2430
// Scene-scoped initializations that need UI
2531
setupNoticePresenter()
2632
setupUniversalLinkRouter()

0 commit comments

Comments
 (0)