[PR #3945] [MERGED] feat(mobile): efficient asset sync #10169

Closed
opened 2026-02-05 14:17:06 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/3945
Author: @fyfrey
Created: 9/1/2023
Status: Merged
Merged: 9/10/2023
Merged by: @fyfrey

Base: mainHead: dev/mobile-efficient-sync


📝 Commits (2)

  • 6ba9847 feat(mobile): efficient asset sync
  • 65b017a handle remote removal of merged assets correctly

📊 Changes

15 files changed (+373 additions, -251 deletions)

View changed files

📝 mobile/lib/modules/partner/views/partner_detail_page.dart (+11 -1)
📝 mobile/lib/routing/router.gr.dart (+1 -0)
📝 mobile/lib/routing/tab_navigation_observer.dart (+3 -0)
📝 mobile/lib/shared/models/asset.dart (+6 -6)
📝 mobile/lib/shared/models/etag.dart (+3 -2)
📝 mobile/lib/shared/models/etag.g.dart (+147 -116)
📝 mobile/lib/shared/providers/app_state.provider.dart (+15 -2)
📝 mobile/lib/shared/providers/asset.provider.dart (+23 -6)
mobile/lib/shared/providers/tab.provider.dart (+13 -0)
📝 mobile/lib/shared/services/api.service.dart (+2 -0)
📝 mobile/lib/shared/services/asset.service.dart (+18 -25)
📝 mobile/lib/shared/services/sync.service.dart (+79 -13)
📝 mobile/lib/shared/views/tab_controller_page.dart (+3 -0)
mobile/lib/utils/openapi_extensions.dart (+0 -59)
📝 mobile/test/sync_service_test.dart (+49 -21)

📄 Description

Efficient synchronization of assets from server to mobile

Building upon #3824, this PR vastly speeds up the asset synchronization on large libraries. No more "building timeline" for large collections on the server.

Server needs to be at least at version 1.75.0

finally closes #3029

How

Instead of downloading all asset metadata for a user, only the most recent changes (since the last sync) are fetched. Only for the initial sync and after too long being out-of-sync, all asset metadata is loaded.

The time of the last successful sync is stored per user, so this feature already works with partner libraries as well. Albums are not yet supported and thus use the old "load all asset metadata for this album" to update.

This PR also changes when a refresh/sync is triggered: Whenever a tab is opened (or the app is resumed), the data required for the active tab is synced.

Tests

  • Adapted the old sync service unit to always test the fallback case (full sync).
  • Added a new unit test for the more efficient sync (adding, modifying and deleting assets)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/3945 **Author:** [@fyfrey](https://github.com/fyfrey) **Created:** 9/1/2023 **Status:** ✅ Merged **Merged:** 9/10/2023 **Merged by:** [@fyfrey](https://github.com/fyfrey) **Base:** `main` ← **Head:** `dev/mobile-efficient-sync` --- ### 📝 Commits (2) - [`6ba9847`](https://github.com/immich-app/immich/commit/6ba9847562a0d743a3c8759f5647647f84edede1) feat(mobile): efficient asset sync - [`65b017a`](https://github.com/immich-app/immich/commit/65b017a82bf179dedda2211e4c561bc6b414d6f7) handle remote removal of merged assets correctly ### 📊 Changes **15 files changed** (+373 additions, -251 deletions) <details> <summary>View changed files</summary> 📝 `mobile/lib/modules/partner/views/partner_detail_page.dart` (+11 -1) 📝 `mobile/lib/routing/router.gr.dart` (+1 -0) 📝 `mobile/lib/routing/tab_navigation_observer.dart` (+3 -0) 📝 `mobile/lib/shared/models/asset.dart` (+6 -6) 📝 `mobile/lib/shared/models/etag.dart` (+3 -2) 📝 `mobile/lib/shared/models/etag.g.dart` (+147 -116) 📝 `mobile/lib/shared/providers/app_state.provider.dart` (+15 -2) 📝 `mobile/lib/shared/providers/asset.provider.dart` (+23 -6) ➕ `mobile/lib/shared/providers/tab.provider.dart` (+13 -0) 📝 `mobile/lib/shared/services/api.service.dart` (+2 -0) 📝 `mobile/lib/shared/services/asset.service.dart` (+18 -25) 📝 `mobile/lib/shared/services/sync.service.dart` (+79 -13) 📝 `mobile/lib/shared/views/tab_controller_page.dart` (+3 -0) ➖ `mobile/lib/utils/openapi_extensions.dart` (+0 -59) 📝 `mobile/test/sync_service_test.dart` (+49 -21) </details> ### 📄 Description ## Efficient synchronization of assets from server to mobile Building upon #3824, this PR vastly speeds up the asset synchronization on large libraries. No more "building timeline" for large collections on the server. Server needs to be at least at version 1.75.0 finally closes #3029 ### How Instead of downloading all asset metadata for a user, only the most recent changes (since the last sync) are fetched. Only for the initial sync and after too long being out-of-sync, all asset metadata is loaded. The time of the last successful sync is stored per user, so this feature already works with partner libraries as well. Albums are not yet supported and thus use the old "load all asset metadata for this album" to update. This PR also changes when a refresh/sync is triggered: Whenever a tab is opened (or the app is resumed), the data required for the active tab is synced. ### Tests - Adapted the old sync service unit to always test the fallback case (full sync). - Added a new unit test for the more efficient sync (adding, modifying and deleting assets) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 14:17:06 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#10169