mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix how we identify collapsed stack removal for the new 3 panel mode
This commit is contained in:
@@ -12,7 +12,7 @@ import Account
|
||||
import Articles
|
||||
import SafariServices
|
||||
|
||||
class ArticleViewController: UIViewController {
|
||||
class ArticleViewController: UIViewController, MainControllerIdentifiable {
|
||||
|
||||
typealias State = (extractedArticle: ExtractedArticle?,
|
||||
isShowingExtractedArticle: Bool,
|
||||
@@ -43,6 +43,8 @@ class ArticleViewController: UIViewController {
|
||||
return button
|
||||
}()
|
||||
|
||||
var mainControllerIdentifer = MainControllerIdentifier.article
|
||||
|
||||
weak var coordinator: SceneCoordinator!
|
||||
|
||||
private let poppableDelegate = PoppableGestureRecognizerDelegate()
|
||||
|
||||
@@ -13,7 +13,7 @@ import RSCore
|
||||
import RSTree
|
||||
import SafariServices
|
||||
|
||||
class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
class MasterFeedViewController: UITableViewController, UndoableCommandRunner, MainControllerIdentifiable {
|
||||
|
||||
@IBOutlet weak var filterButton: UIBarButtonItem!
|
||||
private var refreshProgressView: RefreshProgressView?
|
||||
@@ -23,9 +23,11 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
}
|
||||
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
weak var coordinator: SceneCoordinator!
|
||||
var mainControllerIdentifer = MainControllerIdentifier.masterFeed
|
||||
|
||||
weak var coordinator: SceneCoordinator!
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
|
||||
private let keyboardManager = KeyboardManager(type: .sidebar)
|
||||
override var keyCommands: [UIKeyCommand]? {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import RSCore
|
||||
import Account
|
||||
import Articles
|
||||
|
||||
class MasterTimelineViewController: UITableViewController, UndoableCommandRunner {
|
||||
class MasterTimelineViewController: UITableViewController, UndoableCommandRunner, MainControllerIdentifiable {
|
||||
|
||||
private var numberOfTextLines = 0
|
||||
private var iconSize = IconSize.medium
|
||||
@@ -27,6 +27,8 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
||||
private lazy var dataSource = makeDataSource()
|
||||
private let searchController = UISearchController(searchResultsController: nil)
|
||||
|
||||
var mainControllerIdentifer = MainControllerIdentifier.masterTimeline
|
||||
|
||||
weak var coordinator: SceneCoordinator!
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
let scrollPositionQueue = CoalescingQueue(name: "Timeline Scroll Position", interval: 0.3, maxInterval: 1.0)
|
||||
@@ -121,7 +123,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(true)
|
||||
coordinator.isTimelineViewControllerPending = false
|
||||
|
||||
if navigationController?.navigationBar.alpha == 0 {
|
||||
UIView.animate(withDuration: 0.5) {
|
||||
|
||||
@@ -14,6 +14,17 @@ import RSCore
|
||||
import RSTree
|
||||
import SafariServices
|
||||
|
||||
protocol MainControllerIdentifiable {
|
||||
var mainControllerIdentifer: MainControllerIdentifier { get }
|
||||
}
|
||||
|
||||
enum MainControllerIdentifier {
|
||||
case none
|
||||
case masterFeed
|
||||
case masterTimeline
|
||||
case article
|
||||
}
|
||||
|
||||
enum SearchScope: Int {
|
||||
case timeline = 0
|
||||
case global = 1
|
||||
@@ -51,11 +62,12 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
private var activityManager = ActivityManager()
|
||||
|
||||
private var rootSplitViewController: RootSplitViewController!
|
||||
|
||||
private var masterFeedViewController: MasterFeedViewController!
|
||||
private var masterTimelineViewController: MasterTimelineViewController?
|
||||
private var articleViewController: ArticleViewController?
|
||||
|
||||
|
||||
private var lastMainControllerToAppear = MainControllerIdentifier.none
|
||||
|
||||
private let fetchAndMergeArticlesQueue = CoalescingQueue(name: "Fetch and Merge Articles", interval: 0.5)
|
||||
private let rebuildBackingStoresQueue = CoalescingQueue(name: "Rebuild The Backing Stores", interval: 0.5)
|
||||
private var fetchSerialNumber = 0
|
||||
@@ -72,7 +84,6 @@ class SceneCoordinator: NSObject, UndoableCommandRunner {
|
||||
private var savedSearchArticles: ArticleArray? = nil
|
||||
private var savedSearchArticleIds: Set<String>? = nil
|
||||
|
||||
var isTimelineViewControllerPending = false
|
||||
var isArticleViewControllerPending = false
|
||||
|
||||
private(set) var sortDirection = AppDefaults.shared.timelineSortDirection {
|
||||
@@ -1309,8 +1320,16 @@ extension SceneCoordinator: UINavigationControllerDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
defer {
|
||||
if let mainController = viewController as? MainControllerIdentifiable {
|
||||
lastMainControllerToAppear = mainController.mainControllerIdentifer
|
||||
} else if let mainController = (viewController as? UINavigationController)?.topViewController as? MainControllerIdentifiable {
|
||||
lastMainControllerToAppear = mainController.mainControllerIdentifer
|
||||
}
|
||||
}
|
||||
|
||||
// If we are showing the Feeds and only the feeds start clearing stuff
|
||||
if viewController === masterFeedViewController && !isTimelineViewControllerPending {
|
||||
if viewController === masterFeedViewController && lastMainControllerToAppear == .masterTimeline {
|
||||
activityManager.invalidateCurrentActivities()
|
||||
selectFeed(nil, animations: [.scroll, .select, .navigation])
|
||||
return
|
||||
@@ -1320,7 +1339,7 @@ extension SceneCoordinator: UINavigationControllerDelegate {
|
||||
// Don't clear it if we have pushed an ArticleViewController, but don't yet see it on the navigation stack.
|
||||
// This happens when we are going to the next unread and we need to grab another timeline to continue. The
|
||||
// ArticleViewController will be pushed, but we will briefly show the Timeline. Don't clear things out when that happens.
|
||||
if viewController === masterTimelineViewController && !isArticleViewControllerPending {
|
||||
if viewController === masterTimelineViewController && lastMainControllerToAppear == .article && !isArticleViewControllerPending {
|
||||
currentArticle = nil
|
||||
masterTimelineViewController?.updateArticleSelection(animations: [.scroll, .select, .navigation])
|
||||
activityManager.invalidateReading()
|
||||
|
||||
Reference in New Issue
Block a user