8000 PM-17413: Update policy banner design by matt-livefront · Pull Request #1303 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PM-17413: Update policy banner design #1303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
.multilineTextAlignment(.leading)

if store.state.resetPasswordAutoEnroll {
InfoContainer(Localizations.resetPasswordAutoEnrollInviteWarning, textAlignment: .leading)
InfoContainer(Localizations.resetPasswordAutoEnrollInviteWarning)
}

if let policy = store.state.masterPasswordPolicy,
policy.isInEffect,
let policySummary = policy.policySummary {
InfoContainer(policySummary, textAlignment: .leading)
InfoContainer(policySummary)

Check warning on line 28 in BitwardenShared/UI/Auth/SetMasterPassword/SetMasterPasswordView.swift

View check run for this annotation

Codecov / codecov/patch

BitwardenShared/UI/Auth/SetMasterPassword/SetMasterPasswordView.swift#L28

Added line #L28 was not covered by tests
}

BitwardenTextField(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct UpdateMasterPasswordView: View {
if let policy = store.state.masterPasswordPolicy,
policy.isInEffect,
let policySummary = policy.policySummary {
InfoContainer(policySummary, textAlignment: .leading)
InfoContainer(policySummary)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class UpdateMasterPasswordViewTests: BitwardenTestCase {
processor.state.forcePasswordResetReason = .adminForcePasswordReset
assertSnapshots(
of: subject,
as: [.portrait(heightMultiple: 1.25)]
as: [.portraitDark(heightMultiple: 1.25)]
)
}

Expand Down Expand Up @@ -175,7 +175,7 @@ class UpdateMasterPasswordViewTests: BitwardenTestCase {
processor.state.forcePasswordResetReason = .weakMasterPasswordOnLogin
assertSnapshots(
of: subject,
as: [.portrait(heightMultiple: 1.25)]
as: [.portraitDark(heightMultiple: 1.25)]
)
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x27",
"green" : "0x1A",
"red" : "0x12"
"blue" : "0x46",
"green" : "0x39",
"red" : "0x30"
}
},
"idiom" : "universal"
Expand Down
50 changes: 11 additions & 39 deletions BitwardenShared/UI/Platform/Application/Views/InfoContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,43 @@
/// The content to display in the container.
let content: Content

/// Returns an `Alignment` for the content's frame alignment based on the environment's
/// multiline text alignment.
var contentAlignment: Alignment {
switch textAlignment {
case .center:
Alignment.center
case .leading:
Alignment.leading
case .trailing:
Alignment.trailing
}
}

/// The text alignment to apply to the view.
let textAlignment: TextAlignment

// MARK: View

var body: some View {
content
.foregroundStyle(Asset.Colors.textSecondary.swiftUIColor)
.frame(maxWidth: .infinity, alignment: contentAlignment)
.multilineTextAlignment(textAlignment)
.foregroundStyle(Asset.Colors.textPrimary.swiftUIColor)
.frame(maxWidth: .infinity, alignment: .leading)
.multilineTextAlignment(.leading)
.styleGuide(.callout)
.padding(16)
.overlay {
RoundedRectangle(cornerRadius: 4)
.strokeBorder(Asset.Colors.strokeBorder.swiftUIColor)
}
.background(Asset.Colors.backgroundTertiary.swiftUIColor)
.cornerRadius(8)
}

// MARK: Initialization

/// Initialize a new info container.
///
/// - Parameters:
/// - textAlignment: The text alignment to apply to the view.
/// - content: The content to display in the container.
/// - Parameter content: The content to display in the container.
///
init(
textAlignment: TextAlignment = .center,
@ViewBuilder content: () -> Content
) {
init(@ViewBuilder content: () -> Content) {

Check warning on line 30 in BitwardenShared/UI/Platform/Application/Views/InfoContainer.swift

View check run for this annotation

Codecov / codecov/patch

BitwardenShared/UI/Platform/Application/Views/InfoContainer.swift#L30

Added line #L30 was not covered by tests
self.content = content()
self.textAlignment = textAlignment
}

/// Initialize a new info container that displays text content.
///
/// - Parameters:
/// - text: The text message to display in the container.
/// - textAlignment: The text alignment to apply to the view.
/// - Parameter text: The text message to display in the container.
///
init(
_ text: String,
textAlignment: TextAlignment = .center
) where Content == Text {
init(_ text: String) where Content == Text {
content = Text(text)
self.textAlignment = textAlignment
}
}

// MARK: - Previews

#Preview {
InfoContainer("Hello!")
.padding()
}

#Preview {
Expand All @@ -83,4 +54,5 @@
Text("Info")
}
}
.padding()
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private struct VaultItemSelectionSearchableView: View {
@ViewBuilder
private func matchingItemsView() -> some View {
VStack(spacing: 16) {
InfoContainer(Localizations.addTheKeyToAnExistingOrNewItem, textAlignment: .leading)
InfoContainer(Localizations.addTheKeyToAnExistingOrNewItem)

ForEach(store.state.vaultListSections) { section in
VaultListSectionView(section: section) { item in
Expand Down
0