Digital ACT-191 ONEAPP-9311 story: refactored code and resolved constraint issues

This commit is contained in:
Vasavi Kanamarlapudi 2024-07-31 14:53:43 +05:30
parent a85a675214
commit 4399eef2d6

View File

@ -72,23 +72,26 @@ class InputStepperViewController: BaseViewController<InputStepper> {
addFormRow(label: "Helper Text", view: helperTextField)
addFormRow(label: "Tooltip Title", view: tooltipTitleTextField)
addFormRow(label: "Tooltip Content", view: tooltipContentTextField)
controlWidthTextField
.textPublisher
.sink { [weak self] text in
self?.component.controlWidth = text
self?.controlWidthPercentageTextField.text = ""
self?.component.controlWidthPercentage = nil
.numberPublisher
.sink { [weak self] number in
if let number {
self?.component.controlWidth = .value(number.cgFloatValue)
self?.controlWidthPercentageTextField.text = ""
} else {
self?.component.controlWidth = nil
}
}.store(in: &subscribers)
controlWidthPercentageTextField
.numberPublisher
.sink { [weak self] number in
if let number, number.intValue > 10 {
self?.component.controlWidthPercentage = number.cgFloatValue
if let number {
self?.component.controlWidth = .percentage(number.cgFloatValue)
self?.controlWidthTextField.text = ""
} else {
self?.component.controlWidthPercentage = nil
self?.component.controlWidth = nil
}
}.store(in: &subscribers)
@ -159,6 +162,7 @@ class InputStepperViewController: BaseViewController<InputStepper> {
.numberPublisher
.sink { [weak self] number in
if let number {
self?.component.widthPercentage = nil
self?.component.width = number.cgFloatValue
self?.widthPercentageTextField.text = ""
} else {
@ -170,6 +174,7 @@ class InputStepperViewController: BaseViewController<InputStepper> {
.numberPublisher
.sink { [weak self] number in
if let number, number.intValue > 10 {
self?.component.width = nil
self?.component.widthPercentage = number.cgFloatValue
self?.widthTextField.text = ""
} else {
@ -220,9 +225,8 @@ class InputStepperViewController: BaseViewController<InputStepper> {
component.errorText = "You must choose a number of lines before advancing to the next step."
component.defaultValue = 8
component.trailingText = ""
component.controlWidth = "auto"
trailingTextField.text = component.trailingText
controlWidthTextField.text = component.controlWidth
controlWidthTextField.text = ""
errorTextField.text = component.errorText
helperTextField.text = component.helperText
labelTextField.text = component.labelText