Add "createMode" toggle to share options view, start building for use to create new shares

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-03-06 20:08:06 +08:00
Родитель 0ceb6a9481
Коммит e1997bd1fd
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -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() {