ソースを参照

no merge: hack to delay ui creation

B. Petersen 3 年 前
コミット
f15923e907

+ 6 - 3
deltachat-ios/AppDelegate.swift

@@ -14,7 +14,9 @@ let logger = SwiftyBeaver.self
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
     private let dcAccounts = DcAccounts()
-    var appCoordinator: AppCoordinator!
+    lazy var appCoordinator: AppCoordinator = {
+        return AppCoordinator(window: window!, dcAccounts: dcAccounts)
+    }()
     var relayHelper: RelayHelper!
     var locationManager: LocationManager!
     var notificationManager: NotificationManager!
@@ -48,7 +50,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     // `didFinishLaunchingWithOptions` is _not_ called
     // 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 {
+    func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         // 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
         signal(SIGPIPE, SIG_IGN)
@@ -107,7 +109,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
         installEventHandler()
         relayHelper = RelayHelper.setup(dcAccounts.getSelected())
-        appCoordinator = AppCoordinator(window: window, dcAccounts: dcAccounts)
         locationManager = LocationManager(dcAccounts: dcAccounts)
         UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum)
         notificationManager = NotificationManager(dcAccounts: dcAccounts)
@@ -147,6 +148,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             increaseDebugCounter("notify-remote-launch")
             pushToDebugArray("📡'")
             performFetch(completionHandler: { (_) -> Void in })
+        } else {
+            appCoordinator.startUI()
         }
 
         if dcAccounts.getSelected().isConfigured() && !UserDefaults.standard.bool(forKey: "notifications_disabled") {

+ 4 - 0
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -79,6 +79,10 @@ class AppCoordinator {
         }
     }
 
+    func startUI() {
+        // HACK, just needed to construct the object
+    }
+
     func showTab(index: Int) {
         tabBarController.selectedIndex = index
     }