Run post-auth state check with main actor task

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-10-15 14:21:03 +08:00 committed by backportbot[bot]
parent f3dde1907a
commit 1b75056fb1

View file

@ -145,25 +145,27 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
) )
} }
let newNcAccount = Task { @MainActor in
Account(user: user, id: userId, serverUrl: serverUrl, password: password) let newNcAccount =
guard newNcAccount != ncAccount else { return } Account(user: user, id: userId, serverUrl: serverUrl, password: password)
ncAccount = newNcAccount guard newNcAccount != ncAccount else { return }
ncKit.setup( ncAccount = newNcAccount
account: newNcAccount.ncKitAccount, ncKit.setup(
user: newNcAccount.username, account: newNcAccount.ncKitAccount,
userId: newNcAccount.id, user: newNcAccount.username,
password: newNcAccount.password, userId: newNcAccount.id,
urlBase: newNcAccount.serverUrl, password: newNcAccount.password,
userAgent: "Nextcloud-macOS/FileProviderExt", urlBase: newNcAccount.serverUrl,
nextcloudVersion: 25, userAgent: "Nextcloud-macOS/FileProviderExt",
delegate: nil) // TODO: add delegate methods for self nextcloudVersion: 25,
delegate: nil) // TODO: add delegate methods for self
changeObserver = RemoteChangeObserver( changeObserver = RemoteChangeObserver(
remoteInterface: ncKit, changeNotificationInterface: self, domain: domain remoteInterface: ncKit, changeNotificationInterface: self, domain: domain
) )
ncKit.setup(delegate: changeObserver) ncKit.setup(delegate: changeObserver)
signalEnumeratorAfterAccountSetup() signalEnumeratorAfterAccountSetup()
}
} }
} }