From 3713d200c9cad0bfc34378fdd9d87ca8f9403614 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 21 Aug 2024 18:34:57 +0530 Subject: [PATCH 1/8] Digital ACT-191 ONEAPP-10586 story: added new page for footnote --- VDSSample.xcodeproj/project.pbxproj | 4 +++ .../FootnoteViewController.swift | 36 +++++++++++++++++++ .../ViewControllers/MenuViewController.swift | 1 + 3 files changed, 41 insertions(+) create mode 100644 VDSSample/ViewControllers/FootnoteViewController.swift diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 9ad4b88..8f12f19 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ 1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; }; 184023492C61E9E700A412C8 /* PriceLockupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */; }; 186D13CD2BBA990800986B53 /* DropdownSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */; }; + 18926F5F2C76185A00C55BF6 /* FootnoteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */; }; 18A3F1302BD9332500498E4A /* CalendarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A3F12F2BD9332500498E4A /* CalendarViewController.swift */; }; 18AE87522C06FDD60075F181 /* CarouselViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18AE87512C06FDD60075F181 /* CarouselViewController.swift */; }; 440B84CC2BD8E98B004A732A /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440B84CB2BD8E98B004A732A /* TableViewController.swift */; }; @@ -137,6 +138,7 @@ 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = ""; }; 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriceLockupViewController.swift; sourceTree = ""; }; 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelectViewController.swift; sourceTree = ""; }; + 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteViewController.swift; sourceTree = ""; }; 18A3F12F2BD9332500498E4A /* CalendarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarViewController.swift; sourceTree = ""; }; 18AE87512C06FDD60075F181 /* CarouselViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselViewController.swift; sourceTree = ""; }; 440B84CB2BD8E98B004A732A /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; @@ -341,6 +343,7 @@ EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */, EA1758452BC8893700A5C0D9 /* DatePickerViewController.swift */, 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */, + 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */, EA985C00296CC21C00F2FF2E /* IconViewController.swift */, 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */, EAA5EEAC28EB6924003B3210 /* InputFieldViewController.swift */, @@ -567,6 +570,7 @@ EA985C20296DECF600F2FF2E /* IconName.swift in Sources */, EA89204928B66CE2006B9984 /* KeyboardFrameChangeListening.swift in Sources */, EA5F86CE2A1E863F00BC83E4 /* TabsContainerViewController.swift in Sources */, + 18926F5F2C76185A00C55BF6 /* FootnoteViewController.swift in Sources */, EA985C01296CC21C00F2FF2E /* IconViewController.swift in Sources */, 184023492C61E9E700A412C8 /* PriceLockupViewController.swift in Sources */, EAC9258029119FC400091998 /* TextLinkViewController.swift in Sources */, diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteViewController.swift new file mode 100644 index 0000000..edbd25f --- /dev/null +++ b/VDSSample/ViewControllers/FootnoteViewController.swift @@ -0,0 +1,36 @@ +// +// FootnoteViewController.swift +// VDSSample +// +// Created by Kanamarlapudi, Vasavi on 21/08/24. +// + +import Foundation +import UIKit +import VDS + +class FootnoteViewController: BaseViewController { + + override func viewDidLoad() { + super.viewDidLoad() + addContentTopView(view: component) + setupPicker() + setupModel() + } + + override func setupForm() { + super.setupForm() + addFormRow(label: "Surface", view: surfacePickerSelectorView) + + } + + func setupModel() { + } + + func setupPicker() { + surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.surface = item + self?.contentTopView.backgroundColor = item.color + } + } +} diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 00bf63c..26ca468 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -82,6 +82,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable { MenuComponent(title: "CheckboxGroup", completed: true, viewController: CheckboxGroupViewController.self), MenuComponent(title: "DatePicker", completed: true, viewController: DatePickerViewController.self), MenuComponent(title: "DropdownSelect", completed: true, viewController: DropdownSelectViewController.self), + MenuComponent(title: "Footnote", completed: false, viewController: FootnoteViewController.self), MenuComponent(title: "Icon", completed: true, viewController: IconViewController.self), MenuComponent(title: "InputField", completed: true, viewController: InputFieldViewController.self), MenuComponent(title: "InputStepper", completed: true, viewController: InputStepperViewController.self), From 0f5bef548aa4f9f4c5cebd786b591ab52a70b194 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Thu, 22 Aug 2024 17:10:21 +0530 Subject: [PATCH 2/8] Digital ACT-191 ONEAPP-10586 story: did setup form and model to pass values to the properties --- .../FootnoteViewController.swift | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteViewController.swift index edbd25f..155136a 100644 --- a/VDSSample/ViewControllers/FootnoteViewController.swift +++ b/VDSSample/ViewControllers/FootnoteViewController.swift @@ -11,6 +11,28 @@ import VDS class FootnoteViewController: BaseViewController { + lazy var kindPickerSelectorView = { + PickerSelectorView(title: "secondary", + picker: self.picker, + items: Footnote.Kind.allCases) + }() + + lazy var symbolTypePickerSelectorView = { + PickerSelectorView(title: "asterisk", + picker: self.picker, + items: Footnote.SymbolType.allCases) + }() + + lazy var sizePickerSelectorView = { + PickerSelectorView(title: "micro", + picker: self.picker, + items: Footnote.Size.allCases) + }() + + var hideSymbolSwitch = Toggle() + var widthTextField = NumericField() + var percentageTextField = NumericField() + override func viewDidLoad() { super.viewDidLoad() addContentTopView(view: component) @@ -21,10 +43,47 @@ class FootnoteViewController: BaseViewController { override func setupForm() { super.setupForm() addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Kind", view: kindPickerSelectorView) + addFormRow(label: "Size", view: sizePickerSelectorView) + addFormRow(label: "Symbol Type", view: symbolTypePickerSelectorView) + addFormRow(label: "Hide Symbol", view: hideSymbolSwitch) + 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) + + widthTextField + .numberPublisher + .sink { [weak self] number in + if let number { + self?.component.width = .value(number.cgFloatValue) + self?.percentageTextField.text = "" + } else { + self?.component.width = nil + } + }.store(in: &subscribers) + + percentageTextField + .numberPublisher + .sink { [weak self] number in + if let number { + self?.component.width = .percentage(number.cgFloatValue) + self?.widthTextField.text = "" + } else { + self?.component.width = nil + } + }.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." + + sizePickerSelectorView.text = component.size.rawValue + kindPickerSelectorView.text = component.kind.rawValue + symbolTypePickerSelectorView.text = component.symbolType.rawValue } func setupPicker() { @@ -32,5 +91,17 @@ class FootnoteViewController: BaseViewController { self?.component.surface = item self?.contentTopView.backgroundColor = item.color } + + kindPickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.kind = item + } + + sizePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.size = item + } + + symbolTypePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.symbolType = item + } } } From fe4df9d1a09124333cf8eb23b13511e54e68f291 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Thu, 29 Aug 2024 19:10:28 +0530 Subject: [PATCH 3/8] Digital ACT-191 ONEAPP-10586 story: updating component with tooltipmodel --- VDSSample/ViewControllers/FootnoteViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteViewController.swift index 155136a..ab74405 100644 --- a/VDSSample/ViewControllers/FootnoteViewController.swift +++ b/VDSSample/ViewControllers/FootnoteViewController.swift @@ -80,7 +80,8 @@ class FootnoteViewController: BaseViewController { 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.") + sizePickerSelectorView.text = component.size.rawValue kindPickerSelectorView.text = component.kind.rawValue symbolTypePickerSelectorView.text = component.symbolType.rawValue From 062212e6478104a12a47960e1fa13587044841f1 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Mon, 2 Sep 2024 11:34:54 +0530 Subject: [PATCH 4/8] Digital ACT-191 ONEAPP-10586 story: added new page for footnote group --- VDSSample.xcodeproj/project.pbxproj | 4 ++ .../FootnoteGroupViewController.swift | 69 +++++++++++++++++++ .../FootnoteViewController.swift | 2 +- .../ViewControllers/MenuViewController.swift | 1 + 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 VDSSample/ViewControllers/FootnoteGroupViewController.swift diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 8f12f19..280135f 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -35,6 +35,7 @@ 180636CB2C29B12B00C92D86 /* InputStepperViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */; }; 1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */; }; 1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; }; + 183B16F52C80B27C00BA6A10 /* FootnoteGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */; }; 184023492C61E9E700A412C8 /* PriceLockupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */; }; 186D13CD2BBA990800986B53 /* DropdownSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */; }; 18926F5F2C76185A00C55BF6 /* FootnoteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */; }; @@ -136,6 +137,7 @@ 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputStepperViewController.swift; sourceTree = ""; }; 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselScrollbarViewConttroller.swift; sourceTree = ""; }; 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = ""; }; + 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteGroupViewController.swift; sourceTree = ""; }; 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriceLockupViewController.swift; sourceTree = ""; }; 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelectViewController.swift; sourceTree = ""; }; 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteViewController.swift; sourceTree = ""; }; @@ -344,6 +346,7 @@ EA1758452BC8893700A5C0D9 /* DatePickerViewController.swift */, 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */, 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */, + 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */, EA985C00296CC21C00F2FF2E /* IconViewController.swift */, 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */, EAA5EEAC28EB6924003B3210 /* InputFieldViewController.swift */, @@ -562,6 +565,7 @@ 18AE87522C06FDD60075F181 /* CarouselViewController.swift in Sources */, EA596ABA2A16B2ED00300C4B /* TabsViewController.swift in Sources */, EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */, + 183B16F52C80B27C00BA6A10 /* FootnoteGroupViewController.swift in Sources */, EAA5EEAD28EB6924003B3210 /* InputFieldViewController.swift in Sources */, 440B84CC2BD8E98B004A732A /* TableViewController.swift in Sources */, EA985C25296E06EA00F2FF2E /* TextAreaViewController.swift in Sources */, diff --git a/VDSSample/ViewControllers/FootnoteGroupViewController.swift b/VDSSample/ViewControllers/FootnoteGroupViewController.swift new file mode 100644 index 0000000..ec083f3 --- /dev/null +++ b/VDSSample/ViewControllers/FootnoteGroupViewController.swift @@ -0,0 +1,69 @@ +// +// FootnoteGroupViewController.swift +// VDSSample +// +// Created by Kanamarlapudi, Vasavi on 29/08/24. +// + +import Foundation +import UIKit +import VDS + +class FootnoteGroupViewController: BaseViewController { + + var widthTextField = NumericField() + var percentageTextField = NumericField() + var footnotes: [Footnote] = [] + + override func viewDidLoad() { + super.viewDidLoad() + addContentTopView(view: component) + setupPicker() + setupModel() + } + + override func setupForm() { + super.setupForm() + addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Width", view: widthTextField) + addFormRow(label: "Percentage (1-100)", view: percentageTextField) + + widthTextField + .numberPublisher + .sink { [weak self] number in + if let number { + self?.component.width = .value(number.cgFloatValue) + self?.percentageTextField.text = "" + } else { + self?.component.width = nil + } + }.store(in: &subscribers) + + percentageTextField + .numberPublisher + .sink { [weak self] number in + if let number, number.intValue > 9 { + self?.component.width = .percentage(number.cgFloatValue) + self?.widthTextField.text = "" + } else { + self?.component.width = nil + } + }.store(in: &subscribers) + + } + + func setupModel() { + let toolTipModel = Tooltip.TooltipModel.init(title: "Check your item.", content:"Here is the content for your item.") + footnotes.append(Footnote().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get off *T&C apply."; $0.symbolType = .asterisk; $0.kind = .primary; $0.tooltipModel = toolTipModel}) + footnotes.append(Footnote().with { $0.text = "The display has rounded corners. When measured as a standard rectangular shape, the screen is 6.68 inches diagonally. Actual viewable area is less."; $0.symbolType = .doubleAsterisk; $0.kind = .primary}) + footnotes.append(Footnote().with { $0.text = " Some features may not be available for all countries or all areas."; $0.symbolType = .character; $0.kind = .primary}) + component.footnoteitems = footnotes + } + + func setupPicker() { + surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.surface = item + self?.contentTopView.backgroundColor = item.color + } + } +} diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteViewController.swift index ab74405..4da0da6 100644 --- a/VDSSample/ViewControllers/FootnoteViewController.swift +++ b/VDSSample/ViewControllers/FootnoteViewController.swift @@ -68,7 +68,7 @@ class FootnoteViewController: BaseViewController { percentageTextField .numberPublisher .sink { [weak self] number in - if let number { + if let number, number.intValue > 9 { self?.component.width = .percentage(number.cgFloatValue) self?.widthTextField.text = "" } else { diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 26ca468..1475bed 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -83,6 +83,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable { MenuComponent(title: "DatePicker", completed: true, viewController: DatePickerViewController.self), MenuComponent(title: "DropdownSelect", completed: true, viewController: DropdownSelectViewController.self), MenuComponent(title: "Footnote", completed: false, viewController: FootnoteViewController.self), + MenuComponent(title: "FootnoteGroup", completed: false, viewController: FootnoteGroupViewController.self), MenuComponent(title: "Icon", completed: true, viewController: IconViewController.self), MenuComponent(title: "InputField", completed: true, viewController: InputFieldViewController.self), MenuComponent(title: "InputStepper", completed: true, viewController: InputStepperViewController.self), From 7343b670e9a631609b7f7277674bc833fcd17ed5 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Thu, 12 Sep 2024 13:24:19 +0530 Subject: [PATCH 5/8] Digital ACT-191 ONEAPP-10586 story: updated symbolType to use as String, and camelCase applied to footnoteItems --- .../FootnoteGroupViewController.swift | 8 +++--- .../FootnoteViewController.swift | 26 ++++++++++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/VDSSample/ViewControllers/FootnoteGroupViewController.swift b/VDSSample/ViewControllers/FootnoteGroupViewController.swift index ec083f3..c88a70c 100644 --- a/VDSSample/ViewControllers/FootnoteGroupViewController.swift +++ b/VDSSample/ViewControllers/FootnoteGroupViewController.swift @@ -54,10 +54,10 @@ class FootnoteGroupViewController: BaseViewController { func setupModel() { let toolTipModel = Tooltip.TooltipModel.init(title: "Check your item.", content:"Here is the content for your item.") - footnotes.append(Footnote().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get off *T&C apply."; $0.symbolType = .asterisk; $0.kind = .primary; $0.tooltipModel = toolTipModel}) - footnotes.append(Footnote().with { $0.text = "The display has rounded corners. When measured as a standard rectangular shape, the screen is 6.68 inches diagonally. Actual viewable area is less."; $0.symbolType = .doubleAsterisk; $0.kind = .primary}) - footnotes.append(Footnote().with { $0.text = " Some features may not be available for all countries or all areas."; $0.symbolType = .character; $0.kind = .primary}) - component.footnoteitems = footnotes + footnotes.append(Footnote().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get off *T&C apply."; $0.symbolType = "*"; $0.kind = .primary; $0.tooltipModel = toolTipModel}) + footnotes.append(Footnote().with { $0.text = "The display has rounded corners. When measured as a standard rectangular shape, the screen is 6.68 inches diagonally. Actual viewable area is less."; $0.symbolType = "**"; $0.kind = .primary}) + footnotes.append(Footnote().with { $0.text = " Some features may not be available for all countries or all areas."; $0.symbolType = "1."; $0.kind = .primary}) + component.footnoteItems = footnotes } func setupPicker() { diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteViewController.swift index 4da0da6..5c4afd0 100644 --- a/VDSSample/ViewControllers/FootnoteViewController.swift +++ b/VDSSample/ViewControllers/FootnoteViewController.swift @@ -11,6 +11,26 @@ import VDS class FootnoteViewController: BaseViewController { + internal enum SymbolType: String, DefaultValuing, CaseIterable { + case asterisk + case doubleAsterisk + case character + + public static var defaultValue: Self { .asterisk } + + /// TextStyle relative to Size. + public var text: String { + switch self { + case .asterisk: + return "*" + case .doubleAsterisk: + return "**" + case .character: + return "1." + } + } + } + lazy var kindPickerSelectorView = { PickerSelectorView(title: "secondary", picker: self.picker, @@ -20,7 +40,7 @@ class FootnoteViewController: BaseViewController { lazy var symbolTypePickerSelectorView = { PickerSelectorView(title: "asterisk", picker: self.picker, - items: Footnote.SymbolType.allCases) + items: SymbolType.allCases) }() lazy var sizePickerSelectorView = { @@ -84,7 +104,7 @@ class FootnoteViewController: BaseViewController { sizePickerSelectorView.text = component.size.rawValue kindPickerSelectorView.text = component.kind.rawValue - symbolTypePickerSelectorView.text = component.symbolType.rawValue + symbolTypePickerSelectorView.text = SymbolType.defaultValue.text } func setupPicker() { @@ -102,7 +122,7 @@ class FootnoteViewController: BaseViewController { } symbolTypePickerSelectorView.onPickerDidSelect = { [weak self] item in - self?.component.symbolType = item + self?.component.symbolType = item.text } } } From 192279158096b773d1565dfac8d2010c62cc4239 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 18 Sep 2024 12:22:35 +0530 Subject: [PATCH 6/8] 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 + } + } From adb30de38ca19c1867e05457681a508880884333 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 18 Sep 2024 14:56:40 -0500 Subject: [PATCH 7/8] refactored naming of Footnote to FootnoteItem Signed-off-by: Matt Bruce --- VDSSample.xcodeproj/project.pbxproj | 8 ++++---- .../ViewControllers/FootnoteGroupViewController.swift | 8 ++++---- ...wController.swift => FootnoteItemViewController.swift} | 6 +++--- VDSSample/ViewControllers/MenuViewController.swift | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) rename VDSSample/ViewControllers/{FootnoteViewController.swift => FootnoteItemViewController.swift} (96%) diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 7d4ebd2..ebe2758 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -38,7 +38,7 @@ 183B16F52C80B27C00BA6A10 /* FootnoteGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */; }; 184023492C61E9E700A412C8 /* PriceLockupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */; }; 186D13CD2BBA990800986B53 /* DropdownSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */; }; - 18926F5F2C76185A00C55BF6 /* FootnoteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */; }; + 18926F5F2C76185A00C55BF6 /* FootnoteItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5E2C76185A00C55BF6 /* FootnoteItemViewController.swift */; }; 18A3F1302BD9332500498E4A /* CalendarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A3F12F2BD9332500498E4A /* CalendarViewController.swift */; }; 18AE87522C06FDD60075F181 /* CarouselViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18AE87512C06FDD60075F181 /* CarouselViewController.swift */; }; 440B84CC2BD8E98B004A732A /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440B84CB2BD8E98B004A732A /* TableViewController.swift */; }; @@ -140,7 +140,7 @@ 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteGroupViewController.swift; sourceTree = ""; }; 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriceLockupViewController.swift; sourceTree = ""; }; 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelectViewController.swift; sourceTree = ""; }; - 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteViewController.swift; sourceTree = ""; }; + 18926F5E2C76185A00C55BF6 /* FootnoteItemViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteItemViewController.swift; sourceTree = ""; }; 18A3F12F2BD9332500498E4A /* CalendarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarViewController.swift; sourceTree = ""; }; 18AE87512C06FDD60075F181 /* CarouselViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselViewController.swift; sourceTree = ""; }; 440B84CB2BD8E98B004A732A /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; @@ -345,7 +345,7 @@ EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */, EA1758452BC8893700A5C0D9 /* DatePickerViewController.swift */, 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */, - 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */, + 18926F5E2C76185A00C55BF6 /* FootnoteItemViewController.swift */, 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */, EA985C00296CC21C00F2FF2E /* IconViewController.swift */, 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */, @@ -574,7 +574,7 @@ EA985C20296DECF600F2FF2E /* IconName.swift in Sources */, EA89204928B66CE2006B9984 /* KeyboardFrameChangeListening.swift in Sources */, EA5F86CE2A1E863F00BC83E4 /* TabsContainerViewController.swift in Sources */, - 18926F5F2C76185A00C55BF6 /* FootnoteViewController.swift in Sources */, + 18926F5F2C76185A00C55BF6 /* FootnoteItemViewController.swift in Sources */, EA985C01296CC21C00F2FF2E /* IconViewController.swift in Sources */, 184023492C61E9E700A412C8 /* PriceLockupViewController.swift in Sources */, EAC9258029119FC400091998 /* TextLinkViewController.swift in Sources */, diff --git a/VDSSample/ViewControllers/FootnoteGroupViewController.swift b/VDSSample/ViewControllers/FootnoteGroupViewController.swift index c88a70c..b2a1c83 100644 --- a/VDSSample/ViewControllers/FootnoteGroupViewController.swift +++ b/VDSSample/ViewControllers/FootnoteGroupViewController.swift @@ -13,7 +13,7 @@ class FootnoteGroupViewController: BaseViewController { var widthTextField = NumericField() var percentageTextField = NumericField() - var footnotes: [Footnote] = [] + var footnotes: [FootnoteItem] = [] override func viewDidLoad() { super.viewDidLoad() @@ -54,9 +54,9 @@ class FootnoteGroupViewController: BaseViewController { func setupModel() { let toolTipModel = Tooltip.TooltipModel.init(title: "Check your item.", content:"Here is the content for your item.") - footnotes.append(Footnote().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get off *T&C apply."; $0.symbolType = "*"; $0.kind = .primary; $0.tooltipModel = toolTipModel}) - footnotes.append(Footnote().with { $0.text = "The display has rounded corners. When measured as a standard rectangular shape, the screen is 6.68 inches diagonally. Actual viewable area is less."; $0.symbolType = "**"; $0.kind = .primary}) - footnotes.append(Footnote().with { $0.text = " Some features may not be available for all countries or all areas."; $0.symbolType = "1."; $0.kind = .primary}) + footnotes.append(.init().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get off *T&C apply."; $0.symbolType = "*"; $0.kind = .primary; $0.tooltipModel = toolTipModel}) + footnotes.append(.init().with { $0.text = "The display has rounded corners. When measured as a standard rectangular shape, the screen is 6.68 inches diagonally. Actual viewable area is less."; $0.symbolType = "**"; $0.kind = .primary}) + footnotes.append(.init().with { $0.text = "Some features may not be available for all countries or all areas."; $0.symbolType = "1."; $0.kind = .primary}) component.footnoteItems = footnotes } diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteItemViewController.swift similarity index 96% rename from VDSSample/ViewControllers/FootnoteViewController.swift rename to VDSSample/ViewControllers/FootnoteItemViewController.swift index e175c59..de1b3e5 100644 --- a/VDSSample/ViewControllers/FootnoteViewController.swift +++ b/VDSSample/ViewControllers/FootnoteItemViewController.swift @@ -9,7 +9,7 @@ import Foundation import UIKit import VDS -class FootnoteViewController: BaseViewController { +class FootnoteItemViewController: BaseViewController { internal enum SymbolType: String, DefaultValuing, CaseIterable { case asterisk @@ -37,7 +37,7 @@ class FootnoteViewController: BaseViewController { lazy var kindPickerSelectorView = { PickerSelectorView(title: "secondary", picker: self.picker, - items: Footnote.Kind.allCases) + items: FootnoteItem.Kind.allCases) }() lazy var symbolTypePickerSelectorView = { @@ -49,7 +49,7 @@ class FootnoteViewController: BaseViewController { lazy var sizePickerSelectorView = { PickerSelectorView(title: "micro", picker: self.picker, - items: Footnote.Size.allCases) + items: FootnoteItem.Size.allCases) }() var footnoteTextField = TextField() diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 1475bed..94c9190 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -82,7 +82,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable { MenuComponent(title: "CheckboxGroup", completed: true, viewController: CheckboxGroupViewController.self), MenuComponent(title: "DatePicker", completed: true, viewController: DatePickerViewController.self), MenuComponent(title: "DropdownSelect", completed: true, viewController: DropdownSelectViewController.self), - MenuComponent(title: "Footnote", completed: false, viewController: FootnoteViewController.self), + MenuComponent(title: "FootnoteItem", completed: false, viewController: FootnoteItemViewController.self), MenuComponent(title: "FootnoteGroup", completed: false, viewController: FootnoteGroupViewController.self), MenuComponent(title: "Icon", completed: true, viewController: IconViewController.self), MenuComponent(title: "InputField", completed: true, viewController: InputFieldViewController.self), From efc5f6b58d348f42bac132eea2c20f7b9e84d9b0 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 18 Sep 2024 14:59:18 -0500 Subject: [PATCH 8/8] added back hideSymbol Signed-off-by: Matt Bruce --- VDSSample/ViewControllers/FootnoteItemViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/VDSSample/ViewControllers/FootnoteItemViewController.swift b/VDSSample/ViewControllers/FootnoteItemViewController.swift index de1b3e5..9483402 100644 --- a/VDSSample/ViewControllers/FootnoteItemViewController.swift +++ b/VDSSample/ViewControllers/FootnoteItemViewController.swift @@ -52,6 +52,7 @@ class FootnoteItemViewController: BaseViewController { items: FootnoteItem.Size.allCases) }() + var hideSymbolSwitch = Toggle() var footnoteTextField = TextField() var widthTextField = NumericField() var percentageTextField = NumericField() @@ -71,11 +72,16 @@ class FootnoteItemViewController: 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) addFormRow(label: "ToolTip Title", view: tooltipTitleTextField) addFormRow(label: "ToolTip Content", view: tooltipContentTextField) + + hideSymbolSwitch.publisher(for: .valueChanged).sink { [weak self] control in + self?.component.hideSymbol = control.isOn + }.store(in: &subscribers) footnoteTextField .textPublisher