remove tap and accessibility
This commit is contained in:
parent
49f0048d77
commit
52fca407e3
@ -12,7 +12,6 @@ import UIKit
|
|||||||
|
|
||||||
public let radioButton = RadioButton()
|
public let radioButton = RadioButton()
|
||||||
var delegateObject: MVMCoreUIDelegateObject?
|
var delegateObject: MVMCoreUIDelegateObject?
|
||||||
var dummyButton: MFCustomButton?
|
|
||||||
let label = Label()
|
let label = Label()
|
||||||
|
|
||||||
// MARK: - Inits
|
// MARK: - Inits
|
||||||
@ -38,10 +37,6 @@ import UIKit
|
|||||||
radioButton.translatesAutoresizingMaskIntoConstraints = false
|
radioButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addSubview(radioButton)
|
addSubview(radioButton)
|
||||||
|
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityTraits = .none
|
|
||||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
|
||||||
|
|
||||||
radioButton.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor, constant: 0).isActive = true
|
radioButton.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor, constant: 0).isActive = true
|
||||||
radioButton.topAnchor.constraint(greaterThanOrEqualTo: topAnchor, constant: PaddingOne).isActive = true
|
radioButton.topAnchor.constraint(greaterThanOrEqualTo: topAnchor, constant: PaddingOne).isActive = true
|
||||||
bottomAnchor.constraint(greaterThanOrEqualTo: radioButton.bottomAnchor, constant: PaddingOne).isActive = true
|
bottomAnchor.constraint(greaterThanOrEqualTo: radioButton.bottomAnchor, constant: PaddingOne).isActive = true
|
||||||
@ -60,36 +55,12 @@ import UIKit
|
|||||||
constraint.priority = .defaultHigh
|
constraint.priority = .defaultHigh
|
||||||
constraint.isActive = true
|
constraint.isActive = true
|
||||||
}
|
}
|
||||||
addActionHandler()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func createRightView() -> ViewConstrainingView? {
|
func createRightView() -> ViewConstrainingView? {
|
||||||
let rightView = ViewConstrainingView(constrainingView: label)
|
let rightView = ViewConstrainingView(constrainingView: label)
|
||||||
return rightView
|
return rightView
|
||||||
}
|
}
|
||||||
|
|
||||||
func addActionHandler() {
|
|
||||||
|
|
||||||
guard dummyButton == nil else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let dummyButton = MFCustomButton(frame: .zero)
|
|
||||||
self.dummyButton = dummyButton
|
|
||||||
dummyButton.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
addSubview(dummyButton)
|
|
||||||
NSLayoutConstraint.constraintPinSubview(toSuperview: dummyButton)
|
|
||||||
bringSubviewToFront(dummyButton)
|
|
||||||
|
|
||||||
dummyButton.add({ [weak self] (button) in
|
|
||||||
self?.tapAction()
|
|
||||||
}, for: .touchUpInside)
|
|
||||||
}
|
|
||||||
|
|
||||||
func tapAction() {
|
|
||||||
radioButton.tapAction()
|
|
||||||
changeAccessibilityLabel()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
@ -100,18 +71,6 @@ extension RadioButtonWithLabel {
|
|||||||
radioButton.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
radioButton.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
label.setWithJSON(json?.optionalDictionaryForKey(KeyLabel),
|
label.setWithJSON(json?.optionalDictionaryForKey(KeyLabel),
|
||||||
delegateObject: delegateObject,
|
delegateObject: delegateObject,
|
||||||
additionalData: additionalData)
|
additionalData: additionalData)
|
||||||
changeAccessibilityLabel()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Accessibility
|
|
||||||
extension RadioButtonWithLabel {
|
|
||||||
func changeAccessibilityLabel() {
|
|
||||||
let stateString = radioButton.isSelected ? "radio_selected_state" : "radio_not_selected_state"
|
|
||||||
let localizedStringState = MVMCoreUIUtility.hardcodedString(withKey: stateString) ?? ""
|
|
||||||
let accebilityString = (label.accessibilityLabel ?? (json?.optionalStringForKey("accessibilityText") ?? ""))
|
|
||||||
+ (MVMCoreUIUtility.hardcodedString(withKey: "radio_desc_state") ?? "") + localizedStringState
|
|
||||||
accessibilityLabel = accebilityString
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user