From 746faec2f4b7bf22d9da71a354f1e3e9df300bfc Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 12 Sep 2021 17:57:10 -0700 Subject: [PATCH 1/2] Bump version to 6.0.2 build 609. --- xcconfig/common/NetNewsWire_ios_target_common.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xcconfig/common/NetNewsWire_ios_target_common.xcconfig b/xcconfig/common/NetNewsWire_ios_target_common.xcconfig index af737cd42..3d6d7a3de 100644 --- a/xcconfig/common/NetNewsWire_ios_target_common.xcconfig +++ b/xcconfig/common/NetNewsWire_ios_target_common.xcconfig @@ -1,7 +1,7 @@ // High Level Settings common to both the iOS application and any extensions we bundle with it -MARKETING_VERSION = 6.0.1 -CURRENT_PROJECT_VERSION = 608 +MARKETING_VERSION = 6.0.2 +CURRENT_PROJECT_VERSION = 609 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon From 5299134e0120c6239969ef276a8f16f6c2b4ccfc Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 15 Sep 2021 05:05:58 -0500 Subject: [PATCH 2/2] Fix regression that broke state restoration on the iPhone --- iOS/SceneCoordinator.swift | 45 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 9f2f4e8c3..780d6a449 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -170,7 +170,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { // * Once the article has loaded, navigate to the iPad home screen // * While in landscape, select a feed and then select an article // * Install a fresh build of NNW to an iPad simulator (11 or 12.9' will do) running iPadOS 15 - private var deferredFeedAndArticleSelect: (feedIndexPath: IndexPath, articleID: String)? + private var deferredFeedAndArticleSelect: (feedIdentifier: FeedIdentifier, articleID: String)? var timelineMiddleIndexPath: IndexPath? @@ -451,14 +451,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { guard notification.object is AccountManager else { return } - rebuildBackingStores(initialLoad: true) - treeControllerDelegate.resetFilterExceptions() - if let (feedIndexPath, articleID) = deferredFeedAndArticleSelect { - selectFeed(indexPath: feedIndexPath) { - self.selectArticleInCurrentFeed(articleID) + rebuildBackingStores(initialLoad: true, completion: { + if let (feedIdentifier, articleID) = self.deferredFeedAndArticleSelect, let feedNode = self.nodeFor(feedID: feedIdentifier), let feedIndexPath = self.indexPathFor(feedNode) { + self.selectFeed(indexPath: feedIndexPath) { + self.selectArticleInCurrentFeed(articleID) + } } - } + }) } @objc func unreadCountDidChange(_ note: Notification) { @@ -2243,25 +2243,18 @@ private extension SceneCoordinator { case .script: return false - case .folder(let accountID, let folderName): - guard let accountNode = findAccountNode(accountID: accountID), - let folderNode = findFolderNode(folderName: folderName, beginningAt: accountNode) else { - return false - } - let found = selectFeedAndArticle(feedNode: folderNode, articleID: articleID) + case .folder: + let found = selectFeedAndArticle(feedIdentifier: feedIdentifier, articleID: articleID) if found { treeControllerDelegate.addFilterException(feedIdentifier) } return found case .webFeed: - guard let accountNode = findAccountNode(accountID: accountID), let webFeedNode = findWebFeedNode(webFeedID: webFeedID, beginningAt: accountNode) else { - return false - } - let found = selectFeedAndArticle(feedNode: webFeedNode, articleID: articleID) + let found = selectFeedAndArticle(feedIdentifier: feedIdentifier, articleID: articleID) if found { treeControllerDelegate.addFilterException(feedIdentifier) - if let folder = webFeedNode.parent?.representedObject as? Folder, let folderFeedID = folder.feedID { + if let webFeedNode = nodeFor(feedID: feedIdentifier), let folder = webFeedNode.parent?.representedObject as? Folder, let folderFeedID = folder.feedID { treeControllerDelegate.addFilterException(folderFeedID) } } @@ -2298,12 +2291,18 @@ private extension SceneCoordinator { return nil } - func selectFeedAndArticle(feedNode: Node, articleID: String) -> Bool { - if let feedIndexPath = indexPathFor(feedNode) { - deferredFeedAndArticleSelect = (feedIndexPath, articleID) - return true + func selectFeedAndArticle(feedIdentifier: FeedIdentifier, articleID: String) -> Bool { + guard let feedNode = nodeFor(feedID: feedIdentifier), let feedIndexPath = indexPathFor(feedNode) else { return false } + + if AccountManager.shared.isUnreadCountsInitialized { + selectFeed(indexPath: feedIndexPath) { + self.selectArticleInCurrentFeed(articleID) + } + } else { + deferredFeedAndArticleSelect = (feedIdentifier, articleID) } - return false + + return true } }