mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Handles single and multiple sync failures
If a single sync failure is encountered a sheet is presented which allows the user to update their credentials. If multiple sync failures are encountered an alert is shown listing the accounts which encountered errors. On iOS, this alert can take the user into Settings, but there is no obvious way to programatically pesent macOS preferences.
This commit is contained in:
@@ -21,8 +21,8 @@ final class SceneModel: ObservableObject {
|
||||
@Published var extractorButtonState: ArticleExtractorButtonState?
|
||||
@Published var openInBrowserButtonState: Bool?
|
||||
@Published var shareButtonState: Bool?
|
||||
|
||||
@Published var accountErrorMessage = ""
|
||||
@Published var accountSyncErrors: [AccountSyncError] = []
|
||||
|
||||
var selectedArticles: [Article] {
|
||||
timelineModel.selectedArticles
|
||||
@@ -48,6 +48,7 @@ final class SceneModel: ObservableObject {
|
||||
self.articleIconSchemeHandler = ArticleIconSchemeHandler(sceneModel: self)
|
||||
self.webViewProvider = WebViewProvider(articleIconSchemeHandler: self.articleIconSchemeHandler!)
|
||||
|
||||
subscribeToAccountSyncErrors()
|
||||
subscribeToToolbarChangeEvents()
|
||||
}
|
||||
|
||||
@@ -146,6 +147,16 @@ private extension SceneModel {
|
||||
}.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func subscribeToAccountSyncErrors() {
|
||||
NotificationCenter.default.publisher(for: .AccountsDidFailToSyncWithErrors)
|
||||
.sink { [weak self] notification in
|
||||
guard let errors = notification.object as? [AccountSyncError] else {
|
||||
return
|
||||
}
|
||||
self?.accountSyncErrors = errors
|
||||
}.store(in: &cancellables)
|
||||
}
|
||||
|
||||
// MARK: Button State Updates
|
||||
|
||||
func updateNextUnreadButtonState(accountManager: AccountManager) {
|
||||
|
||||
Reference in New Issue
Block a user