commit
19055afeb1
|
@ -210,6 +210,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
default:
|
||||
if let sceneDelegate = response.targetScene?.delegate as? SceneDelegate {
|
||||
sceneDelegate.handle(response)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
|
||||
sceneDelegate.coordinator.dismissIfLaunchingFromExternalAction()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -687,6 +687,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||
present(vc, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: UIContextMenuInteractionDelegate
|
||||
|
|
|
@ -1327,6 +1327,23 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
|||
|
||||
}
|
||||
|
||||
/// This will dismiss the foremost view controller if the user
|
||||
/// has launched from an external action (i.e., a widget tap, or
|
||||
/// selecting an artice via a notification).
|
||||
///
|
||||
/// The dismiss is only applicable if the view controller is a
|
||||
/// `SFSafariViewController` or `SettingsViewController`,
|
||||
/// otherwise, this function does nothing.
|
||||
func dismissIfLaunchingFromExternalAction() {
|
||||
guard let presentedController = masterFeedViewController.presentedViewController else { return }
|
||||
|
||||
if presentedController.isKind(of: SFSafariViewController.self) {
|
||||
presentedController.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
guard let settings = presentedController.children.first as? SettingsViewController else { return }
|
||||
settings.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: UISplitViewControllerDelegate
|
||||
|
|
|
@ -105,6 +105,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
guard let context = urlContexts.first else { return }
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
self.coordinator.dismissIfLaunchingFromExternalAction()
|
||||
}
|
||||
|
||||
let urlString = context.url.absoluteString
|
||||
|
||||
// Handle the feed: and feeds: schemes
|
||||
|
@ -202,6 +207,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue