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:
Stuart Breckenridge
2021-11-06 22:43:50 +08:00
parent 50a61d6a67
commit 0db88c5f92
4 changed files with 27 additions and 0 deletions

View File

@@ -75,6 +75,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(configureContextMenu(_:)), name: .ActiveExtensionPointsDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didLaunchFromURLContext), name: .DidLaunchFromExternalAction, object: nil)
refreshControl = UIRefreshControl()
refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged)
@@ -687,6 +688,13 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
present(vc, animated: true)
}
}
@objc func didLaunchFromURLContext() {
guard let presentedController = presentedViewController as? SFSafariViewController else {
return
}
presentedController.dismiss(animated: true, completion: nil)
}
}
// MARK: UIContextMenuInteractionDelegate