Skip to content

Commit

Permalink
Do not reconfigure file provider extension account if we are receivin…
Browse files Browse the repository at this point in the history
…g the same details again

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra committed Feb 19, 2024
1 parent 8010ceb commit fd20058
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ extension FileProviderExtension: NSFileProviderServicing {
}

@objc func setupDomainAccount(user: String, serverUrl: String, password: String) {
ncAccount = NextcloudAccount(user: user, serverUrl: serverUrl, password: password)
let newNcAccount = NextcloudAccount(user: user, serverUrl: serverUrl, password: password)
guard newNcAccount != ncAccount else { return }
ncAccount = newNcAccount
ncKit.setup(
user: ncAccount!.username,
userId: ncAccount!.username,
password: ncAccount!.password,
urlBase: ncAccount!.serverUrl,
userAgent: "Nextcloud-macOS/FileProviderExt",
nextcloudVersion: 25,
delegate: nil) // TODO: add delegate methods for self
delegate: nil) // TODO: add delegate methods for self

Logger.fileProviderExtension.info(
"Nextcloud account set up in File Provider extension for user: \(user, privacy: .public) at server: \(serverUrl, privacy: .public)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import FileProvider
import Foundation

class NextcloudAccount: NSObject {
struct NextcloudAccount: Equatable {
static let webDavFilesUrlSuffix: String = "/remote.php/dav/files/"
let username, password, ncKitAccount, serverUrl, davFilesUrl: String

Expand All @@ -25,7 +25,5 @@ class NextcloudAccount: NSObject {
ncKitAccount = user + " " + serverUrl
self.serverUrl = serverUrl
davFilesUrl = serverUrl + NextcloudAccount.webDavFilesUrlSuffix + user

super.init()
}
}

0 comments on commit fd20058

Please sign in to comment.