Skip to content
Snippets Groups Projects
Commit 63f25d1b authored by Alexender White's avatar Alexender White Committed by Kateryna Kostiuk
Browse files

accessibility: accounts list

Change-Id: I6151c7cf3b795adc89855a008505cd7a35079e87
parent a221486b
Branches
No related tags found
No related merge requests found
......@@ -45,4 +45,6 @@ struct SmartListAccessibilityIdentifiers {
static let bookButton = "bookButtonIdentifier"
static let searchBarTextField = "searchBarTextField"
static let contactPicker = "contactPicker"
static let accountsListTitle = "accountsListTitle"
static let closeAccountsList = "closeAccountsList"
}
......@@ -28,6 +28,18 @@ internal enum L10n {
/// version 3 or later for details.
internal static let noWarranty2 = L10n.tr("Localizable", "aboutJami.noWarranty2", fallback: "version 3 or later for details.")
}
internal enum Accessibility {
/// Close
internal static let close = L10n.tr("Localizable", "accessibility.close", fallback: "Close")
/// Add account
internal static let smartListAddAccount = L10n.tr("Localizable", "accessibility.smartListAddAccount", fallback: "Add account")
/// Your current account is %@
internal static func smartListConnectedAs(_ p1: Any) -> String {
return L10n.tr("Localizable", "accessibility.smartListConnectedAs", String(describing: p1), fallback: "Your current account is %@")
}
/// Switch account
internal static let smartListSwitchAccounts = L10n.tr("Localizable", "accessibility.smartListSwitchAccounts", fallback: "Switch account")
}
internal enum Account {
/// Account Status
internal static let accountStatus = L10n.tr("Localizable", "account.accountStatus", fallback: "Account Status")
......
......@@ -33,7 +33,6 @@ struct AccountLists: View {
accountsView()
newAccountButton()
}
.accessibilityElement(children: .contain)
.accessibility(identifier: SmartListAccessibilityIdentifiers.accountListView)
.padding(.horizontal, 5)
}
......@@ -43,11 +42,35 @@ struct AccountLists: View {
VStack {
Spacer()
.frame(height: verticalSpacing)
ZStack {
Text(model.headerTitle)
.fontWeight(.semibold)
.accessibilityIdentifier(SmartListAccessibilityIdentifiers.accountsListTitle)
HStack {
Spacer() // Pushes the button to the right
Button(action: {
accountSelectedCallback()
}, label: {
Image(systemName: "xmark")
.font(.system(size: 12, weight: .bold))
.foregroundColor(.black)
.padding(10) // Increases tap area
.background(Circle().fill(Color.gray.opacity(0.4)))
.accessibilityIdentifier(SmartListAccessibilityIdentifiers.closeAccountsList)
.accessibilityLabel(L10n.Accessibility.close)
.padding()
})
}
}
Spacer()
.frame(height: verticalSpacing)
accountsList()
Spacer()
.frame(height: verticalSpacing)
}
......@@ -73,6 +96,7 @@ struct AccountLists: View {
.cornerRadius(cornerRadius)
.shadow(radius: shadowRadius)
.accessibility(identifier: SmartListAccessibilityIdentifiers.addAccountButton)
.accessibilityLabel(L10n.Accessibility.smartListAddAccount)
}
@ViewBuilder
......@@ -118,6 +142,8 @@ struct AccountRowView: View {
guard let model = model else { return }
model.changeCurrentAccount(accountId: accountRow.id)
}
.accessibilityElement()
.accessibilityLabel(accountRow.bestName)
}
private var isSelectedAccount: Bool {
......
......@@ -362,6 +362,8 @@ struct CurrentAccountButton: View {
}
Spacer()
}
.accessibilityLabel(L10n.Accessibility.smartListSwitchAccounts)
.accessibilityHint(L10n.Accessibility.smartListConnectedAs(model.bestName))
.transaction { transaction in
transaction.animation = nil
}
......
......@@ -504,3 +504,9 @@
"aboutJami.feedback" = "Feedback";
"aboutJami.createdBy" = "Created by";
"aboutJami.artworkBy" = "Artwork by";
// Accessibility
"accessibility.close" = "Close";
"accessibility.smartListSwitchAccounts" = "Switch account";
"accessibility.smartListConnectedAs" = "Your current account is %@";
"accessibility.smartListAddAccount" = "Add account";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment