Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into mbruce/bugfix

This commit is contained in:
Matt Bruce 2024-07-12 15:27:53 -05:00
commit cbe28583ed
2 changed files with 12 additions and 5 deletions

View File

@ -67,7 +67,14 @@ extension InputField {
} }
internal func formatUSNumber(_ number: String) -> String { override func textFieldDidEndEditing(_ inputField: InputField, textField: UITextField) {
if let text = inputField.text {
let rawNumber = text.filter { $0.isNumber }
textField.text = formatUSNumber(rawNumber)
}
}
func formatUSNumber(_ number: String) -> String {
// Format the number in the style XXX-XXX-XXXX // Format the number in the style XXX-XXX-XXXX
let areaCodeLength = 3 let areaCodeLength = 3
let centralOfficeCodeLength = 3 let centralOfficeCodeLength = 3

View File

@ -350,19 +350,19 @@ open class InputField: EntryFieldBase {
} }
extension InputField: UITextFieldDelegate { extension InputField: UITextFieldDelegate {
public func textFieldDidBeginEditing(_ textField: UITextField) { open func textFieldDidBeginEditing(_ textField: UITextField) {
fieldType.handler().textFieldDidBeginEditing(self, textField: textField) fieldType.handler().textFieldDidBeginEditing(self, textField: textField)
updateContainerView() updateContainerView()
updateErrorLabel() updateErrorLabel()
} }
public func textFieldDidEndEditing(_ textField: UITextField) { open func textFieldDidEndEditing(_ textField: UITextField) {
fieldType.handler().textFieldDidEndEditing(self, textField: textField) fieldType.handler().textFieldDidEndEditing(self, textField: textField)
validate() validate()
UIAccessibility.post(notification: .layoutChanged, argument: self.containerView) UIAccessibility.post(notification: .layoutChanged, argument: self.containerView)
} }
public func textFieldDidChangeSelection(_ textField: UITextField) { open func textFieldDidChangeSelection(_ textField: UITextField) {
fieldType.handler().textFieldDidChangeSelection(self, textField: textField) fieldType.handler().textFieldDidChangeSelection(self, textField: textField)
if fieldType.handler().validateOnChange { if fieldType.handler().validateOnChange {
validate() validate()
@ -371,7 +371,7 @@ extension InputField: UITextFieldDelegate {
setNeedsUpdate() setNeedsUpdate()
} }
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { open func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let shouldChange = fieldType.handler().textField(self, textField: textField, shouldChangeCharactersIn: range, replacementString: string) let shouldChange = fieldType.handler().textField(self, textField: textField, shouldChangeCharactersIn: range, replacementString: string)
if shouldChange { if shouldChange {
UIAccessibility.post(notification: .announcement, argument: string) UIAccessibility.post(notification: .announcement, argument: string)