Reset focus when returning to the app from another app or the safari view controller. Issue #1963

This commit is contained in:
Maurice Parker 2020-04-28 17:16:34 -05:00
parent 6f29b21ddc
commit 31f3487d7a
3 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,10 @@ class RootSplitViewController: UISplitViewController {
return .slide
}
override func viewDidAppear(_ animated: Bool) {
coordinator.resetFocus()
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
self.coordinator.configurePanelMode(for: size)
super.viewWillTransition(to: size, with: coordinator)

View File

@ -405,6 +405,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
wasRootSplitViewControllerCollapsed = rootSplitViewController.isCollapsed
}
func resetFocus() {
if currentArticle != nil {
masterTimelineViewController?.focus()
} else {
masterFeedViewController?.focus()
}
}
func selectFirstUnreadInAllUnread() {
markExpanded(SmartFeedsController.shared)
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.unreadFeed) {

View File

@ -66,7 +66,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func sceneWillEnterForeground(_ scene: UIScene) {
appDelegate.resumeDatabaseProcessingIfNecessary()
appDelegate.prepareAccountsForForeground()
self.coordinator.configurePanelMode(for: window!.frame.size)
coordinator.configurePanelMode(for: window!.frame.size)
coordinator.resetFocus()
}
func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? {