Merge pull request #2299 from stuartbreckenridge/hotfix/2298

Fixes #2298
This commit is contained in:
Maurice Parker 2020-07-25 18:53:32 -05:00 committed by GitHub
commit 28e663bad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -66,6 +66,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
public static let articles = "articles" // StatusesDidChange
public static let articleIDs = "articleIDs" // StatusesDidChange
public static let webFeeds = "webFeeds" // AccountDidDownloadArticles, StatusesDidChange
public static let syncErrors = "syncErrors" // AccountsDidFailToSyncWithErrors
}
public static let defaultLocalAccountName: String = {

View File

@ -267,7 +267,7 @@ public final class AccountManager: UnreadCountProvider {
group.notify(queue: DispatchQueue.main) {
if syncErrors.count > 0 {
NotificationCenter.default.post(Notification(name: .AccountsDidFailToSyncWithErrors, object: syncErrors, userInfo: nil))
NotificationCenter.default.post(Notification(name: .AccountsDidFailToSyncWithErrors, object: self, userInfo: [Account.UserInfoKey.syncErrors: syncErrors]))
}
completion?()
}

View File

@ -150,10 +150,10 @@ private extension SceneModel {
func subscribeToAccountSyncErrors() {
NotificationCenter.default.publisher(for: .AccountsDidFailToSyncWithErrors)
.sink { [weak self] notification in
guard let errors = notification.object as? [AccountSyncError] else {
guard let syncErrors = notification.userInfo?[Account.UserInfoKey.syncErrors] as? [AccountSyncError] else {
return
}
self?.accountSyncErrors = errors
self?.accountSyncErrors = syncErrors
}.store(in: &cancellables)
}