fixes cold launch from widget

This commit is contained in:
Stuart Breckenridge 2020-11-19 17:29:03 +08:00
parent fa26fd565e
commit fd33dc9be1

View File

@ -28,6 +28,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
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 {
window!.makeKeyAndVisible()
handleShortcutItem(shortcutItem)
@ -42,10 +48,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
if let userActivity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {
coordinator.handle(userActivity)
}
if let _ = connectionOptions.urlContexts.first?.url {
self.scene(scene, openURLContexts: connectionOptions.urlContexts)
}
window!.makeKeyAndVisible()