-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(mobile): native sync #18033
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
feat(mobile): native sync #18033
Conversation
adae03c to
e99f4ff
Compare
e99f4ff to
c0acd86
Compare
0424d32 to
3360883
Compare
3360883 to
09e5503
Compare
| var updatedArr: Set<WrapperAsset> = [] | ||
| var deletedArr: Set<String> = [] |
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 would happen if an asset is updated and then later deleted before this runs? Would the changes only show the deletion or would it end up in both lists?
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.
It only shows up as deleted from my limited testing. But we need to note these during our full testing of the implementation because the PhotoKit API is extremely quirky
| let deleted = details.deletedLocalIdentifiers | ||
|
|
||
| let options = PHFetchOptions() | ||
| options.includeHiddenAssets = false |
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.
If an asset started as not hidden and became hidden later, would this mean that immich would ignore this and later changes? Is that intentional?
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.
We do not handle hidden assets yet and ignoring them is okay for the time being. And, I don't think we need a PHFetchOption in the first place. I'll update the method call and pass nil for the options
| createdAt: createdAt, | ||
| updatedAt: updatedAt, | ||
| durationInSeconds: durationInSeconds, | ||
| albumIds: self._getAlbumIds(forAsset: asset) |
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.
You only need to do this for updated assets, not for inserted, right?
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.
We would also need this for inserted assets as well. If an asset was inserted after our last sync and also got added to multiple albums before we get to sync the changes, we need the albumIds to link it during our sync
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.
True, I guess I meant assets that were inserted but not updated, because we already know they're not in any albums (or they would be updated too).
mobile/android/app/src/main/kotlin/app/alextran/immich/platform/MediaManager.kt
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @RequiresApi(Build.VERSION_CODES.Q) | ||
| fun shouldFullSync(callback: (Result<Boolean>) -> Unit) { |
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.
Why the callbacks?
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 marked the methods as asynchronous in the messages template which generates the methods in the native side with a callback expecting the native methods to be asynchronous. However, none of our methods are asynchronous and removing the @async annotation actually makes the native API a lot more simpler. Will remove the async annotation and update the native methods to be synchronous
d583c07 to
4a9b8c2
Compare
4a9b8c2 to
30fc632
Compare
|
Superseded by #18428 |
No description provided.