From e1997bd1fd2f56a038575ee60b9331e0ba9b2610 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 6 Mar 2024 20:08:06 +0800 Subject: [PATCH] Add "createMode" toggle to share options view, start building for use to create new shares Signed-off-by: Claudio Cambra --- .../FileProviderUIExt/ShareOptionsView.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift index a9fac05e6..9e74b22bc 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift @@ -25,12 +25,26 @@ class ShareOptionsView: NSView { var dataSource: ShareTableViewDataSource? var controller: ShareController? { didSet { + guard controller != nil else { return } cancellable?.cancel() createMode = false update() cancellable = controller.publisher.sink { _ in self.update() } } } + var createMode = false { + didSet { + Logger.shareOptionsView.info("Create mode set: \(self.createMode)") + shareTypePicker.isHidden = !createMode + labelTextField.isHidden = createMode // Cannot set label on create API call + guard createMode else { return } + cancellable?.cancel() + cancellable = nil + controller = nil + reset() + setAllFields(enabled: true) + } + } private var cancellable: AnyCancellable? private func update() {