8000 PM-12565: Don't fail login if setting account setup progress fails by matt-livefront · Pull Request #988 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PM-12565: Don't fail login if setting account setup progress fails #988

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 1 commit into from
Sep 30, 2024

Conversation

matt-livefront
Copy link
Collaborator
@matt-livefront matt-livefront commented Sep 30, 2024

🎟️ Tracking

PM-12565

📔 Objective

This addresses a comment @fedemkr made here: https://github.com/bitwarden/ios/pull/972/files#r1777654377

If setting the user's account setup progress fails as part of login, we should log the error rather than throw which would cause the login to fail.

⏰ 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

Logo
Checkmarx One – Scan Summary & Details6c32f0a2-53d7-406d-8f25-2c9d473a6163

No New Or Fixed Issues Found

func getAccountSetupAutofill(userId: String?) async throws -> AccountSetupProgress?
func getAccountSetupAutofill(userId: String) async -> AccountSetupProgress?
Copy link
Collaborator Author
@matt-livefront matt-livefront Sep 30, 2024

Choose a reason for hiding this comment

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

This is a slight change to the pattern that exists in StateService.

Our current pattern is that the protocol defines a throwing function which takes an optional userId. If the user ID parameter is nil, then we get the active user ID. And then we have an extension method which doesn't accept any parameters to essentially provide a default value of nil as the user ID to get the active user ID.

If we instead move the "default to ac 8000 tive user ID" logic into the extension method, we could make the protocol method require a user ID and in most cases make it not throw.

This won't affect most places where we call the extension method without a user ID. But in cases where we already have the user ID (some service/repository methods), we could avoid throwing. If we like this pattern, I can update the rest of StateService to match.

Copy link
Member

Choose a reason for hiding this comment

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

Awesome! I really like the approach but I wouldn't perform the changes right now. We're working on a proposal to reduce most of the boilerplate in StateService and AppSettingsStore, so reducing the effort to maintain the code and tests. So I'll add this there and share the proposal with you as well to revise it if you agree.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good, thanks!

Copy link
codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.81%. Comparing base (c20c8b3) to head (217ba25).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #988      +/-   ##
==========================================
+ Coverage   88.77%   88.81%   +0.04%     
==========================================
  Files         638      641       +3     
  Lines       40129    40217      +88     
==========================================
+ Hits        35625    35720      +95     
+ Misses       4504     4497       -7     

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

func getAccountSetupAutofill(userId: String?) async throws -> AccountSetupProgress?
func getAccountSetupAutofill(userId: String) async -> AccountSetupProgress?
Copy link
Member

Choose a reason for hiding this comment

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

Awesome! I really like the approach but I wouldn't perform the changes right now. We're working on a proposal to reduce most of the boilerplate in StateService and AppSettingsStore, so reducing the effort to maintain the code and tests. So I'll add this there and share the proposal with you as well to revise it if you agree.

@matt-livefront matt-livefront merged commit 8e7b9ef into main Sep 30, 2024
9 checks passed
@matt-livefront matt-livefront deleted the matt/PM-12565-settings-badges branch September 30, 2024 20:44
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