Skip to content

Commit

Permalink
fix: use ColorTheme & implement specified accessibility labels
Browse files Browse the repository at this point in the history
  • Loading branch information
El-Fitz committed Nov 14, 2024
1 parent d257de0 commit 12300f5
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


import SwiftUI
import WireDesign
import WireFoundation
import WireReusableUIComponents

Expand All @@ -36,7 +37,7 @@ struct BackButton: View {
.frame(maxWidth: .infinity)
.overlay {
RoundedRectangle(cornerRadius: 16)
.stroke(.gray, lineWidth: 1)
.stroke(Color(uiColor: ColorTheme.Strokes.outline), lineWidth: 1)
}
.cornerRadius(16)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import SwiftUI
import WireDesign
import WireFoundation
import WireReusableUIComponents

Expand All @@ -31,11 +32,11 @@ struct CallToActionButton: View {
action: action,
label: { Text(title) }
)
.foregroundStyle(isEnabled ? .white : .primary)
.foregroundStyle(Color(uiColor: isEnabled ? ColorTheme.Buttons.Primary.onEnabled : ColorTheme.Buttons.Primary.onDisabled))
.wireTextStyle(.buttonBig)
.frame(height: 56)
.frame(maxWidth: .infinity)
.background(isEnabled ? AccentColor.blue.color : .gray)
.background(Color(uiColor: isEnabled ? ColorTheme.Buttons.Primary.enabled : ColorTheme.Buttons.Primary.disabled))
.cornerRadius(16)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import SwiftUI
import WireDesign

struct Checkbox: View {
@Binding var isChecked: Bool
Expand All @@ -41,11 +42,11 @@ struct Checkbox: View {
if isChecked {
Image(systemName: "checkmark.square.fill")
.font(.system(size: 24))
.foregroundStyle(.blue)
.foregroundStyle(Color(uiColor: ColorTheme.Buttons.Primary.enabled))
} else {
Image(systemName: "square")
.font(.system(size: 24))
.backgroundStyle(.gray)
.backgroundStyle(Color(uiColor: ColorTheme.Buttons.Secondary.disabled))
}
})
.buttonStyle(.plain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct PageContainer<Content: View>: View {
VStack {
Text(String.formated(key: "individualToTeam.progressCount", bundle: .module, step, stepCount))
.wireTextStyle(.subline1)
.foregroundStyle(.gray)
.foregroundStyle(Color(uiColor: ColorTheme.Base.secondaryText))
Spacer()
.frame(height: 12)
Text(stepTitle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import SwiftUI
import UIKit
import WireDesign
import WireDomainAPI

class IndividualToTeamMigrationViewController: UIViewController {
Expand All @@ -36,6 +37,19 @@ class IndividualToTeamMigrationViewController: UIViewController {
}
}

var closeButtonAccessibilityLabel: String {
switch self {
case .teamPlanSelection:
return .localizedAccessibilityLabel(key: "individualToTeam.planSelection.closeButton.accessibilityLabel", bundle: .module)
case .teamName:
return .localizedAccessibilityLabel(key: "individualToTeam.teamName.closeButton.accessibilityLabel", bundle: .module)
case .confirmation:
return .localizedAccessibilityLabel(key: "individualToTeam.confirmation.closeButton.accessibilityLabel", bundle: .module)
case .completion:
return .localizedAccessibilityLabel(key: "individualToTeam.completion.closeButton.accessibilityLabel", bundle: .module)
}
}

private var titleStringKey: String.LocalizationValue {
switch self {
case .teamPlanSelection:
Expand Down Expand Up @@ -171,15 +185,15 @@ private func hostedView(
)
)
vc.title = step.title
vc.navigationItem.rightBarButtonItem = UIBarButtonItem(
image: UIImage(systemName: "xmark"),
style: .plain,
target: target,
action: #selector(IndividualToTeamMigrationViewController.onDismissTapped)
vc.navigationItem.rightBarButtonItem = UIBarButtonItem.closeButton(
action: UIAction { _ in
transitionCallback(.toCancellationAlert)
},
accessibilityLabel: step.closeButtonAccessibilityLabel
)
// Hide navigation bar title
vc.navigationItem.titleView = UIView()
vc.navigationItem.rightBarButtonItem?.tintColor = .darkText
vc.navigationItem.rightBarButtonItem?.tintColor = ColorTheme.Backgrounds.onBackground
return vc
}
@MainActor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
{
"sourceLanguage" : "en",
"strings" : {

"individualToTeam.completion.closeButton.accessibilityLabel" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Close team created view"
}
}
}
},
"individualToTeam.confirmation.closeButton.accessibilityLabel" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Close confirmation view"
}
}
}
},
"individualToTeam.planSelection.closeButton.accessibilityLabel" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Close team account overview"
}
}
}
},
"individualToTeam.teamName.closeButton.accessibilityLabel" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Close team name view"
}
}
}
}
},
"version" : "1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
}
}
}
},
"individualToTeam.completion.closeButton.accessibilityLabel" : {

},
"individualToTeam.completion.headline" : {
"extractionState" : "manual",
Expand Down Expand Up @@ -135,6 +138,9 @@
}
}
}
},
"individualToTeam.confirmation.closeButton.accessibilityLabel" : {

},
"individualToTeam.confirmation.passwordField.forgotPassword" : {
"extractionState" : "manual",
Expand Down Expand Up @@ -201,6 +207,9 @@
}
}
}
},
"individualToTeam.planSelection.closeButton.accessibilityLabel" : {

},
"individualToTeam.planSelection.feature.adminConsole" : {
"extractionState" : "manual",
Expand Down Expand Up @@ -311,6 +320,9 @@
}
}
}
},
"individualToTeam.teamName.closeButton.accessibilityLabel" : {

},
"individualToTeam.teamName.field.placeholder" : {
"extractionState" : "manual",
Expand Down
6 changes: 5 additions & 1 deletion WireUI/Sources/WireIndividualToTeamMigrationUI/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ extension String {
String(format: .localized(key: key, bundle: bundle), arguments)
}

static func localizedAccessibilityLabel(key: String.LocalizationValue, bundle: Bundle? = nil) -> String {
String(localized: key, table: "Accessibility", bundle: bundle)
}

static func localized(key: String.LocalizationValue, bundle: Bundle? = nil) -> String {
String(localized: key, bundle: bundle)
String(localized: key, table: "Localizable", bundle: bundle)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public extension UIBarButtonItem {
///
/// - Returns: A UIBarButtonItem configured as a close button.
static func closeButton(action: UIAction, accessibilityLabel: String) -> UIBarButtonItem {
// Uses the sf symbol instead of the image that does not exist in the WireDesign module.
// let closeImage = UIImage(systemName: "xmark")
let closeImage = UIImage(named: "Close")

let closeItem = UIBarButtonItem(title: accessibilityLabel, primaryAction: action)
Expand Down

0 comments on commit 12300f5

Please sign in to comment.