-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
No New Or Fixed Issues Found |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
func isVaultEmpty() async throws -> Bool { | ||
try await cipherService.fetchAllCiphers().isEmpty | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
1b90583
to
eb522c7
Compare
@@ -62,6 +68,13 @@ protocol CipherDataStore: AnyObject { | |||
} | |||
|
|||
extension DataStore: CipherDataStore { | |||
func cipherCount(userId: String) async throws -> Int { | |||
try await backgroundContext.perform { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
🎟️ 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
🦮 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