Merge pull request #7323 from nextcloud/bugfix/mac-vfs-ci-swift6

Fix Swift 6-related CI errors with macOS VFS module
This commit is contained in:
Claudio Cambra 2024-10-18 14:20:42 +08:00 committed by GitHub
commit 09e10b99d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -107,11 +107,10 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
@objc func setupDomainAccount(
user: String, userId: String, serverUrl: String, password: String
) {
let semaphore = DispatchSemaphore(value: 0)
var authAttemptState = AuthenticationAttemptResultState.connectionError // default
Task {
let authTestNcKit = NextcloudKit()
authTestNcKit.setup(user: user, userId: userId, password: password, urlBase: serverUrl)
var authAttemptState = AuthenticationAttemptResultState.connectionError // default
// Retry a few times if we have a connection issue
for authTimeout in AuthenticationTimeouts {
@ -123,9 +122,6 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
)
try? await Task.sleep(nanoseconds: authTimeout)
}
semaphore.signal()
}
semaphore.wait()
switch (authAttemptState) {
case .authenticationError:
@ -134,7 +130,8 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
)
return
case .connectionError:
// Despite multiple connection attempts we are still getting connection issues, so quit.
// Despite multiple connection attempts we are still getting connection issues.
// Connection error should be provided
Logger.fileProviderExtension.info(
"\(user, privacy: .public) authentication try failed, no connection."
)
@ -148,7 +145,9 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
)
}
let newNcAccount = Account(user: user, id: userId, serverUrl: serverUrl, password: password)
Task { @MainActor in
let newNcAccount =
Account(user: user, id: userId, serverUrl: serverUrl, password: password)
guard newNcAccount != ncAccount else { return }
ncAccount = newNcAccount
ncKit.setup(
@ -167,6 +166,8 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
ncKit.setup(delegate: changeObserver)
signalEnumeratorAfterAccountSetup()
}
}
}
@objc func removeAccountConfig() {
Logger.fileProviderExtension.info(