|
@@ -24,6 +24,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
var notifyToken: String?
|
|
|
var applicationInForeground: Bool = false
|
|
|
private var launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
|
+ private var pendingAppInitialization = true;
|
|
|
|
|
|
// purpose of `bgIoTimestamp` is to block rapidly subsequent calls to remote- or local-wakeups:
|
|
|
//
|
|
@@ -50,6 +51,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
// when the app wakes up from "suspended" state
|
|
|
// (app is in memory in the background but no code is executed, IO stopped)
|
|
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
|
|
+ pendingAppInitialization = true;
|
|
|
logger.info("➡️ didFinishLaunchingWithOptions")
|
|
|
// explicitly ignore SIGPIPE to avoid crashes, see https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/CommonPitfalls/CommonPitfalls.html
|
|
|
// setupCrashReporting() may create an additional handler, but we do not want to rely on that
|
|
@@ -169,6 +171,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
}
|
|
|
|
|
|
launchOptions = nil
|
|
|
+ pendingAppInitialization = false
|
|
|
}
|
|
|
|
|
|
// `open` is called when an url should be opened by Delta Chat.
|
|
@@ -220,7 +223,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
|
|
|
func applicationProtectedDataDidBecomeAvailable(_ application: UIApplication) {
|
|
|
logger.info("➡️ applicationProtectedDataDidBecomeAvailable")
|
|
|
- if launchOptions != nil {
|
|
|
+ if pendingAppInitialization {
|
|
|
finishAppInitialization()
|
|
|
}
|
|
|
}
|