Add fields as parameters to save in sharecontroller
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 4 Mar 2024 13:37:04 +0000 (21:37 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 17 Apr 2024 08:38:55 +0000 (16:38 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareController.swift

index 4a51d609a7447d11a3f385edcb077056fe5e5765..0831d7eb41b7ba876e6e28f72440e966a354e957 100644 (file)
@@ -19,17 +19,29 @@ class ShareController: ObservableObject {
         self.kit = kit
     }
 
-    func save() async -> NKError? {
+    func save(
+        password: String? = nil,
+        expireDate: String? = nil,
+        permissions: Int = 1,
+        publicUpload: Bool = false,
+        note: String? = nil,
+        label: String? = nil,
+        hideDownload: Bool,
+        attributes: String? = nil,
+        options: NKRequestOptions = NKRequestOptions()
+    ) async -> NKError? {
         return await withCheckedContinuation { continuation in
             kit.updateShare(
                 idShare: share.idShare,
-                password: share.password,
-                expireDate: share.expirationDateString ?? "",
-                permissions: share.permissions,
-                note: share.note,
-                label: share.label,
-                hideDownload: share.hideDownload,
-                attributes: share.attributes
+                password: password,
+                expireDate: expireDate,
+                permissions: permissions,
+                publicUpload: publicUpload,
+                note: note,
+                label: label,
+                hideDownload: hideDownload,
+                attributes: attributes,
+                options: options
             ) { account, share, data, error in
                 Logger.shareController.info("Received update response: \(share?.url ?? "")")
                 defer { continuation.resume(returning: error) }