refactored screens using tooltip

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-07-25 10:14:00 -05:00
parent 1410f30178
commit 7fff40336f
5 changed files with 27 additions and 15 deletions

View File

@ -114,7 +114,7 @@ class InputFieldViewController: BaseViewController<InputField> {
tooltipContentTextField tooltipContentTextField
.textPublisher .textPublisher
.sink { [weak self] text in .sink { [weak self] text in
self?.component.tooltipContent = text self?.component.tooltipChild = text
}.store(in: &subscribers) }.store(in: &subscribers)
} }
@ -127,7 +127,7 @@ class InputFieldViewController: BaseViewController<InputField> {
component.errorText = "Enter a valid address." component.errorText = "Enter a valid address."
component.successText = "Good job entering a valid address!" component.successText = "Good job entering a valid address!"
component.tooltipTitle = "Check the formatting of your address" component.tooltipTitle = "Check the formatting of your address"
component.tooltipContent = "House/Building number then street name" component.tooltipChild = "House/Building number then street name"
component component
.publisher(for: .valueChanged) .publisher(for: .valueChanged)
@ -151,7 +151,7 @@ class InputFieldViewController: BaseViewController<InputField> {
showSuccessSwitch.isOn = component.showSuccess showSuccessSwitch.isOn = component.showSuccess
successTextField.text = component.successText successTextField.text = component.successText
tooltipTitleTextField.text = component.tooltipTitle tooltipTitleTextField.text = component.tooltipTitle
tooltipContentTextField.text = component.tooltipContent tooltipContentTextField.text = component.tooltipChild as? String
if let width = component.width { if let width = component.width {
widthTextField.text = String(describing: width) widthTextField.text = String(describing: width)
} }

View File

@ -69,7 +69,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
let tooltip = VDS.Tooltip() let tooltip = VDS.Tooltip()
let bundle = VDS.Bundle(for: VDS.Badge.self) let bundle = VDS.Bundle(for: VDS.Badge.self)
tooltip.title = "Release Notes: \(bundle.build ?? "")" tooltip.title = "Release Notes: \(bundle.build ?? "")"
tooltip.content = bundle.contents("ReleaseNotes") tooltip.child = bundle.contents("ReleaseNotes")
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: tooltip) // UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(buildInfoTapped)) navigationItem.rightBarButtonItem = UIBarButtonItem(customView: tooltip) // UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(buildInfoTapped))
super.viewDidLoad() super.viewDidLoad()
overrideUserInterfaceStyle = .light overrideUserInterfaceStyle = .light

View File

@ -97,7 +97,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
tooltipContentTextField tooltipContentTextField
.textPublisher .textPublisher
.sink { [weak self] text in .sink { [weak self] text in
self?.component.tooltipContent = text self?.component.tooltipChild = text
}.store(in: &subscribers) }.store(in: &subscribers)
} }
@ -108,7 +108,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
component.helperText = "For example: 123 Verizon St" component.helperText = "For example: 123 Verizon St"
component.errorText = "Enter a valid address." component.errorText = "Enter a valid address."
component.tooltipTitle = "Check the formatting of your address" component.tooltipTitle = "Check the formatting of your address"
component.tooltipContent = "House/Building number then street name" component.tooltipChild = "House/Building number then street name"
component component
.publisher(for: .valueChanged) .publisher(for: .valueChanged)
@ -129,7 +129,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
showErrorSwitch.isOn = component.showError showErrorSwitch.isOn = component.showError
errorTextField.text = component.errorText errorTextField.text = component.errorText
tooltipTitleTextField.text = component.tooltipTitle tooltipTitleTextField.text = component.tooltipTitle
tooltipContentTextField.text = component.tooltipContent tooltipContentTextField.text = component.tooltipChild as? String
} }
//Picker //Picker

View File

@ -13,6 +13,7 @@ import Combine
class TooltipViewController: BaseViewController<Tooltip> { class TooltipViewController: BaseViewController<Tooltip> {
var contentSwitch = Toggle().with { $0.isOn = true }
var disabledSwitch = Toggle() var disabledSwitch = Toggle()
var titleTextField = TextField() var titleTextField = TextField()
var contentTextField = TextField() var contentTextField = TextField()
@ -40,6 +41,9 @@ class TooltipViewController: BaseViewController<Tooltip> {
override func allTextFields() -> [TextField]? { [titleTextField, contentTextField, closeButtonTextField] } override func allTextFields() -> [TextField]? { [titleTextField, contentTextField, closeButtonTextField] }
var content: String? = "$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in/promo credit applied over 36 mos.; promo credit ends if eligibility reqs are no longer met; 0% APR. Trade-in conditions apply.$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in. LAST"
var contentView = Icon().with { $0.name = .addFolder; $0.size = .medium }.makeWrapper()
override func setupForm(){ override func setupForm(){
super.setupForm() super.setupForm()
addFormRow(label: "Disabled", view: disabledSwitch) addFormRow(label: "Disabled", view: disabledSwitch)
@ -47,6 +51,7 @@ class TooltipViewController: BaseViewController<Tooltip> {
addFormRow(label: "Size", view: sizePickerSelectorView) addFormRow(label: "Size", view: sizePickerSelectorView)
addFormRow(label: "FillColor", view: fillColorPickerSelectorView) addFormRow(label: "FillColor", view: fillColorPickerSelectorView)
addFormRow(label: "Title", view: titleTextField) addFormRow(label: "Title", view: titleTextField)
addFormRow(label: "Show Content Text", view: contentSwitch)
addFormRow(label: "Content", view: contentTextField) addFormRow(label: "Content", view: contentTextField)
addFormRow(label: "Close Button Text", view: closeButtonTextField) addFormRow(label: "Close Button Text", view: closeButtonTextField)
@ -63,7 +68,7 @@ class TooltipViewController: BaseViewController<Tooltip> {
contentTextField contentTextField
.textPublisher .textPublisher
.sink { [weak self] text in .sink { [weak self] text in
self?.component.content = text self?.content = text
}.store(in: &subscribers) }.store(in: &subscribers)
closeButtonTextField closeButtonTextField
@ -71,18 +76,25 @@ class TooltipViewController: BaseViewController<Tooltip> {
.sink { [weak self] text in .sink { [weak self] text in
self?.component.closeButtonText = text self?.component.closeButtonText = text
}.store(in: &subscribers) }.store(in: &subscribers)
contentSwitch.onChange = { [weak self] (toggle) in
guard let self else { return }
if toggle.isOn {
self.component.child = content
} else {
self.component.child = contentView
}
}
} }
func setupModel() { func setupModel() {
component.title = "5G Ultra Wideband is available in your area." component.title = "5G Ultra Wideband is available in your area."
component.content = "$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in/promo credit applied over 36 mos.; promo credit ends if eligibility reqs are no longer met; 0% APR. Trade-in conditions apply.$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in. LAST" component.child = content
//component.contentView = Icon().with { $0.name = .addFolder; $0.size = .medium }
//setup UI //setup UI
surfacePickerSelectorView.text = component.surface.rawValue surfacePickerSelectorView.text = component.surface.rawValue
disabledSwitch.isOn = component.disabled disabledSwitch.isOn = component.disabled
titleTextField.text = component.title titleTextField.text = component.title
contentTextField.text = component.content contentTextField.text = component.child as? String
closeButtonTextField.text = component.closeButtonText closeButtonTextField.text = component.closeButtonText
} }

View File

@ -87,7 +87,7 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
contentTextField contentTextField
.textPublisher .textPublisher
.sink { [weak self] text in .sink { [weak self] text in
self?.component.tooltipContent = text self?.component.tooltipChild = text
}.store(in: &subscribers) }.store(in: &subscribers)
closeButtonTextField closeButtonTextField
@ -101,7 +101,7 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
func setupModel() { func setupModel() {
component.labelText = "5G Ultra Wideband is available in your area" component.labelText = "5G Ultra Wideband is available in your area"
component.tooltipTitle = "5G Ultra Wideband is available in your area." component.tooltipTitle = "5G Ultra Wideband is available in your area."
component.tooltipContent = "$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in/promo credit applied over 36 mos.; promo credit ends if eligibility reqs are no longer met; 0% APR. Trade-in conditions apply.$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in." component.tooltipChild = "$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in/promo credit applied over 36 mos.; promo credit ends if eligibility reqs are no longer met; 0% APR. Trade-in conditions apply.$799.99 (128 GB only) device payment purchase w/new or upgrade smartphone line on postpaid 5G Unlimited plans only req'd. Less up to $800 trade-in."
//setup UI //setup UI
surfacePickerSelectorView.text = component.surface.rawValue surfacePickerSelectorView.text = component.surface.rawValue
@ -117,7 +117,7 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
surfacePickerSelectorView.text = component.surface.rawValue surfacePickerSelectorView.text = component.surface.rawValue
disabledSwitch.isOn = component.disabled disabledSwitch.isOn = component.disabled
titleTextField.text = component.tooltipTitle titleTextField.text = component.tooltipTitle
contentTextField.text = component.tooltipContent contentTextField.text = component.tooltipChild as? String
closeButtonTextField.text = component.tooltipCloseButtonText closeButtonTextField.text = component.tooltipCloseButtonText
} }