Add method to export NextcloudAccount details to dictionary
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 27 Feb 2024 14:43:46 +0000 (22:43 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 17 Apr 2024 08:38:48 +0000 (16:38 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudAccount.swift

index cb3b7ea628f9c940f8aad365193bbdc03fdd89f7..14c242b49332ed3fc034a5887a0ae8079803ec6c 100644 (file)
 import FileProvider
 import Foundation
 
+let ncAccountDictUsernameKey = "usernameKey"
+let ncAccountDictPasswordKey = "passwordKey"
+let ncAccountDictNcKitAccountKey = "ncKitAccountKey"
+let ncAccountDictServerUrlKey = "serverUrlKey"
+let ncAccountDictDavFilesUrlKey = "davFilesUrlKey"
+
 struct NextcloudAccount: Equatable {
     static let webDavFilesUrlSuffix: String = "/remote.php/dav/files/"
     let username, password, ncKitAccount, serverUrl, davFilesUrl: String
@@ -26,4 +32,14 @@ struct NextcloudAccount: Equatable {
         self.serverUrl = serverUrl
         davFilesUrl = serverUrl + NextcloudAccount.webDavFilesUrlSuffix + user
     }
+
+    func dictionary() -> Dictionary<String, String> {
+        return [
+            ncAccountDictUsernameKey: username,
+            ncAccountDictPasswordKey: password,
+            ncAccountDictNcKitAccountKey: ncKitAccount,
+            ncAccountDictServerUrlKey: serverUrl,
+            ncAccountDictDavFilesUrlKey: davFilesUrl
+        ]
+    }
 }