mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Grab account keychain entry identifier data from socket in FileProviderExt
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
0b3f06a73f
commit
9b54e6414f
2 changed files with 12 additions and 3 deletions
|
@ -19,6 +19,7 @@ import NCDesktopClientSocketKit
|
|||
class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension {
|
||||
let domain: NSFileProviderDomain
|
||||
var socketClient: LocalSocketClient = LocalSocketClient()
|
||||
var ncAccount: FileProviderDomainNextcloudAccountData = FileProviderDomainNextcloudAccountData()
|
||||
|
||||
required init(domain: NSFileProviderDomain) {
|
||||
self.domain = domain
|
||||
|
@ -93,10 +94,14 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension {
|
|||
self.socketClient.start();
|
||||
}
|
||||
|
||||
func sendDelegateFileProviderDomainIdentifier() {
|
||||
func sendFileProviderDomainIdentifier() {
|
||||
let command = "FILE_PROVIDER_DOMAIN_IDENTIFIER_REQUEST_REPLY"
|
||||
let argument = domain.identifier.rawValue
|
||||
let message = command + ":" + argument + "\n"
|
||||
socketClient.sendMessage(message)
|
||||
}
|
||||
|
||||
func setupDomainAccount(keychainAccount:String) {
|
||||
ncAccount = FileProviderDomainNextcloudAccountData(withKeychainAccount:keychainAccount)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class FileProviderSocketLineProcessor: NSObject, LineProcessor {
|
|||
func process(_ line: String) {
|
||||
NSLog("Processing file provider line: %@", line)
|
||||
|
||||
let splitLine = line.split(separator: ":")
|
||||
let splitLine = line.split(separator: ":", maxSplits: 1)
|
||||
guard let commandSubsequence = splitLine.first else {
|
||||
NSLog("Input line did not have a first element")
|
||||
return;
|
||||
|
@ -34,7 +34,11 @@ class FileProviderSocketLineProcessor: NSObject, LineProcessor {
|
|||
|
||||
NSLog("Received command: %@", command)
|
||||
if (command == "SEND_FILE_PROVIDER_DOMAIN_IDENTIFIER") {
|
||||
delegate.sendDelegateFileProviderDomainIdentifier()
|
||||
delegate.sendFileProviderDomainIdentifier()
|
||||
} else if (command == "ACCOUNT_KEYCHAIN_NAME") {
|
||||
guard let keychainAccountSubsequence = splitLine.last else { return }
|
||||
let keychainAccountString = String(keychainAccountSubsequence)
|
||||
delegate.setupDomainAccount(keychainAccount:keychainAccountString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue