Offline mode#1183
Open
rolandgeider wants to merge 266 commits into
Open
Conversation
This is now handled automatically by powersync
If the routine provider is rewritten to be a riverpod provider as well, we will be able to simply read the necessary providers ourselves as needed.
It's probably a good idea to change this and simply handle empty strings
This makes it easier to load the data from the powersync database
This is not a wrapper around the old one, which was making problems. Delete unneeded generated files as well.
…mplementation # Conflicts: # lib/providers/ingredient_notifier.dart
This is needed due to the way powersync works. In practice, this will only be null during a very small time window between editing the model and the sync back from the backend.
We now use the exact same widget as in the regular info dialog
This is not really needed anymore since most parts of the application can be used offline, and the ones that don't are marked.
We don't want to logout the user if we can't refresh the token because the device is offline.
We were previously dropping the local db on logout, which could also happen when the user was too long offline to fetch a new token. Now this only happens when the user manually logs out, or during login and there's the db from a previous, different, user.
This is needed to allow users coming from an old version of the app to remain logged-in.
This makes the (still) quite large auth_notifier.dart, a bit more clear and easy to understand
2 tasks
# Conflicts: # lib/widgets/nutrition/ingredient_dialogs.dart # lib/widgets/nutrition/widgets.dart
This is only relevant for tests (and only in linux?) and wasn't surfacing any real problems anyway, so we can safely ignore it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Note: this needs a powersync service running additionally to the regular backend. The way this works is that you use a local sqlite database on the device and powersync takes care of making sure new entries are synced once you're connected to the internet again. Note that this doesn't make the whole application work offline, as some entries such as the routines need some backend logic that we don't want to replicate (also, this transparently and smoothly takes care of keeping the exercise db in sync). These parts are aware there is no network connectivity and won't endlessly try to fetch the data, so you can open your routine and go to the gym where there's no internet and log everything.
Also all providers were moved to riverpod since it made working with the new ones much easier and due to these refactors the PR should also get rid of all the weird loading bugs we had in the past.
Related Issue(s)
Offline mode
Closes #6 🥳
Closes #12
All kinds of miscellaneous "can't load x", "doesn't show y", "timeout at x" issues
Closes #51
Closes #548
Closes #558
Closes #577
Closes #722
Closes #861
Closes #867
Closes #881
Closes #936
Closes #983
Closes #1035
Closes #1054
Closes #1055
Closes #1063
Closes #1070
Closes #1089
Closes #1103
Closes #1114
Closes #1133
Closes #1147
Closes #1152
Closes #1163
Closes #1193
Closes #1199
Needs backend wger-project/wger#1747