8000 PM-10269: Add initial UI for set up unlock screen by matt-livefront · Pull Request #818 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PM-10269: Add initial UI for set up unlock screen #818

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 8000 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

matt-livefront
Copy link
Collaborator
@matt-livefront matt-livefront commented Aug 12, 2024

🎟️ Tracking

PM-10269

📔 Objective

Adds the initial UI for the set up unlock method screen as part of the create account flow. This isn't accessible in the app yet, but can be accessed by setting authCompletionRoute to .auth(.vaultUnlockSetup) in AppCoordinator. The functionality for enabling biometrics and pin unlock will come in a future PR.

📸 Screenshots

Screenshot 2024-08-12 at 2 11 29 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
Contributor
github-actions bot commented Aug 12, 2024

Logo
Checkmarx One – Scan Summary & Details81e9a997-a920-4561-9a99-bc50d3bceb21

No New Or Fixed Issues Found

Copy link
codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 96.94656% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.46%. Comparing base (793b8cf) to head (d83f5fb).
Report is 2 commits behind head on main.

Files Patch % Lines
...UI/Platform/Application/Views/PageHeaderView.swift 85.18% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #818      +/-   ##
==========================================
+ Coverage   88.42%   88.46%   +0.03%     
==========================================
  Files         596      600       +4     
  Lines       30093    30224     +131     
==========================================
+ Hits        26611    26738     +127     
- Misses       3482     3486       +4     

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

}

/// A key path for getting/setting whether the unlock method is turned on in the state.
var keyPath: WritableKeyPath<VaultUnlockSetupState, Bool> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious what the advantage is of using key paths here?

Copy link
Member

Choose a reason for hiding this comment

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

I'd say it avoids if/switch logic to get/set the unlock method so it's more direct to use.

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, exactly. You can implement both a get (state[keyPath: unlockMethod.keyPath]) and set (state[keyPath: unlockMethod.keyPath] = newValue) without having to implement the switch twice.


// MARK: - VaultUnlockSetupView

/// A view that allows the user to swipe through the intro carousel and then proceed to creating an
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update docs here?

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, thanks!

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.

Looks good, just one small improvement.

Comment on lines +74 to +86
/// The available unlock methods to show in the UI.
var unlockMethods: [UnlockMethod] {
let biometricsMethod: UnlockMethod? = if case let .available(type, _, _) = biometricsStatus {
switch type {
case .faceID: .faceID
case .touchID: .touchID
}
} else {
nil
}

return [biometricsMethod, .pin].compactMap { $0 }
}
Copy link
Member

Choose a reason for hiding this comment

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

🎨 IMO this is easier as:

Suggested change
/// The available unlock methods to show in the UI.
var unlockMethods: [UnlockMethod] {
let biometricsMethod: UnlockMethod? = if case let .available(type, _, _) = biometricsStatus {
switch type {
case .faceID: .faceID
case .touchID: .touchID
}
} else {
nil
}
return [biometricsMethod, .pin].compactMap { $0 }
}
/// The available unlock methods to show in the UI.
var unlockMethods: [UnlockMethod] {
guard case let .available(type, _, _) = biometricsStatus else {
return [.pin]
}
switch type {
case .faceID:
return [.faceID, .pin]
case .touchID:
return [.touchID, .pin]
}
}

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 ended up changing this slightly in my next PR, if you're ok with waiting on this until then.

Copy link
Member

Choose a reason for hiding this comment

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

Sure no problem.

@matt-livefront matt-livefront merged commit ffee02f into main Aug 13, 2024
8 checks passed
@matt-livefront matt-livefront deleted the matt/PM-10269-set-up-unlock branch August 13, 2024 14:41
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