From 46ac0f94dad9a5b1d94cc3ae6955f0f187538446 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 15 Oct 2024 14:21:03 +0800 Subject: [PATCH] Run post-auth state check with main actor task Signed-off-by: Claudio Cambra --- ...ileProviderExtension+ClientInterface.swift | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift index 98a9cb250f2ef..2a7e5d8e51489 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension+ClientInterface.swift @@ -145,25 +145,27 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte ) } - let newNcAccount = - Account(user: user, id: userId, serverUrl: serverUrl, password: password) - guard newNcAccount != ncAccount else { return } - ncAccount = newNcAccount - ncKit.setup( - account: newNcAccount.ncKitAccount, - user: newNcAccount.username, - userId: newNcAccount.id, - password: newNcAccount.password, - urlBase: newNcAccount.serverUrl, - userAgent: "Nextcloud-macOS/FileProviderExt", - nextcloudVersion: 25, - delegate: nil) // TODO: add delegate methods for self - - changeObserver = RemoteChangeObserver( - remoteInterface: ncKit, changeNotificationInterface: self, domain: domain - ) - ncKit.setup(delegate: changeObserver) - signalEnumeratorAfterAccountSetup() + Task { @MainActor in + let newNcAccount = + Account(user: user, id: userId, serverUrl: serverUrl, password: password) + guard newNcAccount != ncAccount else { return } + ncAccount = newNcAccount + ncKit.setup( + account: newNcAccount.ncKitAccount, + user: newNcAccount.username, + userId: newNcAccount.id, + password: newNcAccount.password, + urlBase: newNcAccount.serverUrl, + userAgent: "Nextcloud-macOS/FileProviderExt", + nextcloudVersion: 25, + delegate: nil) // TODO: add delegate methods for self + + changeObserver = RemoteChangeObserver( + remoteInterface: ncKit, changeNotificationInterface: self, domain: domain + ) + ncKit.setup(delegate: changeObserver) + signalEnumeratorAfterAccountSetup() + } } }