mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Replace uses of forEach with for-in loops.
This commit is contained in:
@@ -218,23 +218,31 @@ import RSDatabase
|
||||
|
||||
public func suspendNetworkAll() {
|
||||
isSuspended = true
|
||||
accounts.forEach { $0.suspendNetwork() }
|
||||
for account in accounts {
|
||||
account.suspendNetwork()
|
||||
}
|
||||
}
|
||||
|
||||
public func suspendDatabaseAll() {
|
||||
accounts.forEach { $0.suspendDatabase() }
|
||||
for account in accounts {
|
||||
account.suspendDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
public func resumeAll() {
|
||||
isSuspended = false
|
||||
accounts.forEach { $0.resumeDatabaseAndDelegate() }
|
||||
accounts.forEach { $0.resume() }
|
||||
for account in accounts {
|
||||
account.resumeDatabaseAndDelegate()
|
||||
}
|
||||
for account in accounts {
|
||||
account.resume()
|
||||
}
|
||||
}
|
||||
|
||||
public func receiveRemoteNotification(userInfo: [AnyHashable : Any], completion: (() -> Void)? = nil) {
|
||||
let group = DispatchGroup()
|
||||
|
||||
activeAccounts.forEach { account in
|
||||
|
||||
for account in activeAccounts {
|
||||
group.enter()
|
||||
account.receiveRemoteNotification(userInfo: userInfo) {
|
||||
group.leave()
|
||||
@@ -251,7 +259,7 @@ import RSDatabase
|
||||
|
||||
let group = DispatchGroup()
|
||||
|
||||
activeAccounts.forEach { account in
|
||||
for account in activeAccounts {
|
||||
group.enter()
|
||||
account.refreshAll() { result in
|
||||
group.leave()
|
||||
@@ -274,9 +282,9 @@ import RSDatabase
|
||||
public func sendArticleStatusAll(completion: (() -> Void)? = nil) {
|
||||
let group = DispatchGroup()
|
||||
|
||||
activeAccounts.forEach {
|
||||
for account in activeAccounts {
|
||||
group.enter()
|
||||
$0.sendArticleStatus() { _ in
|
||||
account.sendArticleStatus() { _ in
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
@@ -289,9 +297,9 @@ import RSDatabase
|
||||
public func syncArticleStatusAll(completion: (() -> Void)? = nil) {
|
||||
let group = DispatchGroup()
|
||||
|
||||
activeAccounts.forEach {
|
||||
for account in activeAccounts {
|
||||
group.enter()
|
||||
$0.syncArticleStatus() { _ in
|
||||
account.syncArticleStatus() { _ in
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
@@ -302,7 +310,9 @@ import RSDatabase
|
||||
}
|
||||
|
||||
public func saveAll() {
|
||||
accounts.forEach { $0.save() }
|
||||
for account in accounts {
|
||||
account.save()
|
||||
}
|
||||
}
|
||||
|
||||
public func anyAccountHasAtLeastOneFeed() -> Bool {
|
||||
@@ -541,18 +551,18 @@ private extension AccountManager {
|
||||
return
|
||||
}
|
||||
|
||||
filenames = filenames?.sorted()
|
||||
|
||||
filenames?.forEach { (oneFilename) in
|
||||
guard oneFilename != defaultAccountFolderName else {
|
||||
return
|
||||
}
|
||||
if let oneAccount = loadAccount(oneFilename) {
|
||||
if !duplicateServiceAccount(oneAccount) {
|
||||
accountsDictionary[oneAccount.accountID] = oneAccount
|
||||
}
|
||||
}
|
||||
}
|
||||
if let sortedFilenames = filenames?.sorted() {
|
||||
for oneFilename in sortedFilenames {
|
||||
guard oneFilename != defaultAccountFolderName else {
|
||||
continue
|
||||
}
|
||||
if let oneAccount = loadAccount(oneFilename) {
|
||||
if !duplicateServiceAccount(oneAccount) {
|
||||
accountsDictionary[oneAccount.accountID] = oneAccount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func duplicateServiceAccount(_ account: Account) -> Bool {
|
||||
|
||||
Reference in New Issue
Block a user