modify & add accessibility ids and labels

pull/941/head
ryanzhao 2 years ago
parent 31af9c2ab9
commit 05eb059caf

@ -70,7 +70,7 @@ final class InfoMessageCell: MessageCell {
) { ) {
guard cellViewModel.variant.isInfoMessage else { return } guard cellViewModel.variant.isInfoMessage else { return }
self.accessibilityIdentifier = "Configuration message" self.accessibilityIdentifier = "Control message"
self.isAccessibilityElement = true self.isAccessibilityElement = true
self.viewModel = cellViewModel self.viewModel = cellViewModel

@ -106,6 +106,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
title: "DISAPPERING_MESSAGES_SAVE_TITLE".localized(), title: "DISAPPERING_MESSAGES_SAVE_TITLE".localized(),
isEnabled: true, isEnabled: true,
accessibilityIdentifier: "Set button", accessibilityIdentifier: "Set button",
accessibilityLabel: "Set button",
minWidth: 110, minWidth: 110,
onTap: { onTap: {
self?.saveChanges() self?.saveChanges()
@ -133,8 +134,8 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
isSelected: { (self?.currentSelection.value.isEnabled == false) } isSelected: { (self?.currentSelection.value.isEnabled == false) }
), ),
accessibility: Accessibility( accessibility: Accessibility(
identifier: "Off option", identifier: "Disable disappearing messages (Off option)",
label: "Off option" label: "Disable disappearing messages (Off option)"
), ),
onTap: { onTap: {
let updatedConfig: DisappearingMessagesConfiguration = currentSelection let updatedConfig: DisappearingMessagesConfiguration = currentSelection

@ -29,6 +29,7 @@ final class ConversationTitleView: UIView {
private lazy var titleLabel: UILabel = { private lazy var titleLabel: UILabel = {
let result: UILabel = UILabel() let result: UILabel = UILabel()
result.accessibilityIdentifier = "Conversation header name" result.accessibilityIdentifier = "Conversation header name"
result.accessibilityLabel = "Conversation header name"
result.isAccessibilityElement = true result.isAccessibilityElement = true
result.font = .boldSystemFont(ofSize: Values.mediumFontSize) result.font = .boldSystemFont(ofSize: Values.mediumFontSize)
result.themeTextColor = .textPrimary result.themeTextColor = .textPrimary
@ -161,7 +162,7 @@ final class ConversationTitleView: UIView {
labelInfos.append( labelInfos.append(
SessionLabelCarouselView.LabelInfo( SessionLabelCarouselView.LabelInfo(
attributedText: notificationSettingsLabelString, attributedText: notificationSettingsLabelString,
accessibilityIdentifier: nil, accessibility: nil, // TODO: Add accessibility
type: .notificationSettings type: .notificationSettings
) )
) )
@ -183,7 +184,7 @@ final class ConversationTitleView: UIView {
labelInfos.append( labelInfos.append(
SessionLabelCarouselView.LabelInfo( SessionLabelCarouselView.LabelInfo(
attributedText: notificationSettingsLabelString, attributedText: notificationSettingsLabelString,
accessibilityIdentifier: nil, accessibility: nil, // TODO: Add accessibility
type: .notificationSettings type: .notificationSettings
) )
) )
@ -199,7 +200,7 @@ final class ConversationTitleView: UIView {
attributedText: NSAttributedString( attributedText: NSAttributedString(
string: "\(userCount) member\(userCount == 1 ? "" : "s")" string: "\(userCount) member\(userCount == 1 ? "" : "s")"
), ),
accessibilityIdentifier: nil, accessibility: nil, // TODO: Add accessibility
type: .userCount type: .userCount
) )
) )
@ -210,7 +211,7 @@ final class ConversationTitleView: UIView {
attributedText: NSAttributedString( attributedText: NSAttributedString(
string: "\(userCount) active member\(userCount == 1 ? "" : "s")" string: "\(userCount) active member\(userCount == 1 ? "" : "s")"
), ),
accessibilityIdentifier: nil, accessibility: nil, // TODO: Add accessibility
type: .userCount type: .userCount
) )
) )
@ -247,7 +248,10 @@ final class ConversationTitleView: UIView {
labelInfos.append( labelInfos.append(
SessionLabelCarouselView.LabelInfo( SessionLabelCarouselView.LabelInfo(
attributedText: disappearingMessageSettingLabelString, attributedText: disappearingMessageSettingLabelString,
accessibilityIdentifier: "Disappearing messages type and time", accessibility: Accessibility(
identifier: "Disappearing messages type and time",
label: "Disappearing messages type and time"
),
type: .disappearingMessageSetting type: .disappearingMessageSetting
) )
) )

@ -23,7 +23,7 @@ final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
public struct LabelInfo { public struct LabelInfo {
let attributedText: NSAttributedString let attributedText: NSAttributedString
let accessibilityIdentifier: String? let accessibility: Accessibility?
let type: LabelType let type: LabelType
} }
@ -139,7 +139,8 @@ final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
label.themeTextColor = .textPrimary label.themeTextColor = .textPrimary
label.lineBreakMode = .byTruncatingTail label.lineBreakMode = .byTruncatingTail
label.attributedText = $0.attributedText label.attributedText = $0.attributedText
label.accessibilityIdentifier = $0.accessibilityIdentifier label.accessibilityIdentifier = $0.accessibility?.identifier
label.accessibilityLabel = $0.accessibility?.label
label.isAccessibilityElement = true label.isAccessibilityElement = true
wrapper.addSubview(label) wrapper.addSubview(label)
label.center(in: wrapper) label.center(in: wrapper)

Loading…
Cancel
Save