removed accessibility and rearranged methods/comments
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
226c23abae
commit
35ab4c94d2
@ -22,9 +22,9 @@ import VDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Form Validation
|
// Form Validation
|
||||||
var fieldKey: String?
|
open var fieldKey: String?
|
||||||
var fieldValue: JSONValue?
|
open var fieldValue: JSONValue?
|
||||||
var groupName: String?
|
open var groupName: String?
|
||||||
|
|
||||||
open override var isSelected: Bool {
|
open override var isSelected: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
@ -86,22 +86,27 @@ import VDS
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
public func viewModelDidUpdate() {
|
||||||
|
|
||||||
open override func setup() {
|
//events
|
||||||
super.setup()
|
viewModel.updateUI = {
|
||||||
bridge_accessibilityLabelBlock = { [weak self] in
|
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
||||||
guard let self else { return nil }
|
guard let self = self else { return }
|
||||||
if let message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button"),
|
let isValid = viewModel.isValid ?? true
|
||||||
let selectedState = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "radio_selected_state" : "radio_not_selected_state") {
|
showError = !isValid
|
||||||
return message + selectedState
|
isEnabled = viewModel.enabled
|
||||||
} else {
|
|
||||||
return nil
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
isSelected = viewModel.state
|
||||||
|
isEnabled = viewModel.enabled && !viewModel.readOnly
|
||||||
|
RadioButtonSelectionHelper.setupForRadioButtonGroup(viewModel, self, delegateObject: delegateObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Overrides
|
||||||
|
//--------------------------------------------------
|
||||||
open override func toggle() {
|
open override func toggle() {
|
||||||
guard !isSelected, isEnabled else { return }
|
guard !isSelected, isEnabled else { return }
|
||||||
|
|
||||||
@ -136,7 +141,7 @@ import VDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Molecular
|
// MARK: - MoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open func needsToBeConstrained() -> Bool { true }
|
open func needsToBeConstrained() -> Bool { true }
|
||||||
@ -145,21 +150,4 @@ import VDS
|
|||||||
|
|
||||||
public func updateView(_ size: CGFloat) {}
|
public func updateView(_ size: CGFloat) {}
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
|
||||||
|
|
||||||
//events
|
|
||||||
viewModel.updateUI = {
|
|
||||||
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
|
||||||
guard let self = self else { return }
|
|
||||||
let isValid = viewModel.isValid ?? true
|
|
||||||
showError = !isValid
|
|
||||||
isEnabled = viewModel.enabled
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
isSelected = viewModel.state
|
|
||||||
isEnabled = viewModel.enabled && !viewModel.readOnly
|
|
||||||
RadioButtonSelectionHelper.setupForRadioButtonGroup(viewModel, self, delegateObject: delegateObject)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user