🩹 Fixes incorrect refresh control visibility
Makes `TimelineViewController` a `UISplitViewControllerDelegate`. When the display mode is such that the feeds, timeline and article are visible, the timeline refresh control is hidden. When the display mode is such that the timeline and article are visible, the timeline refresh control is visible.
This commit is contained in:
parent
9cc85c6193
commit
3d67dfa63e
@ -59,7 +59,10 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange), name: .DisplayNameDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
|
||||
|
||||
|
||||
// Split View Controller Delegate
|
||||
splitViewController?.delegate = self
|
||||
|
||||
// Initialize Programmatic Buttons
|
||||
filterButton = UIBarButtonItem(image: AppAssets.filterInactiveImage, style: .plain, target: self, action: #selector(toggleFilter(_:)))
|
||||
firstUnreadButton = UIBarButtonItem(image: AppAssets.nextUnreadArticleImage, style: .plain, target: self, action: #selector(firstUnread(_:)))
|
||||
@ -598,11 +601,44 @@ extension TimelineViewController: UISearchBarDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
extension TimelineViewController: UISplitViewControllerDelegate {
|
||||
|
||||
func splitViewController(_ svc: UISplitViewController, willChangeTo displayMode: UISplitViewController.DisplayMode) {
|
||||
switch displayMode {
|
||||
case .automatic:
|
||||
return
|
||||
case .secondaryOnly:
|
||||
return
|
||||
case .oneBesideSecondary:
|
||||
// Timeline + Article - show the refresh control on the timeline
|
||||
self.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
|
||||
self.toolbarItems?[2].customView?.alpha = 0.0
|
||||
case .primaryHidden:
|
||||
return
|
||||
case .allVisible:
|
||||
return
|
||||
case .primaryOverlay:
|
||||
return
|
||||
@unknown default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private extension TimelineViewController {
|
||||
|
||||
func configureToolbar() {
|
||||
func configureToolbar() {
|
||||
guard !(splitViewController?.isCollapsed ?? true) else {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user