mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Convert AccountDelegate.syncArticleStatus to async/await.
This commit is contained in:
@@ -33,7 +33,7 @@ final class AppDefaults {
|
||||
static let shared = AppDefaults()
|
||||
private init() {}
|
||||
|
||||
static var store: UserDefaults = {
|
||||
static let store: UserDefaults = {
|
||||
let appIdentifierPrefix = Bundle.main.object(forInfoDictionaryKey: "AppIdentifierPrefix") as! String
|
||||
let suiteName = "\(appIdentifierPrefix)group.\(Bundle.main.bundleIdentifier!)"
|
||||
return UserDefaults.init(suiteName: suiteName)!
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user