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 15, 2024
1 parent 679ef0d commit 7ebdca4
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


Check failure on line 19 in WireUI/Sources/WireIndividualToTeamMigrationUI/Components/BackButton.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Limit vertical whitespace to a single empty line; currently 2 (vertical_whitespace)
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)

Check warning on line 43 in WireUI/Sources/WireIndividualToTeamMigrationUI/IndividualToTeamMigrationViewController.swift

View workflow job for this annotation

GitHub Actions / SwiftFormat

Remove unneeded return keyword. (redundantReturn)
case .teamName:
return .localizedAccessibilityLabel(key: "individualToTeam.teamName.closeButton.accessibilityLabel", bundle: .module)

Check warning on line 45 in WireUI/Sources/WireIndividualToTeamMigrationUI/IndividualToTeamMigrationViewController.swift

View workflow job for this annotation

GitHub Actions / SwiftFormat

Remove unneeded return keyword. (redundantReturn)
case .confirmation:
return .localizedAccessibilityLabel(key: "individualToTeam.confirmation.closeButton.accessibilityLabel", bundle: .module)

Check warning on line 47 in WireUI/Sources/WireIndividualToTeamMigrationUI/IndividualToTeamMigrationViewController.swift

View workflow job for this annotation

GitHub Actions / SwiftFormat

Remove unneeded return keyword. (redundantReturn)
case .completion:
return .localizedAccessibilityLabel(key: "individualToTeam.completion.closeButton.accessibilityLabel", bundle: .module)

Check warning on line 49 in WireUI/Sources/WireIndividualToTeamMigrationUI/IndividualToTeamMigrationViewController.swift

View workflow job for this annotation

GitHub Actions / SwiftFormat

Remove unneeded return keyword. (redundantReturn)
}
}

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)
}
}

0 comments on commit 7ebdca4

Please sign in to comment.