Invalidate user activities when collapsed and returning to Feeds scene
This commit is contained in:
parent
1a9acdcc50
commit
189af8d816
@ -29,6 +29,13 @@ class ActivityManager {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil)
|
||||
}
|
||||
|
||||
func invalidateCurrentActivities() {
|
||||
readingActivity?.invalidate()
|
||||
readingActivity = nil
|
||||
selectingActivity?.invalidate()
|
||||
selectingActivity = nil
|
||||
}
|
||||
|
||||
func selectingToday() {
|
||||
let title = NSLocalizedString("See articles for Today", comment: "Today")
|
||||
selectingActivity = makeSelectingActivity(type: ActivityType.selectToday, title: title, identifier: "smartfeed.today")
|
||||
|
@ -253,6 +253,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
rootSplitViewController.delegate = self
|
||||
|
||||
masterNavigationController = (rootSplitViewController.viewControllers.first as! UINavigationController)
|
||||
masterNavigationController.delegate = self
|
||||
|
||||
masterFeedViewController = UIStoryboard.main.instantiateController(ofType: MasterFeedViewController.self)
|
||||
masterFeedViewController.coordinator = self
|
||||
@ -784,6 +785,16 @@ extension SceneCoordinator: UISplitViewControllerDelegate {
|
||||
|
||||
}
|
||||
|
||||
// MARK: UINavigationControllerDelegate
|
||||
|
||||
extension SceneCoordinator: UINavigationControllerDelegate {
|
||||
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
|
||||
if rootSplitViewController.isCollapsed && viewController === masterFeedViewController {
|
||||
activityManager.invalidateCurrentActivities()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private extension SceneCoordinator {
|
||||
|
Loading…
x
Reference in New Issue
Block a user