immich/mobile/lib/services
Peter Ombodi 493cde9d55
feat: opt-in sync of deletes and restores from web to Android (beta timeline) (#20473)
* feature(mobile, beta, Android): handle remote asset trash/restore events and rescan media
- Handle move to trash and restore from trash for remote assets on Android
- Trigger MediaScannerConnection to rescan affected media files

* feature(mobile, beta, Android): fix rescan

* fix imports

* fix checking conditions

* refactor naming

* fix line breaks

* refactor code
rollback changes in BackgroundServicePlugin

* refactor code (use separate TrashService)

* refactor code

* parallelize restoreFromTrash calls with Future.wait
format trash.provider.dart

* try to re-format trash.provider.dart

* re-format trash.provider.dart

* rename TrashService to TrashSyncService to avoid duplicated names
revert changes in original trash.provider.dart

* refactor code (minor nitpicks)

* process restoreFromTrash sequentially instead of Future.wait

* group local assets by checksum before moving to trash
delete LocalAssetEntity records when moved to trash
refactor code

* fix format

* use checksum for asset restoration
refactro code

* fix format

* sync trash only for backup-selected assets

* feat(db): add local_trashed_asset table and integrate with restoration flow
- Add new `local_trashed_asset` table to store metadata of trashed assets
- Save trashed asset info into `local_trashed_asset` before deletion
- Use `local_trashed_asset` as source for asset restoration
- Implement file restoration by `mediaId`

* resolve merge conflicts

* fix index creating on migration

* rework trashed assets handling
- add new table trashed_local_asset
- mirror trashed assets data in trashed_local_asset.
- compute checksums for assets trashed out-of-app.
- restore assets present in trashed_local_asset and non-trashed in remote_asset.
- simplify moving-to-trash logic based on remote_asset events.

* resolve merge conflicts
use updated approach for calculating checksums

* use CurrentPlatform instead _platform
fix mocks

* revert redundant changes

* Include trashed items in getMediaChanges
Process trashed items delta during incremental sync

* fix merge conflicts

* fix format

* trashed_local_asset table mirror of local_asset table structure
trashed_local_asset<->local_asset transfer data on move to trash or restore
refactor code

* refactor and format code

* refactor TrashedAsset model
fix missed data transfering

* refactor code
remove unused model

* fix label

* fix merge conflicts

* optimize, refactor code
remove redundant code and checking
getTrashedAssetsForAlbum for iOS
tests for hash trashed assets

* format code

* fix migration
fix tests

* fix generated file

* reuse exist checksums on trash data update
handle restoration errors
fix import

* format code

* sync_stream.service depend on repos
refactor assets restoration
update dependencies in tests

* remove trashed asset model
remove trash_sync.service
refactor DriftTrashedLocalAssetRepository, LocalSyncService

* rework fetching trashed assets data on native side
optimize handling trashed assets in local sync service
refactor code

* update NativeSyncApi on iOS side
remove unused code

* optimize sync trashed assets call in full sync mode
refactor code

* fix format

* remove albumIds from getTrashedAssets params
fix upsert in trashed local asset repo
refactor code

* fix getTrashedAssets params

* fix(trash-sync): clean up NativeSyncApiImplBase and correct applyDelta

* refactor(trash-sync): optimize performance and fix minor issues

* refactor(trash-sync): add missed index

* feat(trash-sync): remove sinceLastCheckpoint param from getTrashedAssets

* fix(trash-sync): fix target table

* fix(trash-sync): remove unused extension

* fix(trash-sync): remove unused code

* fix(trash-sync): refactor code

* fix(trash-sync): reformat file

* fix(trash_sync): refactor code

* fix(trash_sync): improve moving to trash

* refactor(trash_sync): integrate MANAGE_MEDIA permission request into login flow and advanced settings

* refactor(trash_sync): add additional checking for experimental trash sync flag and MANAGE_MEDIA permission.

* refactor(trash_sync): resolve merge conflicts

* refactor(trash_sync): fix format

* resolve merge conflicts
add await for alert dialog
add missed request

* refactor(trash_sync): rework MANAGE_MEDIA info widget
show rationale text in permission request alert dialog
refactor setting getter

* fix(trash_sync): restore missing text values

* fix(trash_sync): format file

* fix(trash_sync): check backup enabled and remove remote asset existence check

* fix(trash_sync): remove checking backup enabled
test(trash_sync): cover sync-stream trash/restore paths and dedupe mocks

* test(trash_sync): cover trash/restore flows for local_sync_service

* chore(e2e): restore test-assets submodule pointer

---------

Co-authored-by: Peter Ombodi <peter.ombodi@gmail.com>
Co-authored-by: Alex <alex.tran1502@gmail.com>
2025-11-10 16:20:51 +00:00
..
action.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
activity.service.dart fix(mobile): regression - not displayed activity button in top bar (#23366) 2025-10-30 14:39:36 -05:00
album.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
api.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
app_settings.service.dart feat: add video auto play setting (#20416) 2025-10-15 11:24:47 -04:00
asset.service.dart chore(mobile): add debugPrint lint rule (#21872) 2025-09-12 18:56:00 -04:00
auth.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
background.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
backup.service.dart chore(mobile): add debugPrint lint rule (#21872) 2025-09-12 18:56:00 -04:00
backup_album.service.dart refactor: DCM - const border radius, constructor & switch expressions (#19515) 2025-06-25 13:06:24 +05:30
backup_verification.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
deep_link.service.dart feat: show "appears in" albums on asset viewer bottom sheet (#21925) 2025-10-28 16:52:01 +00:00
device.service.dart refactor: DCM - const border radius, constructor & switch expressions (#19515) 2025-06-25 13:06:24 +05:30
download.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
entity.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
etag.service.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
exif.service.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
folder.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
gcast.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
hash.service.dart refactor: hashing service (#21997) 2025-09-17 23:42:37 -05:00
immich_logger.service.dart refactor(mobile): log service (#16383) 2025-02-27 15:18:49 -05:00
local_auth.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
local_files_manager.service.dart feat: opt-in sync of deletes and restores from web to Android (beta timeline) (#20473) 2025-11-10 16:20:51 +00:00
local_notification.service.dart chore(mobile): add debugPrint lint rule (#21872) 2025-09-12 18:56:00 -04:00
localization.service.dart chore(mobile): add debugPrint lint rule (#21872) 2025-09-12 18:56:00 -04:00
map.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
memory.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
network.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
oauth.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
partner.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
person.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
person.service.g.dart chore(mobile): generated files and ci check (#16798) 2025-03-11 12:22:31 +00:00
search.service.dart chore(mobile): add debugPrint lint rule (#21872) 2025-09-12 18:56:00 -04:00
secure_storage.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
server_info.service.dart fix: process upload only after successful remote sync (#22360) 2025-09-29 10:10:00 -05:00
share.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
share_intent_service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
shared_link.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
stack.service.dart chore(mobile): add debugPrint lint rule (#21872) 2025-09-12 18:56:00 -04:00
sync.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
timeline.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
trash.service.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
upload.service.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
widget.service.dart fix: empty custom header prevent logging in (#20693) 2025-08-05 16:14:21 +00:00