Convert AccountDelegate.syncArticleStatus to async/await.

This commit is contained in:
Brent Simmons
2024-03-26 16:50:11 -07:00
parent b2da353e8a
commit f6719d8b4f
10 changed files with 93 additions and 96 deletions

View File

@@ -453,16 +453,15 @@ private extension AppDelegate {
self.prepareAccountsForBackground()
account.syncArticleStatus(completion: { _ in
if !self.accountManager.isSuspended {
try? WidgetDataEncoder.shared.encodeWidgetData()
self.prepareAccountsForBackground()
self.suspendApplication()
}
})
try? await account.syncArticleStatus
if !self.accountManager.isSuspended {
try? WidgetDataEncoder.shared.encodeWidgetData()
self.prepareAccountsForBackground()
self.suspendApplication()
}
}
}
@MainActor func handleMarkAsStarred(userInfo: [AnyHashable: Any]) {
guard let articlePathInfo = ArticlePathInfo(userInfo: userInfo) else {
@@ -489,13 +488,12 @@ private extension AppDelegate {
account.markArticles(articles, statusKey: .starred, flag: true) { _ in }
account.syncArticleStatus(completion: { _ in
if !self.accountManager.isSuspended {
try? WidgetDataEncoder.shared.encodeWidgetData()
self.prepareAccountsForBackground()
self.suspendApplication()
}
})
try? await account.syncArticleStatus()
if !self.accountManager.isSuspended {
try? WidgetDataEncoder.shared.encodeWidgetData()
self.prepareAccountsForBackground()
self.suspendApplication()
}
}
}
}