Change so that we don't try to sync if the network is unavailable. Issue #2262

This commit is contained in:
Maurice Parker 2020-10-06 19:42:34 -05:00
parent 8b3bd2f388
commit e4b27a27c5
1 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@
import Foundation
import RSCore
import RSWeb
import Articles
import ArticlesDatabase
@ -228,6 +229,8 @@ public final class AccountManager: UnreadCountProvider {
}
public func refreshAll(errorHandler: @escaping (Error) -> Void, completion: (() -> Void)? = nil) {
guard let reachability = try? Reachability(hostname: "apple.com"), reachability.connection != .unavailable else { return }
let group = DispatchGroup()
activeAccounts.forEach { account in
@ -249,6 +252,8 @@ public final class AccountManager: UnreadCountProvider {
}
public func refreshAll(completion: (() -> Void)? = nil) {
guard let reachability = try? Reachability(hostname: "apple.com"), reachability.connection != .unavailable else { return }
var syncErrors = [AccountSyncError]()
let group = DispatchGroup()