From 833c336f2f854d3f831683d190d5c6446a9eff52 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 13 Mar 2020 16:03:42 -0500 Subject: [PATCH] Only show the timeline next read button when the root split view controller is collapsed. Issue #1822 --- .../MasterTimelineViewController.swift | 20 +++++++++++-------- iOS/SceneCoordinator.swift | 4 ++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 52ee82cee..0abe0d939 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -194,6 +194,12 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner updateUI() } + + func updateUI() { + refreshProgressView?.updateRefreshLabel() + updateTitleUnreadCount() + updateToolbar() + } func hideSearch() { navigationItem.searchController?.isActive = false @@ -541,8 +547,7 @@ private extension MasterTimelineViewController { func configureToolbar() { - if coordinator.isThreePanelMode { - firstUnreadButton.isHidden = true + guard !coordinator.isThreePanelMode else { return } @@ -598,12 +603,6 @@ private extension MasterTimelineViewController { } - func updateUI() { - refreshProgressView?.updateRefreshLabel() - updateTitleUnreadCount() - updateToolbar() - } - func setFilterButtonToActive() { filterButton?.image = AppAssets.filterActiveImage filterButton?.accLabelText = NSLocalizedString("Selected - Filter Read Articles", comment: "Selected - Filter Read Articles") @@ -617,6 +616,11 @@ private extension MasterTimelineViewController { func updateToolbar() { markAllAsReadButton.isEnabled = coordinator.isTimelineUnreadAvailable firstUnreadButton.isEnabled = coordinator.isTimelineUnreadAvailable + if coordinator.isRootSplitCollapsed { + firstUnreadButton.isHidden = false + } else { + firstUnreadButton.isHidden = true + } } func updateTitleUnreadCount() { diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 2579f0954..621d5de73 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1204,6 +1204,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { extension SceneCoordinator: UISplitViewControllerDelegate { func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController:UIViewController, onto primaryViewController:UIViewController) -> Bool { + masterTimelineViewController?.updateUI() + guard !isThreePanelMode else { return true } @@ -1218,6 +1220,8 @@ extension SceneCoordinator: UISplitViewControllerDelegate { } func splitViewController(_ splitViewController: UISplitViewController, separateSecondaryFrom primaryViewController: UIViewController) -> UIViewController? { + masterTimelineViewController?.updateUI() + guard !isThreePanelMode else { return subSplitViewController }