8000 PM-13885: Handle empty vault after import logins by matt-livefront · Pull Request #1064 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PM-13885: Handle empty vault after import logins #1064

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 2 commits into from
Oct 22, 2024

Conversation

matt-livefront
Copy link
Collaborator
@matt-livefront matt-livefront commented Oct 21, 2024

🎟️ Tracking

PM-13885

📔 Objective

This handles the case where a user navigates through the import login flow and after syncing, the user's vault is still empty. An alert is shown asking the user if they want to try again or import logins later.

📸 Screenshots

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-10-21.at.16.23.53.mp4

⏰ 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 Oct 21, 2024

Logo
Checkmarx One – Scan Summary & Details582bc264-61d0-4f10-9db1-389fe75ab54b

No New Or Fixed Issues Found

Copy link
codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.36%. Comparing base (8bcb21f) to head (eb522c7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1064   +/-   ##
=======================================
  Coverage   89.35%   89.36%           
=======================================
  Files         672      672           
  Lines       42253    42291   +38     
=======================================
+ Hits        37755    37793   +38     
  Misses       4498     4498           

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

Comment on lines 1051 to 1053
func isVaultEmpty() async throws -> Bool {
try await cipherService.fetchAllCiphers().isEmpty
}
Copy link
Member

Choose a reason for hiding this comment

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

🤔 I think fetching all ciphers just to know if they are empty may have a big memory overhead and "slow" performance, specially on large vaults. We could just use countForFetchRequest on the data store and check the count which is much faster and memory efficient than fetching objects.

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 suggestion! Updated to use the count.

Base automatically changed from matt/PM-13467-settings-import-login-card to main October 22, 2024 17:41
@matt-livefront matt-livefront force-pushed the matt/PM-13885-import-logins-empty branch from 1b90583 to eb522c7 Compare October 22, 2024 17:48
@matt-livefront matt-livefront marked this pull request as ready for review October 22, 2024 17:49
@@ -62,6 +68,13 @@ protocol CipherDataStore: AnyObject {
}

extension DataStore: CipherDataStore {
func cipherCount(userId: String) async throws -> Int {
try await backgroundContext.perform {
Copy link
Collaborator
@phil-livefront phil-livefront Oct 22, 2024

Choose a reason for hiding this comment

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

🤔 is this block safe to have a strong self because its using the backgroundContext within itself? that might be a dumb question so feel free to ignore me haha

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is safe because it's a short-lived closure. The context is going to perform the closure and then immediately return, releasing the self/backgroundContext reference.

@matt-livefront matt-livefront merged commit cee1ad4 into main Oct 22, 2024
10 checks passed
@matt-livefront matt-livefront deleted the matt/PM-13885-import-logins-empty branch October 22, 2024 20:23
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