Updated "Leave Group" confirmation modal confirm button accessibility id

pull/1061/head
Morgan Pretty 3 days ago
parent e7e289c3e7
commit d2816eed14

@ -538,6 +538,7 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigatableStateHolder, Ob
), ),
confirmTitle: "leave".localized(), confirmTitle: "leave".localized(),
confirmStyle: .danger, confirmStyle: .danger,
confirmAccessibility: Accessibility(identifier: "Confirm leave"),
cancelStyle: .alert_text cancelStyle: .alert_text
), ),
onTap: { [weak self, dependencies] in onTap: { [weak self, dependencies] in

@ -407,7 +407,7 @@ public class ConfirmationModal: Modal, UITextFieldDelegate, UITextViewDelegate {
imageViewTapGestureRecognizer.isEnabled = true imageViewTapGestureRecognizer.isEnabled = true
} }
confirmButton.accessibilityIdentifier = info.confirmTitle confirmButton.accessibilityIdentifier = (info.confirmAccessibility?.identifier ?? info.confirmTitle)
confirmButton.isAccessibilityElement = true confirmButton.isAccessibilityElement = true
confirmButton.setTitle(info.confirmTitle, for: .normal) confirmButton.setTitle(info.confirmTitle, for: .normal)
confirmButton.setThemeTitleColor(info.confirmStyle, for: .normal) confirmButton.setThemeTitleColor(info.confirmStyle, for: .normal)
@ -415,7 +415,7 @@ public class ConfirmationModal: Modal, UITextFieldDelegate, UITextViewDelegate {
confirmButton.isHidden = (info.confirmTitle == nil) confirmButton.isHidden = (info.confirmTitle == nil)
confirmButton.isEnabled = info.confirmEnabled.isValid(with: info) confirmButton.isEnabled = info.confirmEnabled.isValid(with: info)
cancelButton.accessibilityIdentifier = info.cancelTitle cancelButton.accessibilityIdentifier = (info.cancelAccessibility?.identifier ?? info.cancelTitle)
cancelButton.isAccessibilityElement = true cancelButton.isAccessibilityElement = true
cancelButton.setTitle(info.cancelTitle, for: .normal) cancelButton.setTitle(info.cancelTitle, for: .normal)
cancelButton.setThemeTitleColor(info.cancelStyle, for: .normal) cancelButton.setThemeTitleColor(info.cancelStyle, for: .normal)
@ -579,9 +579,11 @@ public extension ConfirmationModal {
internal let confirmTitle: String? internal let confirmTitle: String?
let confirmStyle: ThemeValue let confirmStyle: ThemeValue
let confirmEnabled: ButtonValidator let confirmEnabled: ButtonValidator
let confirmAccessibility: Accessibility?
internal let cancelTitle: String internal let cancelTitle: String
let cancelStyle: ThemeValue let cancelStyle: ThemeValue
let cancelEnabled: ButtonValidator let cancelEnabled: ButtonValidator
let cancelAccessibility: Accessibility?
let hasCloseButton: Bool let hasCloseButton: Bool
let dismissOnConfirm: Bool let dismissOnConfirm: Bool
let dismissType: Modal.DismissType let dismissType: Modal.DismissType
@ -598,9 +600,11 @@ public extension ConfirmationModal {
confirmTitle: String? = nil, confirmTitle: String? = nil,
confirmStyle: ThemeValue = .alert_text, confirmStyle: ThemeValue = .alert_text,
confirmEnabled: ButtonValidator = true, confirmEnabled: ButtonValidator = true,
confirmAccessibility: Accessibility? = nil,
cancelTitle: String = SNUIKit.localizedString(for: "cancel"), cancelTitle: String = SNUIKit.localizedString(for: "cancel"),
cancelStyle: ThemeValue = .danger, cancelStyle: ThemeValue = .danger,
cancelEnabled: ButtonValidator = true, cancelEnabled: ButtonValidator = true,
cancelAccessibility: Accessibility? = nil,
hasCloseButton: Bool = false, hasCloseButton: Bool = false,
dismissOnConfirm: Bool = true, dismissOnConfirm: Bool = true,
dismissType: Modal.DismissType = .recursive, dismissType: Modal.DismissType = .recursive,
@ -614,9 +618,11 @@ public extension ConfirmationModal {
self.confirmTitle = confirmTitle self.confirmTitle = confirmTitle
self.confirmStyle = confirmStyle self.confirmStyle = confirmStyle
self.confirmEnabled = confirmEnabled self.confirmEnabled = confirmEnabled
self.confirmAccessibility = confirmAccessibility
self.cancelTitle = cancelTitle self.cancelTitle = cancelTitle
self.cancelStyle = cancelStyle self.cancelStyle = cancelStyle
self.cancelEnabled = cancelEnabled self.cancelEnabled = cancelEnabled
self.cancelAccessibility = cancelAccessibility
self.hasCloseButton = hasCloseButton self.hasCloseButton = hasCloseButton
self.dismissOnConfirm = dismissOnConfirm self.dismissOnConfirm = dismissOnConfirm
self.dismissType = dismissType self.dismissType = dismissType
@ -640,9 +646,11 @@ public extension ConfirmationModal {
confirmTitle: self.confirmTitle, confirmTitle: self.confirmTitle,
confirmStyle: self.confirmStyle, confirmStyle: self.confirmStyle,
confirmEnabled: self.confirmEnabled, confirmEnabled: self.confirmEnabled,
confirmAccessibility: self.confirmAccessibility,
cancelTitle: self.cancelTitle, cancelTitle: self.cancelTitle,
cancelStyle: self.cancelStyle, cancelStyle: self.cancelStyle,
cancelEnabled: self.cancelEnabled, cancelEnabled: self.cancelEnabled,
cancelAccessibility: self.cancelAccessibility,
hasCloseButton: self.hasCloseButton, hasCloseButton: self.hasCloseButton,
dismissOnConfirm: self.dismissOnConfirm, dismissOnConfirm: self.dismissOnConfirm,
dismissType: self.dismissType, dismissType: self.dismissType,
@ -662,9 +670,11 @@ public extension ConfirmationModal {
lhs.confirmTitle == rhs.confirmTitle && lhs.confirmTitle == rhs.confirmTitle &&
lhs.confirmStyle == rhs.confirmStyle && lhs.confirmStyle == rhs.confirmStyle &&
lhs.confirmEnabled.isValid(with: lhs) == rhs.confirmEnabled.isValid(with: rhs) && lhs.confirmEnabled.isValid(with: lhs) == rhs.confirmEnabled.isValid(with: rhs) &&
lhs.confirmAccessibility == rhs.confirmAccessibility &&
lhs.cancelTitle == rhs.cancelTitle && lhs.cancelTitle == rhs.cancelTitle &&
lhs.cancelStyle == rhs.cancelStyle && lhs.cancelStyle == rhs.cancelStyle &&
lhs.cancelEnabled.isValid(with: lhs) == rhs.cancelEnabled.isValid(with: rhs) && lhs.cancelEnabled.isValid(with: lhs) == rhs.cancelEnabled.isValid(with: rhs) &&
lhs.cancelAccessibility == rhs.cancelAccessibility &&
lhs.hasCloseButton == rhs.hasCloseButton && lhs.hasCloseButton == rhs.hasCloseButton &&
lhs.dismissOnConfirm == rhs.dismissOnConfirm && lhs.dismissOnConfirm == rhs.dismissOnConfirm &&
lhs.dismissType == rhs.dismissType lhs.dismissType == rhs.dismissType
@ -678,9 +688,11 @@ public extension ConfirmationModal {
confirmTitle.hash(into: &hasher) confirmTitle.hash(into: &hasher)
confirmStyle.hash(into: &hasher) confirmStyle.hash(into: &hasher)
confirmEnabled.isValid(with: self).hash(into: &hasher) confirmEnabled.isValid(with: self).hash(into: &hasher)
confirmAccessibility?.hash(into: &hasher)
cancelTitle.hash(into: &hasher) cancelTitle.hash(into: &hasher)
cancelStyle.hash(into: &hasher) cancelStyle.hash(into: &hasher)
cancelEnabled.isValid(with: self).hash(into: &hasher) cancelEnabled.isValid(with: self).hash(into: &hasher)
cancelAccessibility?.hash(into: &hasher)
hasCloseButton.hash(into: &hasher) hasCloseButton.hash(into: &hasher)
dismissOnConfirm.hash(into: &hasher) dismissOnConfirm.hash(into: &hasher)
dismissType.hash(into: &hasher) dismissType.hash(into: &hasher)

Loading…
Cancel
Save