From 192279158096b773d1565dfac8d2010c62cc4239 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 18 Sep 2024 12:22:35 +0530 Subject: [PATCH] Digital ACT-191 ONEAPP-10586 story: addressing feedback - Added textfield for footnote text, tooltip title and content. Removed 'hideSymbol'. Added 'none' to set empty text to symbolType. --- .../FootnoteViewController.swift | 46 ++++++++++++++++--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteViewController.swift index 5c4afd0..e175c59 100644 --- a/VDSSample/ViewControllers/FootnoteViewController.swift +++ b/VDSSample/ViewControllers/FootnoteViewController.swift @@ -15,6 +15,7 @@ class FootnoteViewController: BaseViewController { case asterisk case doubleAsterisk case character + case none public static var defaultValue: Self { .asterisk } @@ -27,6 +28,8 @@ class FootnoteViewController: BaseViewController { return "**" case .character: return "1." + case .none: + return "" } } } @@ -49,9 +52,11 @@ class FootnoteViewController: BaseViewController { items: Footnote.Size.allCases) }() - var hideSymbolSwitch = Toggle() + var footnoteTextField = TextField() var widthTextField = NumericField() var percentageTextField = NumericField() + var tooltipTitleTextField = TextField() + var tooltipContentTextField = TextField() override func viewDidLoad() { super.viewDidLoad() @@ -66,13 +71,17 @@ class FootnoteViewController: BaseViewController { addFormRow(label: "Kind", view: kindPickerSelectorView) addFormRow(label: "Size", view: sizePickerSelectorView) addFormRow(label: "Symbol Type", view: symbolTypePickerSelectorView) - addFormRow(label: "Hide Symbol", view: hideSymbolSwitch) + addFormRow(label: "Text", view: footnoteTextField) addFormRow(label: "Width", view: widthTextField) addFormRow(label: "Percentage (1-100)", view: percentageTextField) - - hideSymbolSwitch.publisher(for: .valueChanged).sink { [weak self] control in - self?.component.hideSymbol = control.isOn - }.store(in: &subscribers) + addFormRow(label: "ToolTip Title", view: tooltipTitleTextField) + addFormRow(label: "ToolTip Content", view: tooltipContentTextField) + + footnoteTextField + .textPublisher + .sink { [weak self] text in + self?.component.text = text + }.store(in: &subscribers) widthTextField .numberPublisher @@ -96,15 +105,29 @@ class FootnoteViewController: BaseViewController { } }.store(in: &subscribers) + tooltipTitleTextField + .textPublisher + .sink { [weak self] text in + self?.updateTooltip() + }.store(in: &subscribers) + + tooltipContentTextField + .textPublisher + .sink { [weak self] text in + self?.updateTooltip() + }.store(in: &subscribers) } func setupModel() { component.text = "Service is included for free for two years with activation of any iPhone15 model. Connection and response times vary based on location, site conditions, and other factors. See support.apple.com/en-us/HT213885 for more information." - component.tooltipModel = .init(title: "Check your item.", content:"Here is the content for your item.") + component.tooltipModel = nil + footnoteTextField.text = component.text sizePickerSelectorView.text = component.size.rawValue kindPickerSelectorView.text = component.kind.rawValue symbolTypePickerSelectorView.text = SymbolType.defaultValue.text + tooltipTitleTextField.text = component.tooltipModel?.title + tooltipContentTextField.text = component.tooltipModel?.content } func setupPicker() { @@ -125,4 +148,13 @@ class FootnoteViewController: BaseViewController { self?.component.symbolType = item.text } } + + func updateTooltip() { + let title = tooltipTitleTextField.text ?? "" + let content = tooltipContentTextField.text ?? "" + + component.tooltipModel = !title.isEmpty || !content.isEmpty ? .init(title: title, + content: content) : nil + } + }