@ -143,6 +143,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// I f w e ' v e a l r e a d y c o m p l e t e d m i g r a t i o n s a t l e a s t o n c e t h i s l a u n c h t h e n c h e c k
// t o s e e i f a n y " d e l a y e d " m i g r a t i o n s n o w n e e d t o r u n
if Storage . shared . hasCompletedMigrations {
SNLog ( " Checking for pending migrations " )
let initialLaunchFailed : Bool = self . initialLaunchFailed
AppReadiness . invalidate ( )
@ -154,30 +155,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
self . window ? . rootViewController ? . dismiss ( animated : false )
}
AppSetup . runPostSetupMigrations (
migrationProgressChanged : { [ weak self ] progress , minEstimatedTotalTime in
self ? . loadingViewController ? . updateProgress (
progress : progress ,
minEstimatedTotalTime : minEstimatedTotalTime
)
} ,
migrationsCompletion : { [ weak self ] result , needsConfigSync in
if case . failure ( let error ) = result {
DispatchQueue . main . async {
self ? . showFailedStartupAlert (
calledFrom : . enterForeground ( initialLaunchFailed : initialLaunchFailed ) ,
error : . databaseError ( error )
)
// D i s p a t c h a s y n c s o t h i n g s c a n c o n t i n u e t o b e p r o g r e s s e d i f a m i g r a t i o n d o e s n e e d t o r u n
DispatchQueue . global ( qos : . userInitiated ) . async { [ weak self ] in
AppSetup . runPostSetupMigrations (
migrationProgressChanged : { progress , minEstimatedTotalTime in
self ? . loadingViewController ? . updateProgress (
progress : progress ,
minEstimatedTotalTime : minEstimatedTotalTime
)
} ,
migrationsCompletion : { result , needsConfigSync in
if case . failure ( let error ) = result {
DispatchQueue . main . async {
self ? . showFailedStartupAlert (
calledFrom : . enterForeground ( initialLaunchFailed : initialLaunchFailed ) ,
error : . databaseError ( error )
)
}
return
}
return
self ? . completePostMigrationSetup (
calledFrom : . enterForeground ( initialLaunchFailed : initialLaunchFailed ) ,
needsConfigSync : needsConfigSync
)
}
self ? . completePostMigrationSetup (
calledFrom : . enterForeground ( initialLaunchFailed : initialLaunchFailed ) ,
needsConfigSync : needsConfigSync
)
}
)
)
}
}
}
@ -322,8 +326,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// t h e u s e r i s i n a n i n v a l i d s t a t e ( a n d s h o u l d h a v e a l r e a d y b e e n s h o w n a m o d a l )
guard success else { return }
SNLog ( " RootViewController ready, readying remaining processes " )
self ? . initialLaunchFailed = false
SNLog ( " Migrations completed, performing setup and ensuring rootViewController " )
// / T r i g g e r a n y l a u n c h - s p e c i f i c j o b s a n d s t a r t t h e J o b R u n n e r w i t h ` J o b R u n n e r . a p p D i d F i n i s h L a u n c h i n g ( ) ` s o m e
// / o f t h e s e j o b s ( e g . D i s a p p e a r i n g M e s s a g e s j o b ) c a n i m p a c t t h e i n t e r a c t i o n s w h i c h g e t f e t c h e d t o d i s p l a y o n t h e h o m e