refactor: migrate file access to native - #31608
Open
santoshakil wants to merge 9 commits into
Open
santoshakil wants to merge 9 commits into
santoshakil wants to merge 9 commits into
Conversation
Contributor
|
📱 Android release APK (universal) — Download: https://github.com/immich-app/immich/actions/runs/35381235762/artifacts/10562697460 Installs as a separate app (applicationId |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of the migration, file access. The original file, the live photo video, the original file name and the live photo flag now come from one native call instead of photo_manager.
iOS writes the resource with PHAssetResourceManager into a fresh file under Library/Caches/immich/originals on every call. The caller owns that copy and deletes it when done, the uploads and the share already did, the viewer now does too. Leftovers from a killed app are removed once at launch. Android returns the MediaStore path, nothing is copied. When the asset is gone the call returns null and the callers keep their old behaviour.
Two things change for a user. The old clearCache at backup start and cancel is gone, so a copy in use is never deleted under its reader anymore. Two callers on the same asset at the same moment make two copies for a few seconds instead of sharing one.
Tested on an iPhone XS against the photo_manager build on the same phone and albums: identical names, visibility, live photo pairs and checksums. The background path was checked as well and uploads the same rows as before. Medium and unit tests cover the repository and both upload services.
Future cleanup: play local videos through requestAVAsset instead of an export, delete the background copy right after enqueue, and get the live photo flag without exporting the still.