8000 [PM-16573] Tweak Two-Factor Notice design by KatherineInCode · Pull Request #1234 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[PM-16573] Tweak Two-Factor Notice design #1234

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 19 commits into from
Jan 6, 2025

Conversation

KatherineInCode
Copy link
Contributor
@KatherineInCode KatherineInCode commented Jan 2, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-16573

📔 Objective

This addresses a number of issues raised during design review on the Two-Factor notice added for PM-8216. In the process, I stopped using the PageHeaderView because there were enough differences in sizes—particularly on the "set up two-factor" screen—that it would have made that view take a lot of parameters, and it ultimately made more sense to me to just build it bespoke for each screen to accommodate the specifics of each.

📸 Screenshots

Simulator Screenshot - iPhone 16 Pro - 2025-01-02 at 15 35 41

Simulator Screenshot - iPhone 16 Pro - 2025-01-02 at 15 35 45

⏰ 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

@KatherineInCode
Copy link
Contributor Author

Tests are currently failing pending #1235

@KatherineInCode KatherineInCode marked this pull request as ready for review January 2, 2025 22:06
Comment on lines 23 to 31
// Despite the image being 96x96, the actual dimensions of the
// illustration within that are 96x72 (4:3).
// So to make how it interacts with other elements correct,
// we have to apply negative padding equal to 1/8 of the width
// to both top and bottom, thus making the image the "correct" size
Asset.Images.Illustrations.userLock.swiftUIImage
.resizable()
.frame(width: 124, height: 124)
.padding(.vertical, -15.5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ I could be missing something, but isn't the 24 points of spacing in the designs from the bottom of the image (including the padding in the image), not from the bottom of the person in the image? Or is the negative padding serving a different purpose?

Screenshot 2025-01-02 at 5 13 27 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How are you getting those numbers indicating the distance? I've been messing with Figma forever to get something like those, to no avail

I was going off of this comment in the design review, which to me implied that the padding was meant to be between the bottom of the illustration itself, not the full square of it:

Screenshot 2025-01-03 at 8 22 42 AM

Copy link
Collaborator

Choose a reason for hiding this comment

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

Figma makes this more difficult than it should be 😒. If you select an element, hold down option (⌥), and move your cursor to another element, it will show the red spacing amounts.

Copy link
Contributor Author
@KatherineInCode KatherineInCode Jan 3, 2025

Choose a reason for hiding this comment

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

Aha! Yeah, I totally missed that :(

I can adjust it to be 24 from the square-image, though I think I still want to keep the handling of rotation bespoke rather than futzing with making the PageHeaderView dynamic to accommodate all the differences it has from this design. (Though a question to bring back to Design might be, do we want to unify these values across the app, as we have these screens, and then the intro carousel, and then the places where PageHeaderView are being used, which all are doing essentially the same thing, just with different values and sizes, and should they actually all be the same?)

Copy link
Member
@fedemkr fedemkr Jan 3, 2025

Choose a reason for hiding this comment

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

🤔 IMO we should always try to use PageHeaderView for these kind of layouts so we reuse as much code as we can that then it's much easier to maintain and change in several places at the same time if another reskin/revamp happens in the future.
Ideally, I'd think the view to be the same everywhere we use it in the app so I'd definitely bring this up to design to see if we can apply the change to all the places it's currently used.
However, if design wants to have different "flavors" of this header to accommodate better the controls depending on the actual view/context then we could have different "modes" or "layout types" the PageHeaderView can adjust to; although I would prefer to have only one.

🤔 Regarding the image and its padding, I would prefer padding to depend on the control and not the image being used whenever possible. If the image file has some odd padding internally I'd ask design if they can provide the same image with the padding adjusted so we can apply the same margin Figma shows without having to consider anything regarding the image itself for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hah, for whatever reason I didn't even think of making it PageHeaderView "modes", and was wanting to make all the different things configurable 🙃 I can even see if I can make it work like our general style guide handling, now

I agree, moving it then to having different modes there is the way to go—and then in the future that will make it easier to evaluate and decide if we actually want to shift to just having one of them, in one place.

Regarding the image and its padding

Good point. I can adjust.

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

Logo
Checkmarx One – Scan Summary & Details9cb77bd6-e11f-4a7c-b8ce-14fbfc952be0

No New Or Fixed Issues Found

Copy link
codecov bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 95.94595% with 3 lines in your changes missing coverage. Please review.

Project coverage is 89.66%. Comparing base (5e3d807) to head (b3ca2ec).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...UI/Platform/Application/Views/PageHeaderView.swift 88.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1234      +/-   ##
==========================================
- Coverage   89.66%   89.66%   -0.01%     
==========================================
  Files         718      719       +1     
  Lines       45428    45429       +1     
==========================================
  Hits        40732    40732              
- Misses       4696     4697       +1     

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

matt-livefront
matt-livefront previously approved these changes Jan 6, 2025
Comment on lines 129 to 131
/// An `OrientationBasedValue` encapsulates values that might be different
/// for rendering based on orientation, such as image size or space between text.
struct OrientationBasedValue<T: Equatable & Sendable>: Equatable, Sendable {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@KatherineInCode
Copy link
Contributor Author

@fedemkr There was a conflict with the changes you had made to the PageHeaderView, and this has a pretty significant re-work of how the styling there works, if you want to take a look

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.

Great job I love the new page header styles 🎉 ! Just a few tiny comments.

Comment on lines +35 to +37
.if(style.imageColor != nil) { view in
return view.foregroundStyle(style.imageColor!)
}
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Could force unwrapping be avoided here somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried doing a guard let for it, but ran into issues with trying to return view out of the else block. There might be some other way to do this better, though; this was just the one I was able to find.


/// An `OrientationBasedValue` encapsulates values that might be different
/// for rendering based on orientation, such as image size or space between text.
struct OrientationBasedValue<T: Equatable & Sendable>: Equatable, Sendable {
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Love this! And could this OrientationBasedValue struct be extracted to its own file in Platform folder? I see its potential to be reused on other components/views as well.
🤔 Could we have a convenience init to fill portrait and landscape with the same value just by passing one argument? So we don't have to repeat them and is easier to set up, like in largeTextTintedIcon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦🏼‍♀️ I meant at some point to potentially pull some of these out into their own files, yeah. That one seems an obvious candidate for it.

I like the idea for a convenience init! I can get on that!

@KatherineInCode KatherineInCode enabled auto-merge (squash) January 6, 2025 20:27
@KatherineInCode KatherineInCode merged commit 9e8aaf5 into main Jan 6, 2025
7 checks passed
@KatherineInCode KatherineInCode deleted the pm-16573/tweak-tfa-notice-design branch January 6, 2025 20:35
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