From b8e201e5d07849f82d9536b5389b0dbe5d1b7565 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sun, 26 Jul 2020 07:36:24 +0800 Subject: [PATCH] Fixes #2298 --- Frameworks/Account/Account.swift | 1 + Frameworks/Account/AccountManager.swift | 2 +- Multiplatform/Shared/SceneModel.swift | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index a6322b7ee..3157fb699 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -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 = { diff --git a/Frameworks/Account/AccountManager.swift b/Frameworks/Account/AccountManager.swift index e02434431..b71e981be 100644 --- a/Frameworks/Account/AccountManager.swift +++ b/Frameworks/Account/AccountManager.swift @@ -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?() } diff --git a/Multiplatform/Shared/SceneModel.swift b/Multiplatform/Shared/SceneModel.swift index 21dbce8e8..b9270eafd 100644 --- a/Multiplatform/Shared/SceneModel.swift +++ b/Multiplatform/Shared/SceneModel.swift @@ -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) }