Continue adopting MainActor.

This commit is contained in:
Brent Simmons
2023-07-09 11:41:42 -07:00
parent b49731cc34
commit 63cc39dc4f
15 changed files with 17 additions and 17 deletions

View File

@@ -28,7 +28,7 @@ final class ExtensionContainersFile: Logging {
}
@MainActor private let saveQueue = CoalescingQueue(name: "Save Queue", interval: 0.5)
init() {
@MainActor init() {
if !FileManager.default.fileExists(atPath: ExtensionContainersFile.filePath) {
save()
}
@@ -72,14 +72,14 @@ private extension ExtensionContainersFile {
saveQueue.add(self, #selector(saveToDiskIfNeeded))
}
@objc func saveToDiskIfNeeded() {
@MainActor @objc func saveToDiskIfNeeded() {
if isDirty {
isDirty = false
save()
}
}
func save() {
@MainActor func save() {
let encoder = PropertyListEncoder()
encoder.outputFormat = .binary

View File

@@ -9,7 +9,7 @@
import SwiftUI
import Account
struct CloudKitAddAccountView: View {
@MainActor struct CloudKitAddAccountView: View {
@Environment(\.dismiss) private var dismiss
@State private var accountError: (Error?, Bool) = (nil, false)

View File

@@ -14,7 +14,7 @@ import SafariServices
import RSCore
struct FeedbinAddAccountView: View {
@MainActor struct FeedbinAddAccountView: View {
@Environment(\.dismiss) private var dismiss
@State var account: Account? = nil

View File

@@ -9,7 +9,7 @@
import SwiftUI
import Account
struct LocalAddAccountView: View {
@MainActor struct LocalAddAccountView: View {
@Environment(\.dismiss) var dismiss
@State private var accountName: String = ""

View File

@@ -12,7 +12,7 @@ import Secrets
import RSWeb
import RSCore
struct NewsBlurAddAccountView: View, Logging {
@MainActor struct NewsBlurAddAccountView: View, Logging {
@Environment(\.dismiss) private var dismiss
@State var account: Account? = nil

View File

@@ -13,7 +13,7 @@ import RSWeb
import SafariServices
import RSCore
struct ReaderAPIAddAccountView: View {
@MainActor struct ReaderAPIAddAccountView: View {
@Environment(\.dismiss) var dismiss

View File

@@ -10,7 +10,7 @@ import SwiftUI
import SafariServices
import Account
struct AccountInspectorView: View {
@MainActor struct AccountInspectorView: View {
@Environment(\.dismiss) var dismiss
@State private var showRemoveAccountAlert: Bool = false

View File

@@ -126,7 +126,7 @@ public class AddFeedIntentHandler: NSObject, AddFeedIntentHandling {
}
public func handle(intent: AddFeedIntent, completion: @escaping (AddFeedIntentResponse) -> Void) {
@MainActor public func handle(intent: AddFeedIntent, completion: @escaping (AddFeedIntentResponse) -> Void) {
guard let url = intent.url, let extensionContainers = ExtensionContainersFile.read() else {
completion(AddFeedIntentResponse(code: .failure, userActivity: nil))
return

View File

@@ -189,7 +189,7 @@ private extension MasterFeedViewController {
private extension Container {
func hasChildFeed(withURL url: String) -> Bool {
@MainActor func hasChildFeed(withURL url: String) -> Bool {
return topLevelFeeds.contains(where: { $0.url == url })
}

View File

@@ -68,7 +68,7 @@ import Account
}
class RefreshProgressModel: ObservableObject {
@MainActor class RefreshProgressModel: ObservableObject {
@Published var isRefreshing = false
@Published var isIndeterminate = false

View File

@@ -53,7 +53,7 @@ struct FeedNode: Hashable {
}
}
final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
@MainActor final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
var undoableCommands = [UndoableCommand]()
var undoManager: UndoManager? {

View File

@@ -10,7 +10,7 @@ import SwiftUI
import Account
import Combine
public final class AccountManagementViewModel: ObservableObject {
@MainActor public final class AccountManagementViewModel: ObservableObject {
@Published var sortedActiveAccounts = [Account]()
@Published var sortedInactiveAccounts = [Account]()

View File

@@ -41,7 +41,7 @@ public final class AddAccountListViewModel: ObservableObject, OAuthAccountAuthor
return rootViewController
}
public func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didCreate account: Account) {
@MainActor public func oauthAccountAuthorizationOperation(_ operation: OAuthAccountAuthorizationOperation, didCreate account: Account) {
account.refreshAll { [weak self] result in
switch result {
case .success:

View File

@@ -13,7 +13,7 @@ import UniformTypeIdentifiers
// MARK: - Rows
struct SettingsRow {
@MainActor struct SettingsRow {
/// This row, when tapped, will open iOS System Settings.
static var openSystemSettings: some View {

View File

@@ -11,7 +11,7 @@ import Account
import RSCore
struct NewArticleNotificationsView: View, Logging {
@MainActor struct NewArticleNotificationsView: View, Logging {
@State private var activeAccounts = AccountManager.shared.sortedActiveAccounts