feat: opt-in sync of deletes and restores from web to Android#16732
feat: opt-in sync of deletes and restores from web to Android#16732alextran1502 merged 30 commits intoimmich-app:mainfrom
Conversation
…bum added. (Android)
| SettingsSwitchListTile( | ||
| enabled: true, | ||
| valueNotifier: manageLocalMediaAndroid, | ||
| title: "Sync remote deletions", |
There was a problem hiding this comment.
Please put the string to en-us.json
suggestion for the subtitle string
Automatically delete or restore an asset on this device when that action is taken on the web
There was a problem hiding this comment.
Also, I would like to mark this as [EXPERIMENTAL]
|
Hello, I just ran the first round of functional testing on a Samsung S23, and I don't see the behavior I expected. Let me know if I misunderstood the PR's functionality.
Let me know if I have tested the PR correctly. |
| title: "advanced_settings_troubleshooting_title".tr(), | ||
| subtitle: "advanced_settings_troubleshooting_subtitle".tr(), | ||
| ), | ||
| SettingsSwitchListTile( |
There was a problem hiding this comment.
This should only show on Android
There was a problem hiding this comment.
You tested it a bit incorrectly. The Media Store API works with media files that are located in the gallery. So, after deletion, we need to check the trash in the gallery, not the trash in the file manager.
When deleting a downloaded file in the web app, the file moves from the album to the trash (gallery), and when restoring it in the web app, it returns to the album from the trash.
shenlong-tanwen
left a comment
There was a problem hiding this comment.
I'm not sure it is a good idea to try to keep the Trash inside Immich to be in sync with the one on the device. We can configure the number of days after which an asset is permanently deleted from the trash in Immich. However, the System trash on the device defaults to a 30 days window, after which the asset is removed permanently from the device. If the trash days is >30 inside Immich and the user tries to restore the asset after 30 days, there will be no asset, anymore on the device to be restored. It is not a problem with the other app because it defaults to having 30 days as the trash window.
This is a good catch. I do think it's kind of nice that it's viewable in the system trash though. I think there are a few options here:
Do you have an opinion @alextran1502 ? |
I think this is the best compromise. The default is always to trash and have 30 days before deletion. @jrasm91 any thoughts about this? |
|
Personally, I think if you trash a file in Immich with this option enabled:
Specifically when the Immich's trash policy in longer than 30 days I think it's fine for the item to be deleted on the device and only be restored on the web. When the Immich trash policy is shorter than 30 days, I think it's also fine to leave the trashed photo in the mobile trash. |
|
I think that's probably pretty close to what happens with this PR today. I guess my question would be what happens if an asset is deleted from one trash and then restored from the other? Will it get synced to the other device? How and when does that happen? I think what Alex suggested is simpler conceptually in that it avoids cases like that. It's been hard to keep this PR in sync with main and it keeps falling down the queue, so I sort of wonder if we shouldn't just merge it as is and figure out any follow ups separately. |
@alextran1502 done!) |
|
I really hope there is a solution for the permission problem with the playstore. Is there already an issue for this? Or is this the place to discuss it? |
We are in the process of adding it back using a less intrusive permission on Android - #17828. |
|
I have updated both the android app and the server to 1.132.3, however I still cannot see the experimental setting "Sync remote deletions" in the "Advanced" settings section. What am I missing? Note that my phone is still running Android 11, could that be the reason? |
…-app#16732) * Features: Local file movement to trash and restoration back to the album added. (Android) * Comments fixes * settings button marked as [EXPERIMENTAL] * _moveToTrashMatchedAssets refactored, moveToTrash renamed. * fix: bad merge * Permission check and request for local storage added. * Permission request added on settings switcher * Settings button logic changed * Method channel file_trash moved to BackgroundServicePlugin --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
* chore: revert immich-app#16732 * lint
|
I still have issues with deleted files on my local server. When I delete photos on immich web page, the photos are deleted on disk after emptying the trash. But after a while (on next client-server sync) they are uploaded again from the mobile phone app even though I have the "Sync remote deletions" turned on. Server version 2.5.3 (using storage templates) |
|
@kujlek Did I understand correctly that between deleting the assets and emptying the trash you do not use the mobile app, meaning the client–server sync does not have a chance to run? |
Add details about existing Android opt-in trash sync (upstream PRs immich-app#16732, immich-app#20473, immich-app#24218) and potential future improvements (iOS support, push-based sync, mobile→web delete direction).
* docs: add Google Photos import wizard design Web UI wizard for importing Google Takeout exports. Client-side hybrid approach: browser streams zips, parses JSON sidecars, shows preview with album selection, uploads through existing asset API. 5-step wizard with source selection, file picker, scanning, review/configure, and import progress. TDD required for all implementation. * docs: add Google Photos import implementation plan (18 TDD tasks) * docs: update delete sync feature notes with implementation status Add details about existing Android opt-in trash sync (upstream PRs immich-app#16732, immich-app#20473, immich-app#24218) and potential future improvements (iOS support, push-based sync, mobile→web delete direction). * feat: auto-publish Docker images on PR merge with semver bumping Enable push trigger on main so every merged PR automatically builds and publishes Docker images. Version is computed from the latest git tag: - changelog:feat label or feat: prefix → minor bump - BREAKING CHANGE in body → major bump - everything else → patch bump Manual workflow_dispatch with explicit version still supported as override. A tag job creates the git tag after successful builds. * fix: format docs plan files for prettier check * docs: update README with v3.0.0 and auto-publish details * fix: resolve zizmor security findings in Docker workflow - Pass inputs.version through env var instead of template expansion in run blocks - Pass version output through env var for tag creation step - Add persist-credentials: true explicitly on tag job checkout (needs push access)
|
Hi, I've managed to reproduce the issue with latest immich server v2.6.3 and android app v2.6.3. Web UI delete works ok (images are not re-uploaded) if these steps are taken:
Images are re-uploaded if immich app sync is not done between moving image to trash and emptying it. |

Description
Functionality for synchronizing the local media store when remotely deleting to trash and restoring files has been added. (Android)
This solves the issue of file deletion synchronization on web and mobile apps.
Fixes # (issue)
How Has This Been Tested?
To verify this, you need an Android 11+ device.
Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)