Skip to content
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

feature(mobile): add offline support #1506

Closed
wants to merge 1 commit into from
Closed

Conversation

fyfrey
Copy link
Contributor

@fyfrey fyfrey commented Feb 1, 2023

This PR mostly changes mobile:

  • Adds Isar DB
  • Asset is now a DB entity and contains all required fields, no longer stored an AssetResponseDto internally
  • Replacing caching as JSON with storing in local DB
  • Replaces usage of AssetResponseDto with Asset: To unify viewing local/remote assets
  • Replaces usage of CachedNetworkImage with ImmichImage: To show Assets instead of only remote AssetResponseDtos
  • New class Album: DB entity, can be both device local and remote
  • Replace usage of AlbumResponseDto with Album
  • New class User: DB entity, equivalent to server entity
  • New class Value: DB entity to store different single values (string/json/int) in a DB table, for configuration settings, logged in user id etc.
  • Syncs changes 1-way: from server to client (minus bugs), this includes new albums/assets, modified albums/assets, removing albums/assets
  • Allows to browse (read-only) the app while offline: Making modifications such as adding assets to an album etc. does not work yet
  • Shows device albums on the library page in a new section
  • replace a few API calls with lookups in the local DB (e.g. getting users to share an album with)
  • adds a modifedAt column to the server Album entity
  • very likely added new bugs :-)
  • probably a lot more that I forgot to mention here

To test this, you need to run flutter pub run build_runner build to generate the Isar files (currently not included in the repo, but we could do that)

Since this changeset is already huge, any more advances offline functionalities enabled by this change are planned as follow-up PRs such as:

  • Making modifications offline and syncing 2-way (from server to client and vice versa)
  • Moving the whole compute intense asset handling (like downloading the list of assets or finding assets on device and combining both) to a its own isolate independent of the UI isolate
  • Reading chunks from the local DB while scrolling instead of loading everything
  • Replace some Hive boxes with Isar table(s): Enable concurrent access from multiple isolates which Hive does not support
  • Concurrent background backup: background and foreground isolates can now work concurrently since Isar DB can be concurrently accessed from multiple isolates

@vercel
Copy link

vercel bot commented Feb 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
immich-code-coverage ❌ Failed (Inspect) Feb 1, 2023 at 9:10PM (UTC)
1 Ignored Deployment
Name Status Preview Updated
immich ⬜️ Ignored (Inspect) Feb 1, 2023 at 9:10PM (UTC)

@bo0tzz
Copy link
Member

bo0tzz commented Feb 1, 2023

Awesome stuff!

To test this, you need to run flutter pub run build_runner build to generate the Isar files (currently not included in the repo, but we could do that

Is this always required to build the app? If so, we should add that step to the CI app build workflow (or include those files in the repo)

@fyfrey
Copy link
Contributor Author

fyfrey commented Mar 4, 2023

Superseded by #1539 #1561 #1574 #1759 #1932

@fyfrey fyfrey closed this Mar 4, 2023
@alextran1502 alextran1502 deleted the dev/basicOfflineSupport branch March 29, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants