mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Continue adopting MainActor.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import SwiftUI
|
||||
import Account
|
||||
|
||||
struct LocalAddAccountView: View {
|
||||
@MainActor struct LocalAddAccountView: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
@State private var accountName: String = ""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,7 +13,7 @@ import RSWeb
|
||||
import SafariServices
|
||||
import RSCore
|
||||
|
||||
struct ReaderAPIAddAccountView: View {
|
||||
@MainActor struct ReaderAPIAddAccountView: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ import Account
|
||||
|
||||
}
|
||||
|
||||
class RefreshProgressModel: ObservableObject {
|
||||
@MainActor class RefreshProgressModel: ObservableObject {
|
||||
|
||||
@Published var isRefreshing = false
|
||||
@Published var isIndeterminate = false
|
||||
|
||||
@@ -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? {
|
||||
|
||||
@@ -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]()
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -11,7 +11,7 @@ import Account
|
||||
import RSCore
|
||||
|
||||
|
||||
struct NewArticleNotificationsView: View, Logging {
|
||||
@MainActor struct NewArticleNotificationsView: View, Logging {
|
||||
|
||||
@State private var activeAccounts = AccountManager.shared.sortedActiveAccounts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user