mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add completion callbacks so that we can ensure that unreads have been marked before determining the next unread. Fixes #2993
This commit is contained in:
@@ -428,7 +428,7 @@ private extension AppDelegate {
|
||||
os_log(.debug, "No article found from search using %@", articleID)
|
||||
return
|
||||
}
|
||||
account!.markArticles(article!, statusKey: .read, flag: true)
|
||||
account!.markArticles(article!, statusKey: .read, flag: true) { _ in }
|
||||
self.prepareAccountsForBackground()
|
||||
account!.syncArticleStatus(completion: { [weak self] _ in
|
||||
if !AccountManager.shared.isSuspended {
|
||||
@@ -458,7 +458,7 @@ private extension AppDelegate {
|
||||
os_log(.debug, "No article found from search using %@", articleID)
|
||||
return
|
||||
}
|
||||
account!.markArticles(article!, statusKey: .starred, flag: true)
|
||||
account!.markArticles(article!, statusKey: .starred, flag: true) { _ in }
|
||||
account!.syncArticleStatus(completion: { [weak self] _ in
|
||||
if !AccountManager.shared.isSuspended {
|
||||
if #available(iOS 14, *) {
|
||||
|
||||
@@ -58,8 +58,9 @@ class RootSplitViewController: UISplitViewController {
|
||||
}
|
||||
|
||||
@objc func markAllAsReadAndGoToNextUnread(_ sender: Any?) {
|
||||
coordinator.markAllAsReadInTimeline()
|
||||
coordinator.selectNextUnread()
|
||||
coordinator.markAllAsReadInTimeline() {
|
||||
self.coordinator.selectNextUnread()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func markAboveAsRead(_ sender: Any?) {
|
||||
|
||||
@@ -997,13 +997,15 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
}
|
||||
}
|
||||
|
||||
func markAllAsRead(_ articles: [Article]) {
|
||||
markArticlesWithUndo(articles, statusKey: .read, flag: true)
|
||||
func markAllAsRead(_ articles: [Article], completion: (() -> Void)? = nil) {
|
||||
markArticlesWithUndo(articles, statusKey: .read, flag: true, completion: completion)
|
||||
}
|
||||
|
||||
func markAllAsReadInTimeline() {
|
||||
markAllAsRead(articles)
|
||||
masterNavigationController.popViewController(animated: true)
|
||||
func markAllAsReadInTimeline(completion: (() -> Void)? = nil) {
|
||||
markAllAsRead(articles) {
|
||||
self.masterNavigationController.popViewController(animated: true)
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
|
||||
func canMarkAboveAsRead(for article: Article) -> Bool {
|
||||
@@ -1372,8 +1374,9 @@ extension SceneCoordinator: UINavigationControllerDelegate {
|
||||
|
||||
private extension SceneCoordinator {
|
||||
|
||||
func markArticlesWithUndo(_ articles: [Article], statusKey: ArticleStatus.Key, flag: Bool) {
|
||||
guard let undoManager = undoManager, let markReadCommand = MarkStatusCommand(initialArticles: articles, statusKey: statusKey, flag: flag, undoManager: undoManager) else {
|
||||
func markArticlesWithUndo(_ articles: [Article], statusKey: ArticleStatus.Key, flag: Bool, completion: (() -> Void)? = nil) {
|
||||
guard let undoManager = undoManager,
|
||||
let markReadCommand = MarkStatusCommand(initialArticles: articles, statusKey: statusKey, flag: flag, undoManager: undoManager, completion: completion) else {
|
||||
return
|
||||
}
|
||||
runCommand(markReadCommand)
|
||||
|
||||
Reference in New Issue
Block a user