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
.textPublisher
.sink { [weak self] text in
self?.component.tooltipContent = text
self?.component.tooltipChild = text
}.store(in: &subscribers)
}
@ -127,7 +127,7 @@ class InputFieldViewController: BaseViewController<InputField> {
component.errorText = "Enter a valid address."
component.successText = "Good job entering a valid 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
.publisher(for: .valueChanged)
@ -151,7 +151,7 @@ class InputFieldViewController: BaseViewController<InputField> {
showSuccessSwitch.isOn = component.showSuccess
successTextField.text = component.successText
tooltipTitleTextField.text = component.tooltipTitle
tooltipContentTextField.text = component.tooltipContent
tooltipContentTextField.text = component.tooltipChild as? String
if let width = component.width {
widthTextField.text = String(describing: width)
}

View File

@ -69,7 +69,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
let tooltip = VDS.Tooltip()
let bundle = VDS.Bundle(for: VDS.Badge.self)
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))
super.viewDidLoad()
overrideUserInterfaceStyle = .light

View File

@ -97,7 +97,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
tooltipContentTextField
.textPublisher
.sink { [weak self] text in
self?.component.tooltipContent = text
self?.component.tooltipChild = text
}.store(in: &subscribers)
}
@ -108,7 +108,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
component.helperText = "For example: 123 Verizon St"
component.errorText = "Enter a valid 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
.publisher(for: .valueChanged)
@ -129,7 +129,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
showErrorSwitch.isOn = component.showError
errorTextField.text = component.errorText
tooltipTitleTextField.text = component.tooltipTitle
tooltipContentTextField.text = component.tooltipContent
tooltipContentTextField.text = component.tooltipChild as? String
}
//Picker

View File

@ -13,6 +13,7 @@ import Combine
class TooltipViewController: BaseViewController<Tooltip> {
var contentSwitch = Toggle().with { $0.isOn = true }
var disabledSwitch = Toggle()
var titleTextField = TextField()
var contentTextField = TextField()
@ -40,6 +41,9 @@ class TooltipViewController: BaseViewController<Tooltip> {
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(){
super.setupForm()
addFormRow(label: "Disabled", view: disabledSwitch)
@ -47,6 +51,7 @@ class TooltipViewController: BaseViewController<Tooltip> {
addFormRow(label: "Size", view: sizePickerSelectorView)
addFormRow(label: "FillColor", view: fillColorPickerSelectorView)
addFormRow(label: "Title", view: titleTextField)
addFormRow(label: "Show Content Text", view: contentSwitch)
addFormRow(label: "Content", view: contentTextField)
addFormRow(label: "Close Button Text", view: closeButtonTextField)
@ -63,7 +68,7 @@ class TooltipViewController: BaseViewController<Tooltip> {
contentTextField
.textPublisher
.sink { [weak self] text in
self?.component.content = text
self?.content = text
}.store(in: &subscribers)
closeButtonTextField
@ -71,18 +76,25 @@ class TooltipViewController: BaseViewController<Tooltip> {
.sink { [weak self] text in
self?.component.closeButtonText = text
}.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() {
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.contentView = Icon().with { $0.name = .addFolder; $0.size = .medium }
component.child = content
//setup UI
surfacePickerSelectorView.text = component.surface.rawValue
disabledSwitch.isOn = component.disabled
titleTextField.text = component.title
contentTextField.text = component.content
contentTextField.text = component.child as? String
closeButtonTextField.text = component.closeButtonText
}

View File

@ -87,7 +87,7 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
contentTextField
.textPublisher
.sink { [weak self] text in
self?.component.tooltipContent = text
self?.component.tooltipChild = text
}.store(in: &subscribers)
closeButtonTextField
@ -101,7 +101,7 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
func setupModel() {
component.labelText = "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
surfacePickerSelectorView.text = component.surface.rawValue
@ -117,7 +117,7 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
surfacePickerSelectorView.text = component.surface.rawValue
disabledSwitch.isOn = component.disabled
titleTextField.text = component.tooltipTitle
contentTextField.text = component.tooltipContent
contentTextField.text = component.tooltipChild as? String
closeButtonTextField.text = component.tooltipCloseButtonText
}