-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
refactor(mobile): DB repository for asset, backup, sync service #12953
base: main
Are you sure you want to change the base?
Conversation
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.
LGTM. Hopefully we're at a point where we can add more unit tests now.
Hello Fynn, thank you for the PR. Below are some results of my testing Assertion trigger 🟠When first signing in an instance, I am seeing this assertion gets triggered, even signing out and singing back in trigger this condition.
Here is the list of users in Isar database Users json
Asset sync 🟢After commenting out the assertion condition, the sync process was completed successfully to get all current and partner users' assets. Album sync 🟢Album sync also works correctly. |
import 'package:immich_mobile/repositories/database.repository.dart'; | ||
import 'package:isar/isar.dart'; | ||
|
||
final etagRepositoryProvider = |
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.
Should we invalidate this in invalidateAllApiRepositoryProviders()
as well?
import 'package:immich_mobile/interfaces/database.interface.dart'; | ||
import 'package:isar/isar.dart'; | ||
|
||
const Symbol _zoneTxn = #zoneTxn; |
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.
What is this for?
Future<Album?> getByName( | ||
String name, { | ||
bool? shared, | ||
bool? remote, | ||
}); | ||
|
||
Future<List<Album>> getAll({ |
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.
In the upcoming layout, I will need to get all albums, both shared and owned. Can it be done with this interface in a single invocation?
This PR removes the direct dependency on Isar for the last services: asset, backup and most difficult sync.
To do so, this PR introduces new methods to existing database repositories.
Now, only providers are left to refactor to use the services (or repositories) instead of directly performing database operations.