mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fixes #3335
When the app is brought to the foreground from an external action (e.g., tapping on the widget, opening from a notification), a notification is posted (with a slight delay). `MasterFeedViewController` and `SettingsViewController` are observers. `MasterFeedViewController` will dismiss any `SFSafariViewController`s that are presented, while `SettingsViewController` will dismiss itself.
This commit is contained in:
@@ -11,6 +11,10 @@ import UserNotifications
|
||||
import Account
|
||||
import Zip
|
||||
|
||||
public extension Notification.Name {
|
||||
static let DidLaunchFromExternalAction = Notification.Name("DidLaunchFromExternalAction")
|
||||
}
|
||||
|
||||
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
@@ -105,6 +109,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
guard let context = urlContexts.first else { return }
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
NotificationCenter.default.post(name: .DidLaunchFromExternalAction, object: nil)
|
||||
}
|
||||
|
||||
let urlString = context.url.absoluteString
|
||||
|
||||
// Handle the feed: and feeds: schemes
|
||||
@@ -202,6 +211,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user