mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-05-24 08:54:10 +08:00
Introduced FeedSelectionProviding to indicate when a selection has been made
Updated IssuesViewController and NotificationsViewController to conform to FeedSelectionProviding Updated NotificationsViewController to show the placeholder when toggling the filter Updated the SplitViewDelegate to depend on the current selection rather than a placeholder view
This commit is contained in:
@@ -9,18 +9,28 @@
|
||||
import UIKit
|
||||
|
||||
final class SplitViewControllerDelegate: UISplitViewControllerDelegate {
|
||||
|
||||
private func containsSelection(in primaryViewController: UIViewController) -> Bool {
|
||||
guard let nav = primaryViewController as? UINavigationController else { return false }
|
||||
|
||||
if let provider = nav.topViewController as? FeedSelectionProviding {
|
||||
return provider.feedContainsSelection
|
||||
}
|
||||
|
||||
if let nav = nav.topViewController as? UINavigationController,
|
||||
let provider = nav.topViewController as? FeedSelectionProviding {
|
||||
return provider.feedContainsSelection
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func splitViewController(
|
||||
_ splitViewController: UISplitViewController,
|
||||
collapseSecondary secondaryViewController: UIViewController,
|
||||
onto primaryViewController: UIViewController
|
||||
) -> Bool {
|
||||
// use an empty class to detect if displaying a placeholder VC as details
|
||||
if let nav = secondaryViewController as? UINavigationController,
|
||||
nav.viewControllers.first is SplitPlaceholderViewController {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return !containsSelection(in: primaryViewController)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user