mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 12:19:03 +03:00
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:
commit
09e10b99d7
1 changed files with 40 additions and 39 deletions
|
@ -107,11 +107,10 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
|
||||||
@objc func setupDomainAccount(
|
@objc func setupDomainAccount(
|
||||||
user: String, userId: String, serverUrl: String, password: String
|
user: String, userId: String, serverUrl: String, password: String
|
||||||
) {
|
) {
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
|
||||||
var authAttemptState = AuthenticationAttemptResultState.connectionError // default
|
|
||||||
Task {
|
Task {
|
||||||
let authTestNcKit = NextcloudKit()
|
let authTestNcKit = NextcloudKit()
|
||||||
authTestNcKit.setup(user: user, userId: userId, password: password, urlBase: serverUrl)
|
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
|
// Retry a few times if we have a connection issue
|
||||||
for authTimeout in AuthenticationTimeouts {
|
for authTimeout in AuthenticationTimeouts {
|
||||||
|
@ -123,49 +122,51 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
|
||||||
)
|
)
|
||||||
try? await Task.sleep(nanoseconds: authTimeout)
|
try? await Task.sleep(nanoseconds: authTimeout)
|
||||||
}
|
}
|
||||||
semaphore.signal()
|
|
||||||
}
|
|
||||||
semaphore.wait()
|
|
||||||
|
|
||||||
switch (authAttemptState) {
|
switch (authAttemptState) {
|
||||||
case .authenticationError:
|
case .authenticationError:
|
||||||
Logger.fileProviderExtension.info(
|
Logger.fileProviderExtension.info(
|
||||||
"\(user, privacy: .public) authentication failed due to bad creds, stopping"
|
"\(user, privacy: .public) authentication failed due to bad creds, stopping"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
case .connectionError:
|
case .connectionError:
|
||||||
// Despite multiple connection attempts we are still getting connection issues, so quit.
|
// Despite multiple connection attempts we are still getting connection issues.
|
||||||
Logger.fileProviderExtension.info(
|
// Connection error should be provided
|
||||||
"\(user, privacy: .public) authentication try failed, no connection."
|
Logger.fileProviderExtension.info(
|
||||||
)
|
"\(user, privacy: .public) authentication try failed, no connection."
|
||||||
return
|
)
|
||||||
case .success:
|
return
|
||||||
Logger.fileProviderExtension.info(
|
case .success:
|
||||||
|
Logger.fileProviderExtension.info(
|
||||||
"""
|
"""
|
||||||
Authenticated! Nextcloud account set up in File Provider extension.
|
Authenticated! Nextcloud account set up in File Provider extension.
|
||||||
User: \(user, privacy: .public) at server: \(serverUrl, privacy: .public)
|
User: \(user, privacy: .public) at server: \(serverUrl, privacy: .public)
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func removeAccountConfig() {
|
@objc func removeAccountConfig() {
|
||||||
|
|
Loading…
Reference in a new issue