diff --git a/Frameworks/Articles/Article.swift b/Frameworks/Articles/Article.swift index 6e13633cc..855df90bd 100644 --- a/Frameworks/Articles/Article.swift +++ b/Frameworks/Articles/Article.swift @@ -61,6 +61,12 @@ public struct Article: Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(articleID) } + + // MARK: - Equatable + + static public func ==(lhs: Article, rhs: Article) -> Bool { + return lhs.articleID == rhs.articleID && lhs.accountID == rhs.accountID && lhs.webFeedID == rhs.webFeedID && lhs.uniqueID == rhs.uniqueID && lhs.title == rhs.title && lhs.contentHTML == rhs.contentHTML && lhs.contentText == rhs.contentText && lhs.url == rhs.url && lhs.externalURL == rhs.externalURL && lhs.summary == rhs.summary && lhs.imageURL == rhs.imageURL && lhs.datePublished == rhs.datePublished && lhs.dateModified == rhs.dateModified && lhs.authors == rhs.authors + } } public extension Set where Element == Article { diff --git a/Frameworks/ArticlesDatabase/ArticlesTable.swift b/Frameworks/ArticlesDatabase/ArticlesTable.swift index a49031210..b82117381 100644 --- a/Frameworks/ArticlesDatabase/ArticlesTable.swift +++ b/Frameworks/ArticlesDatabase/ArticlesTable.swift @@ -209,10 +209,10 @@ final class ArticlesTable: DatabaseTable { let newArticles = self.findAndSaveNewArticles(incomingArticles, fetchedArticlesDictionary, database) //5 let updatedArticles = self.findAndSaveUpdatedArticles(incomingArticles, fetchedArticlesDictionary, database) //6 - // Articles to delete are 1) no longer in feed and 2) older than 30 days. + // Articles to delete are 1) not starred and 2) older than 30 days and 3) no longer in feed. let cutoffDate = Date().bySubtracting(days: 30) let articlesToDelete = fetchedArticles.filter { (article) -> Bool in - return article.status.dateArrived < cutoffDate && !articleIDs.contains(article.articleID) + return !article.status.starred && article.status.dateArrived < cutoffDate && !articleIDs.contains(article.articleID) } self.callUpdateArticlesCompletionBlock(newArticles, updatedArticles, articlesToDelete, completion) //7 diff --git a/iOS/Account/FeedWranglerAccountViewController.swift b/iOS/Account/FeedWranglerAccountViewController.swift index 90990343b..a716a5d36 100644 --- a/iOS/Account/FeedWranglerAccountViewController.swift +++ b/iOS/Account/FeedWranglerAccountViewController.swift @@ -60,7 +60,6 @@ class FeedWranglerAccountViewController: UITableViewController { @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) - delegate?.dismiss() } @IBAction func showHidePassword(_ sender: Any) { diff --git a/iOS/Account/FeedbinAccountViewController.swift b/iOS/Account/FeedbinAccountViewController.swift index eb271b0ed..f2a6c89e6 100644 --- a/iOS/Account/FeedbinAccountViewController.swift +++ b/iOS/Account/FeedbinAccountViewController.swift @@ -61,7 +61,6 @@ class FeedbinAccountViewController: UITableViewController { @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) - delegate?.dismiss() } @IBAction func showHidePassword(_ sender: Any) { diff --git a/iOS/Account/LocalAccountViewController.swift b/iOS/Account/LocalAccountViewController.swift index be0c1596d..0bcbe8fa2 100644 --- a/iOS/Account/LocalAccountViewController.swift +++ b/iOS/Account/LocalAccountViewController.swift @@ -25,7 +25,6 @@ class LocalAccountViewController: UITableViewController { @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) - delegate?.dismiss() } @IBAction func add(_ sender: Any) { diff --git a/iOS/Account/NewsBlurAccountViewController.swift b/iOS/Account/NewsBlurAccountViewController.swift index 0babecde3..c1bed5e2d 100644 --- a/iOS/Account/NewsBlurAccountViewController.swift +++ b/iOS/Account/NewsBlurAccountViewController.swift @@ -61,7 +61,6 @@ class NewsBlurAccountViewController: UITableViewController { @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) - delegate?.dismiss() } @IBAction func showHidePassword(_ sender: Any) { diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 4a95fee0e..852c863d1 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -21,6 +21,10 @@ class RootSplitViewController: UISplitViewController { return .slide } + override func viewDidAppear(_ animated: Bool) { + coordinator.resetFocus() + } + override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { self.coordinator.configurePanelMode(for: size) super.viewWillTransition(to: size, with: coordinator) diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 509a42425..54cb6b390 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -410,6 +410,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { wasRootSplitViewControllerCollapsed = rootSplitViewController.isCollapsed } + func resetFocus() { + if currentArticle != nil { + masterTimelineViewController?.focus() + } else { + masterFeedViewController?.focus() + } + } + func selectFirstUnreadInAllUnread() { markExpanded(SmartFeedsController.shared) self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.unreadFeed) { diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index f95678c83..0a4ffdf80 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -66,7 +66,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func sceneWillEnterForeground(_ scene: UIScene) { appDelegate.resumeDatabaseProcessingIfNecessary() appDelegate.prepareAccountsForForeground() - self.coordinator.configurePanelMode(for: window!.frame.size) + coordinator.configurePanelMode(for: window!.frame.size) + coordinator.resetFocus() } func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? { diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index a1c197918..78e2a1dfb 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -540,10 +540,10 @@ - + - + diff --git a/xcconfig/common/NetNewsWire_ios_target_common.xcconfig b/xcconfig/common/NetNewsWire_ios_target_common.xcconfig index b76a85b25..2b155ae2f 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 = 5.0.1 -CURRENT_PROJECT_VERSION = 41 +CURRENT_PROJECT_VERSION = 43 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon