Skip to content

feature(mobile): allow app to be used offline - #1932

Merged
alextran1502 merged 8 commits into
mainfrom
dev/offline-app
Mar 15, 2023
Merged

alextran1502 merged 8 commits into
mainfrom
dev/offline-app

Conversation

@fyfrey

@fyfrey fyfrey commented Mar 4, 2023 •

Copy link
Copy Markdown
Collaborator
  • stop being sent back to login screen on network errors
  • load cached thumbnail if preview/original fails to load
  • hide logging spam from flutter network errors for loading images. Display Error Icons instead
  • allow to skip server login on cold start without network

@vercel

vercel Bot commented Mar 4, 2023 •

Copy link
Copy Markdown

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

Name Status Preview Comments Updated
immich ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 15, 2023 at 7:45PM (UTC)

Comment thread mobile/lib/modules/search/views/search_result_page.dart Outdated
@fyfrey fyfrey mentioned this pull request Mar 4, 2023
16 tasks done
@alextran1502

alextran1502 commented Mar 5, 2023 •

Copy link
Copy Markdown
Member

Hi Fynn, thank you for the PR. I just completed my round of functional testing, and I have a few questions.

First, my offline mode means turning off WIFI/Cellular/BLE and putting the phone in airplane mode.

  1. In offline mode, any thumbnails that have been cached will display, but you cannot click on them to view, correct?
  2. If an asset is on the device offline, the thumbnail should show up on the timeline, correct? I have some assets that got shown and some that didn't.
  3. When in offline mode, when I click on the button to access the backup controller page, it takes a while (probably until HTTP request timeout) then it will navigate. Should we expect it to navigate as soon as we click on the button?
  4. In offline mode, it hangs on the splash screen when I kill the app and reopen it. I believe it is trying to wait for the response of the login process as well

@fyfrey

fyfrey commented Mar 6, 2023

Copy link
Copy Markdown
Collaborator Author

Thanks for testing this, Alex!

First, my offline mode means turning off WIFI/Cellular/BLE and putting the phone in airplane mode.

Okay. It also applies if a) network is connected but not working (for whatever reason) or b) the API server is down.

1. In offline mode, any thumbnails that have been cached will display, but you cannot click on them to view, correct?

Thumbnails will display if a) the asset is stored locally on device or b) it has previously been cached. You can click on them to view. For local assets, the original is loaded as always. For remote assets, the preview/original is loaded (and shown if cached), else the cached thumbnail is shown as a fallback.

2. If an asset is on the device offline, the thumbnail should show up on the timeline, correct? I have some assets that got shown and some that didn't.

Correct. Assets on device (local) are always shown both thumb and original (if in slide/detail view)

3. When in offline mode, when I click on the button to access the backup controller page, it takes a while (probably until HTTP request timeout) then it will navigate. Should we expect it to navigate as soon as we click on the button?

I also noticed some slight delay. Not sure why the page is not loading immediately. It should at least display the default state of all values.. I guess this is a riverpod issue or our build method in BackupControllerPage does something wrong

4. In offline mode, it hangs on the splash screen when I kill the app and reopen it. I believe it is trying to wait for the response of the login process as well.

Hangs forever? For me, it takes a while longer (waiting for a server response) but then opens the app after a short (maybe 1 second) delay.

Not sure what's the best approach to speed up waiting on server responses.

@michelheusschen

Copy link
Copy Markdown
Collaborator

Hangs forever? For me, it takes a while longer (waiting for a server response) but then opens the app after a short (maybe 1 second) delay.

Not sure what's the best approach to speed up waiting on server responses.

Maybe don't wait at all and start in offline mode by default. Then loading can happen in the background, but if it takes too long the user is made aware of this. Either by a popup or message on a page when a connection is necessary or an offline icon somewhere. The app could also occasionally check for a network connection and switch between online/offline mode.

Just my thoughts on an ideal solution. Depending on the current implementation, this could be quite some work to add but maybe some things are more straightforward. If it's too much, it can always be done in a future PR.

@fyfrey
fyfrey force-pushed the dev/offline-app branch from 386de6a to e5a03eb Compare March 6, 2023 15:12
@fyfrey

fyfrey commented Mar 6, 2023

Copy link
Copy Markdown
Collaborator Author

Just my thoughts on an ideal solution. Depending on the current implementation, this could be quite some work to add but maybe some things are more straightforward. If it's too much, it can always be done in a future PR.

Yeah, that is out of scope for this PR. Would need quite a large refactor because everything is historically server-centric in the app. Better suited for a follow-up PR.

@martyfuhry

Copy link
Copy Markdown
Collaborator

Works well for me! I tried it offline & online, and gallery photos and videos loaded nicely. I also launched it while it airplane mode and it brought me right to the main timeline. Didn't notice if it took any longer.

@fyfrey
fyfrey requested a review from alextran1502 March 12, 2023 15:26
@alextran1502
alextran1502 merged commit 04955a4 into main Mar 15, 2023
@alextran1502
alextran1502 deleted the dev/offline-app branch March 15, 2023 21:29

This branch was previously deployed

1 inactive deployment
Preview — f61c7953 Deployed Mar 15, 2023 by vercel[bot]
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.

5 participants