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

accessibility: welcome + about screens

Change-Id: I46d80a2242f872ca27daff48a76af5fa75c25218
parent 63f25d1b
No related branches found
No related tags found
No related merge requests found
...@@ -47,4 +47,5 @@ struct SmartListAccessibilityIdentifiers { ...@@ -47,4 +47,5 @@ struct SmartListAccessibilityIdentifiers {
static let contactPicker = "contactPicker" static let contactPicker = "contactPicker"
static let accountsListTitle = "accountsListTitle" static let accountsListTitle = "accountsListTitle"
static let closeAccountsList = "closeAccountsList" static let closeAccountsList = "closeAccountsList"
static let closeAboutView = "closeAboutView"
} }
...@@ -24,10 +24,25 @@ struct AboutSwiftUIView: View { ...@@ -24,10 +24,25 @@ struct AboutSwiftUIView: View {
let padding: CGFloat = 20 let padding: CGFloat = 20
var body: some View { var body: some View {
VStack(spacing: padding) { VStack(spacing: padding) {
ZStack {
HStack {
Spacer() // Push the close button to the right
CloseButton(
action: { [weak dismissHandler] in
dismissHandler?.dismissView()
},
accessibilityIdentifier: SmartListAccessibilityIdentifiers.closeAboutView
)
}
Image("jami_gnupackage") Image("jami_gnupackage")
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
.frame(height: 30) .frame(height: 30)
.accessibilityLabel(L10n.Accessibility.aboutJamiTitle)
.frame(maxWidth: .infinity, alignment: .center) // This will center the image horizontally
}
ScrollView { ScrollView {
VStack(alignment: .leading, spacing: padding) { VStack(alignment: .leading, spacing: padding) {
VStack(alignment: .center) { VStack(alignment: .center) {
...@@ -67,6 +82,7 @@ struct AboutSwiftUIView: View { ...@@ -67,6 +82,7 @@ struct AboutSwiftUIView: View {
.cornerRadius(8) .cornerRadius(8)
} }
} }
.padding(.horizontal)
HStack { HStack {
Spacer() Spacer()
Button(action: { Button(action: {
...@@ -82,7 +98,8 @@ struct AboutSwiftUIView: View { ...@@ -82,7 +98,8 @@ struct AboutSwiftUIView: View {
Text(model.feedbackLabel) Text(model.feedbackLabel)
}) })
} }
.padding(.horizontal)
} }
.padding() .padding(.vertical)
} }
} }
...@@ -29,6 +29,8 @@ internal enum L10n { ...@@ -29,6 +29,8 @@ internal enum L10n {
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 { internal enum Accessibility {
/// About Jami
internal static let aboutJamiTitle = L10n.tr("Localizable", "accessibility.aboutJamiTitle", fallback: "About Jami")
/// Close /// Close
internal static let close = L10n.tr("Localizable", "accessibility.close", fallback: "Close") internal static let close = L10n.tr("Localizable", "accessibility.close", fallback: "Close")
/// Add account /// Add account
...@@ -39,6 +41,8 @@ internal enum L10n { ...@@ -39,6 +41,8 @@ internal enum L10n {
} }
/// Switch account /// Switch account
internal static let smartListSwitchAccounts = L10n.tr("Localizable", "accessibility.smartListSwitchAccounts", fallback: "Switch account") internal static let smartListSwitchAccounts = L10n.tr("Localizable", "accessibility.smartListSwitchAccounts", fallback: "Switch account")
/// Welcome to Jami
internal static let welcomeToJamiTitle = L10n.tr("Localizable", "accessibility.welcomeToJamiTitle", fallback: "Welcome to Jami")
} }
internal enum Account { internal enum Account {
/// Account Status /// Account Status
......
...@@ -243,3 +243,23 @@ extension View { ...@@ -243,3 +243,23 @@ extension View {
self.modifier(OptionalListSectionSpacing(spacing: spacing)) self.modifier(OptionalListSectionSpacing(spacing: spacing))
} }
} }
struct CloseButton: View {
let action: () -> Void
let accessibilityIdentifier: String
var body: some View {
Button(action: {
action()
}, 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(accessibilityIdentifier)
.accessibilityLabel(L10n.Accessibility.close)
.padding()
})
}
}
...@@ -51,18 +51,10 @@ struct AccountLists: View { ...@@ -51,18 +51,10 @@ struct AccountLists: View {
HStack { HStack {
Spacer() // Pushes the button to the right Spacer() // Pushes the button to the right
Button(action: { CloseButton(
accountSelectedCallback() action: accountSelectedCallback,
}, label: { accessibilityIdentifier: SmartListAccessibilityIdentifiers.closeAccountsList
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()
})
} }
} }
......
...@@ -215,6 +215,8 @@ struct HeaderView: View { ...@@ -215,6 +215,8 @@ struct HeaderView: View {
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
.frame(height: 80) .frame(height: 80)
.accessibilityLabel(L10n.Accessibility.welcomeToJamiTitle)
.accessibilityHidden(true)
Text(L10n.Welcome.title) Text(L10n.Welcome.title)
.font(.headline) .font(.headline)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
...@@ -347,6 +349,7 @@ extension View { ...@@ -347,6 +349,7 @@ extension View {
.ignoresSafeArea() .ignoresSafeArea()
.scaledToFill() .scaledToFill()
.accessibilityIdentifier(AccessibilityIdentifiers.welcomeWindow) .accessibilityIdentifier(AccessibilityIdentifiers.welcomeWindow)
.accessibilityHidden(true)
) )
} }
} }
...@@ -510,3 +510,5 @@ ...@@ -510,3 +510,5 @@
"accessibility.smartListSwitchAccounts" = "Switch account"; "accessibility.smartListSwitchAccounts" = "Switch account";
"accessibility.smartListConnectedAs" = "Your current account is %@"; "accessibility.smartListConnectedAs" = "Your current account is %@";
"accessibility.smartListAddAccount" = "Add account"; "accessibility.smartListAddAccount" = "Add account";
"accessibility.aboutJamiTitle" = "About Jami";
"accessibility.welcomeToJamiTitle" = "Welcome to Jami";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment