8000 PM-16900: Update form card style for vault by matt-livefront · Pull Request #1291 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PM-16900: Update form card style for vault #1291

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 14 commits into from
Jan 28, 2025

Conversation

matt-livefront
Copy link
Collaborator
@matt-livefront matt-livefront commented Jan 21, 2025

🎟️ Tracking

PM-16900

📔 Objective

Updates the card style background within the vault views along with a few other tweaks to match the updated designs.

  • Added BitwardenBorderlessButtonStyle for styling buttons displayed in a footer of a card.
  • Added FieldLabelIconButtonStyle for styling icon buttons displayed in a field label within a card.
  • Updated BitwardenField and BitwardenTextField to support generic content in their footers.
  • Updated BitwardenToggle to support generic content in the title.

📸 Screenshots

Add login:

Before After
Screenshot 2025-01-21 at 2 12 21 PM Screenshot 2025-01-21 at 2 10 21 PM

View login:

Before After
Screenshot 2025-01-21 at 2 12 30 PM Screenshot 2025-01-21 at 2 10 31 PM

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 94.33107% with 25 lines in your changes missing coverage. Please review.

Project coverage is 89.46%. Comparing base (06bc893) to head (29f6954).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...latform/Application/Views/BitwardenTextField.swift 69.23% 12 Missing ⚠️
...UI/Platform/Application/Views/BitwardenField.swift 85.71% 7 Missing ⚠️
.../AddEditCustomFields/AddEditCustomFieldsView.swift 91.66% 2 Missing ⚠️
...itItem/AddEditLoginItem/AddEditLoginItemView.swift 96.22% 2 Missing ⚠️
...Vault/VaultItem/ViewItem/ViewItemDetailsView.swift 95.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1291      +/-   ##
==========================================
- Coverage   89.47%   89.46%   -0.02%     
==========================================
  Files         742      745       +3     
  Lines       46651    46814     +163     
==========================================
+ Hits        41740    41880     +140     
- Misses       4911     4934      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor
github-actions bot commented Jan 21, 2025

Logo
Checkmarx One – Scan Summary & Detailsa3dc0f36-b41f-4309-a122-1b937d4642c8

Great job, no security vulnerabilities found in this Pull Request

Copy link
Contributor
@KatherineInCode KatherineInCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good! Just a few questions and a potential issue with copy.

@@ -85,6 +85,14 @@ extension StyleGuideFont {
/// The font for the subheadline style.
static let subheadline = StyleGuideFont.dmSans(lineHeight: 16, size: 12, textStyle: .subheadline)

/// The font for the subheadline semibold style.
static let subheadlineSemibold = StyleGuideFont(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Should this be added to the preview below (and therefore the snapshot tests)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

< 8000 p class="mb-3"> The reason will be displayed to describe this comment to others. Learn more.

While it's not exactly the same, the subheadline semibold font itself is already captured here:

Text("Subheadline")
.styleGuide(.subheadline, weight: .semibold)

We could consider also adding subheadlineSemibold, but it doesn't quite align as well - how would you differentiate .styleGuide(.subheadline, weight: .semibold) vs .styleGuide(.subheadlineSemibold)?

I would prefer to not have to specify bold, semibold, etc styles and instead rely on .fontWeight() to specify the weight. But .fontWeight() can only be applied to Text instances rather than a View instance (before iOS 16). So for most cases you can use .styleGuide(.subheadline, weight: .semibold). But if you want to apply the style to a group of views, or in a button style then this subheadlineSemibold style is needed. So hopefully these extra styles can go away at some point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, that makes sense.


/// The style for a borderless button in this application.
///
struct BitwardenBorderlessButtonStyle: ButtonStyle {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Just like we have a snapshot test that has all the different font styles, are we getting to the point where it might make sense to have a preview and attendant snapshot test to showcase all the different button styles?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's an interesting idea!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a snapshot test here, let me know if that's what you had in mind!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! 👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ This text says "select Add TOTP" but there is no "Add TOTP" button to tap; should this copy be adjusted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Member
@fedemkr fedemkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just some improvements. And there seems to be several lines missing tests regarding Codecov but I'll leave that up to you as to whether they are trivial so we can miss them.

Comment on lines 88 to 95
/// The font for the subheadline semibold style.
static let subheadlineSemibold = StyleGuideFont(
font: FontFamily.DMSans.semiBold,
lineHeight: 16,
size: 12,
textStyle: .subheadline
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 What do you think about having special functions that alter some properties from the base font style guide creating a new one? Like in this case instead of building/specifying the whole style guide again we could take subheadline and just apply the font change to be semi bold. I'd think something like:

    /// The font for the subheadline semibold style.
    static let subheadlineSemibold = subheadline.with(font: FontFamily.DMSans.semiBold)
    
    // ---- And in extension StyleGuideFont ----
    
    /// Returns a new `StyleGuideFont` with same properties but different font.
    func with(font: SwiftUI.Font) -> StyleGuideFont {
        StyleGuideFont(
            font: font,
            lineHeight: lineHeight,
            size: size,
            textStyle: textStyle
        )
    }

Then if subheadline size changes at some UI update, the semibold style will be updated as well automatically.
We could apply the same approach to ...bold styles in here as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good idea!

628C
init(
title: String? = nil,
titleAccessibilityIdentifier: String? = nil,
verticalPadding: CGFloat = 8,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I see verticalPadding not being used in this view, should the property/parameter be removed or should it be used in the contentView?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's not used, I removed it.

Text(Localizations.enterKeyManually)
.styleGuide(.title2, weight: .semibold)

Text(Localizations.onceTheKeyIsSuccessfullyEntered)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This localization needs to be updated as it indicates "Add TOTP" should be pressed instead of "Save".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Shouldn't the custom field "Text empty" occupy the whole width?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good catch.

@@ -680,7 +680,7 @@
"EnterKeyManually" = "Enter key manually";
"AddTotp" = "Add TOTP";
"SetupTotp" = "Set up TOTP";
"OnceTheKeyIsSuccessfullyEntered" = "Once the key is successfully entered, select Add TOTP to store the key safely";
"OnceTheKeyIsSuccessfullyEntered" = "Once the key is successfully entered, select Save to store the key safely.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Given that the Key is not changing, we need to manually let Crowdin know the content changed so translations can be updated. I'll raise this in the meeting to discuss an approach to this. But I guess we should tag it in the Jira ticket so then someone can manually specify this in Crowdin.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Crowdin do that automatically? I feel like we've changed a few other strings lately and it ends up resetting all of the localized versions of that string. Unless someone is manually doing that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the meeting we'll check this but I think this PR can be directly merged in the meantime; and also we could check in future Crowdin syncs if this string is updated as a proof of how it's working now.

@matt-livefront matt-livefront merged commit 142b5e8 into main Jan 28, 2025
9 checks passed
@matt-livefront matt-livefront deleted the matt/PM-16900-form-style-vault branch January 28, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0