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
|
||||
var fieldKey: String?
|
||||
var fieldValue: JSONValue?
|
||||
var groupName: String?
|
||||
open var fieldKey: String?
|
||||
open var fieldValue: JSONValue?
|
||||
open var groupName: String?
|
||||
|
||||
open override var isSelected: Bool {
|
||||
didSet {
|
||||
@ -86,22 +86,27 @@ import VDS
|
||||
//--------------------------------------------------
|
||||
// MARK: - Lifecycle
|
||||
//--------------------------------------------------
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
bridge_accessibilityLabelBlock = { [weak self] in
|
||||
guard let self else { return nil }
|
||||
if let message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button"),
|
||||
let selectedState = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "radio_selected_state" : "radio_not_selected_state") {
|
||||
return message + selectedState
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
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
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
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() {
|
||||
guard !isSelected, isEnabled else { return }
|
||||
|
||||
@ -136,7 +141,7 @@ import VDS
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Molecular
|
||||
// MARK: - MoleculeViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
open func needsToBeConstrained() -> Bool { true }
|
||||
@ -145,21 +150,4 @@ import VDS
|
||||
|
||||
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