Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions WooCommerce/Classes/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Setup Components
setupStartupWaitingTimeTracker()

let stores = ServiceLocator.stores
let analytics = ServiceLocator.analytics
let pushNotesManager = ServiceLocator.pushNotesManager
stores.initializeAfterDependenciesAreInitialized()
setupAnalytics(analytics)
ServiceLocator.authenticationManager.initialize()
ServiceLocator.stores.initializeAfterDependenciesAreInitialized()

setupCocoaLumberjack()
setupLibraryLogger()
setupLogLevel(.verbose)
setupPushNotificationsManagerIfPossible(pushNotesManager, stores: stores)
setupPushNotificationsManagerIfPossible(pushNotesManager)
setupAppRatingManager()
setupWormholy()
setupKeyboardStateProvider()
Expand Down Expand Up @@ -268,7 +268,7 @@ extension AppDelegate {
/// Push Notifications: Authorization + Registration!
///
// periphery: ignore - Fails when build on simulator
func setupPushNotificationsManagerIfPossible(_ pushNotesManager: PushNotesManager, stores: StoresManager) {
func setupPushNotificationsManagerIfPossible(_ pushNotesManager: PushNotesManager) {
#if targetEnvironment(simulator)
DDLogVerbose("👀 Push Notifications are not supported in the Simulator!")
#else
Expand Down Expand Up @@ -417,7 +417,7 @@ extension AppDelegate {
/// Runs whenever the Authentication Flow is completed successfully.
///
func authenticatorWasDismissed() {
setupPushNotificationsManagerIfPossible(ServiceLocator.pushNotesManager, stores: ServiceLocator.stores)
setupPushNotificationsManagerIfPossible(ServiceLocator.pushNotesManager)
requirementsChecker.checkEligibilityForDefaultStore()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class AuthenticationManager: Authentication {

private let userDefaults: UserDefaults

private var initialized: Bool = false

init(stores: StoresManager = ServiceLocator.stores,
storageManager: StorageManagerType = ServiceLocator.storageManager,
featureFlagService: FeatureFlagService = ServiceLocator.featureFlagService,
Expand All @@ -84,6 +86,8 @@ class AuthenticationManager: Authentication {
/// Initializes the WordPress Authenticator.
///
func initialize() {
guard !initialized else { return }
initialized = true
WordPressAuthenticator.initializeWithCustomConfigs()
WordPressAuthenticator.shared.delegate = self
}
Expand Down