diff --git a/Shared/Activity/ActivityManager.swift b/Shared/Activity/ActivityManager.swift index f62b57f31..bf5bd9983 100644 --- a/Shared/Activity/ActivityManager.swift +++ b/Shared/Activity/ActivityManager.swift @@ -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") diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index df33b27a5..4aa16a5a9 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -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 {