fixes cold launch from widget

This commit is contained in:
Stuart Breckenridge 2020-11-19 17:29:03 +08:00
parent fa26fd565e
commit fd33dc9be1
1 changed files with 6 additions and 4 deletions

View File

@ -28,6 +28,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange), name: UserDefaults.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange), name: UserDefaults.didChangeNotification, object: nil)
if let _ = connectionOptions.urlContexts.first?.url {
window?.makeKeyAndVisible()
self.scene(scene, openURLContexts: connectionOptions.urlContexts)
return
}
if let shortcutItem = connectionOptions.shortcutItem { if let shortcutItem = connectionOptions.shortcutItem {
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
handleShortcutItem(shortcutItem) handleShortcutItem(shortcutItem)
@ -44,10 +50,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
coordinator.handle(userActivity) coordinator.handle(userActivity)
} }
if let _ = connectionOptions.urlContexts.first?.url {
self.scene(scene, openURLContexts: connectionOptions.urlContexts)
}
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
} }