Skip to content

Commit c34ec08

Browse files
committed
AppDelegate: Synchronization Entities during launch sequence
1 parent 2f83390 commit c34ec08

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

WooCommerce/Classes/AppDelegate.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3131

3232

3333

34+
// MARK: - AppDelegate Methods
35+
3436
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
3537

3638
// Setup the Interface!
@@ -44,6 +46,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4446
// Display the Authentication UI
4547
displayAuthenticatorIfNeeded()
4648

49+
// Yosemite Initialization
50+
synchronizeEntitiesIfPossible()
51+
4752
return true
4853
}
4954

@@ -181,4 +186,14 @@ extension AppDelegate {
181186

182187
authenticationManager.displayAuthentication(from: rootViewController)
183188
}
189+
190+
/// Whenever we're in an Authenticated state, let's Sync all of the WC-Y entities.
191+
///
192+
func synchronizeEntitiesIfPossible() {
193+
guard StoresManager.shared.isAuthenticated == false else {
194+
return
195+
}
196+
197+
StoresManager.shared.synchronizeEntities()
198+
}
184199
}

0 commit comments

Comments
 (0)