Handle more cases in willChangeTo displayMode delegate method. Create and use setRefreshToolbarItemVisibility method on TimelineViewController.

This commit is contained in:
Brent Simmons
2025-01-18 21:45:32 -08:00
parent 46c5e75e6c
commit 608f0df4af
2 changed files with 15 additions and 24 deletions

View File

@@ -254,6 +254,10 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
becomeFirstResponder()
}
func setRefreshToolbarItemVisibility(visible: Bool) {
refreshProgressView?.alpha = visible ? 1.0 : 0
}
// MARK: - Table view
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

View File

@@ -1309,34 +1309,21 @@ extension SceneCoordinator: UISplitViewControllerDelegate {
}
func splitViewController(_ svc: UISplitViewController, willChangeTo displayMode: UISplitViewController.DisplayMode) {
var sidebarIsShowing = false
switch displayMode {
case .automatic:
return
case .secondaryOnly:
return
case .oneBesideSecondary:
// Timeline + Article - show the refresh control on the timeline
mainTimelineViewController?.toolbarItems?[2].customView?.alpha = 1.0
case .oneOverSecondary:
return
case .twoBesideSecondary:
return
case .twoOverSecondary:
return
case .twoDisplaceSecondary:
// Sidebar + Timeline + Article - hide the refresh control on the timeline
mainTimelineViewController?.toolbarItems?[2].customView?.alpha = 0.0
case .primaryHidden:
return
case .allVisible:
return
case .primaryOverlay:
return
case .automatic, .secondaryOnly, .oneBesideSecondary, .oneOverSecondary:
sidebarIsShowing = false
case .twoBesideSecondary, .twoOverSecondary, .twoDisplaceSecondary:
sidebarIsShowing = true
@unknown default:
return
break
}
let timelineShouldShowRefreshProgress = !sidebarIsShowing
mainTimelineViewController?.setRefreshToolbarItemVisibility(visible: timelineShouldShowRefreshProgress)
}
}
// MARK: UINavigationControllerDelegate