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
Tags
No related merge requests found
...@@ -45,4 +45,6 @@ struct SmartListAccessibilityIdentifiers { ...@@ -45,4 +45,6 @@ struct SmartListAccessibilityIdentifiers {
static let bookButton = "bookButtonIdentifier" static let bookButton = "bookButtonIdentifier"
static let searchBarTextField = "searchBarTextField" static let searchBarTextField = "searchBarTextField"
static let contactPicker = "contactPicker" static let contactPicker = "contactPicker"
static let accountsListTitle = "accountsListTitle"
static let closeAccountsList = "closeAccountsList"
} }
...@@ -28,6 +28,18 @@ internal enum L10n { ...@@ -28,6 +28,18 @@ internal enum L10n {
/// version 3 or later for details. /// version 3 or later for details.
internal static let noWarranty2 = L10n.tr("Localizable", "aboutJami.noWarranty2", fallback: "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 { internal enum Account {
/// Account Status /// Account Status
internal static let accountStatus = L10n.tr("Localizable", "account.accountStatus", fallback: "Account Status") internal static let accountStatus = L10n.tr("Localizable", "account.accountStatus", fallback: "Account Status")
......
...@@ -33,7 +33,6 @@ struct AccountLists: View { ...@@ -33,7 +33,6 @@ struct AccountLists: View {
accountsView() accountsView()
newAccountButton() newAccountButton()
} }
.accessibilityElement(children: .contain)
.accessibility(identifier: SmartListAccessibilityIdentifiers.accountListView) .accessibility(identifier: SmartListAccessibilityIdentifiers.accountListView)
.padding(.horizontal, 5) .padding(.horizontal, 5)
} }
...@@ -43,11 +42,35 @@ struct AccountLists: View { ...@@ -43,11 +42,35 @@ struct AccountLists: View {
VStack { VStack {
Spacer() Spacer()
.frame(height: verticalSpacing) .frame(height: verticalSpacing)
Text(model.headerTitle)
.fontWeight(.semibold) 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() Spacer()
.frame(height: verticalSpacing) .frame(height: verticalSpacing)
accountsList() accountsList()
Spacer() Spacer()
.frame(height: verticalSpacing) .frame(height: verticalSpacing)
} }
...@@ -73,6 +96,7 @@ struct AccountLists: View { ...@@ -73,6 +96,7 @@ struct AccountLists: View {
.cornerRadius(cornerRadius) .cornerRadius(cornerRadius)
.shadow(radius: shadowRadius) .shadow(radius: shadowRadius)
.accessibility(identifier: SmartListAccessibilityIdentifiers.addAccountButton) .accessibility(identifier: SmartListAccessibilityIdentifiers.addAccountButton)
.accessibilityLabel(L10n.Accessibility.smartListAddAccount)
} }
@ViewBuilder @ViewBuilder
...@@ -118,6 +142,8 @@ struct AccountRowView: View { ...@@ -118,6 +142,8 @@ struct AccountRowView: View {
guard let model = model else { return } guard let model = model else { return }
model.changeCurrentAccount(accountId: accountRow.id) model.changeCurrentAccount(accountId: accountRow.id)
} }
.accessibilityElement()
.accessibilityLabel(accountRow.bestName)
} }
private var isSelectedAccount: Bool { private var isSelectedAccount: Bool {
......
...@@ -362,6 +362,8 @@ struct CurrentAccountButton: View { ...@@ -362,6 +362,8 @@ struct CurrentAccountButton: View {
} }
Spacer() Spacer()
} }
.accessibilityLabel(L10n.Accessibility.smartListSwitchAccounts)
.accessibilityHint(L10n.Accessibility.smartListConnectedAs(model.bestName))
.transaction { transaction in .transaction { transaction in
transaction.animation = nil transaction.animation = nil
} }
......
...@@ -504,3 +504,9 @@ ...@@ -504,3 +504,9 @@
"aboutJami.feedback" = "Feedback"; "aboutJami.feedback" = "Feedback";
"aboutJami.createdBy" = "Created by"; "aboutJami.createdBy" = "Created by";
"aboutJami.artworkBy" = "Artwork 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