Commit Graph

64 Commits

Author SHA1 Message Date
Roland Geider
62042bd832 Rename allauth's URLs 2026-06-15 14:11:33 +02:00
Roland Geider
eae855bef4 Properly handle the case where the token could not be decrypted 2026-06-14 20:51:52 +02:00
Roland Geider
63cc163a47 Be more lenient on transient server errors 2026-06-05 13:12:25 +02:00
Roland Geider
41bb7d39d7 Throw exception if the db could not be wiped on logout 2026-06-05 13:11:48 +02:00
Roland Geider
b7674aaf41 Reset the accountProvider on logout 2026-06-05 12:43:34 +02:00
Roland Geider
40e3b560d1 Fix tests 2026-06-04 22:56:35 +02:00
Roland Geider
68428a053e Wipe the local DB only on a real user switch 2026-06-04 16:53:01 +02:00
Roland Geider
f4df847511 Extract some logic into their own files
This makes the (still) quite large auth_notifier.dart, a bit more clear and easy
to understand
2026-05-25 23:32:38 +02:00
Roland Geider
9003b46002 Add migration path from old permanent token to JWT
This is needed to allow users coming from an old version of the app to remain
logged-in.
2026-05-25 23:13:40 +02:00
Roland Geider
1009477553 Fix behaviour on logout
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.
2026-05-25 20:52:23 +02:00
Roland Geider
98e9ea9417 Smarter handling of token lifetimes
We don't want to logout the user if we can't refresh the token because the
device is offline.
2026-05-25 20:33:50 +02:00
Roland Geider
a7e30fcf8c Refactor auth screen
This has been split up into several individual widgets and (hopefully) made
more user friendly
2026-05-24 20:14:25 +02:00
Roland Geider
6ffb1b6c75 Add some more tests for the auth screen 2026-05-22 23:52:11 +02:00
Roland Geider
aaa788570d Cleanup auth screen 2026-05-22 22:50:50 +02:00
Roland Geider
ea3087792c Merge branch 'feature/allauth' into feature/offline-mode 2026-05-22 22:30:45 +02:00
Roland Geider
1b72fb71ad Fix circular provider dependency 2026-05-22 22:14:45 +02:00
Roland Geider
291d3f0f76 Extract token from correct key 2026-05-22 20:11:06 +02:00
Roland Geider
6188175c1a Add 2fa login screen 2026-05-22 20:08:44 +02:00
Roland Geider
87a40fd4e6 Switch the pasted-token field from DRF tokens to refresh tokens 2026-05-22 20:08:43 +02:00
Roland Geider
225a689e7e Implement refresh token logic 2026-05-22 20:08:06 +02:00
Roland Geider
3f89b5a9b5 Add secure storage integration and headless (allauth) JWT support 2026-05-22 20:08:06 +02:00
Roland Geider
736cb41cb2 Improve the login process
The previous process was depending too much on the backend being available, we
can now bypass many of these checks if the user had already logged in before
2026-05-22 19:19:00 +02:00
Roland Geider
1075a2807f Remove the AuthStatus.serverUnreachable case
If the user is logged in, they can access the app
2026-05-22 17:10:28 +02:00
Roland Geider
395eb58cbd Merge remote-tracking branch 'origin/master' into feature/offline-mode 2026-05-07 14:16:58 +02:00
Roland Geider
c93f03fa0b Replace pumpAndSettle with pump where possible 2026-05-07 12:27:33 +02:00
Roland Geider
390dadcdf0 Cleanup 2026-05-03 18:21:54 +02:00
Roland Geider
f5ab4ca390 Handle HTTP errors
If the indetify the error as having HTML (e.g. during development, a wrongly configured
reverse proxy, etc.) render the HTML instead
2026-04-23 13:33:10 +02:00
Roland Geider
8ad3585ce6 Refactor the auth provider, and move it to riverpod 2026-04-17 16:25:04 +02:00
Roland Geider
4b02ee54cd Make min server version tests more robust 2026-04-10 11:06:28 +02:00
Madhav
54a6db2e4b test(auth): stabilize API token happy-path assertion 2026-03-13 17:08:19 +05:30
Madhav
6f34c05ccb Add minimum server version check during login
The app already checks a minimum app version from the server, but the
opposite wasn't true — an app could connect to an older server with a
different API without any warning.

This adds a MIN_SERVER_VERSION constant in the app that is checked
against the server version (already fetched in AuthProvider) during
both login() and tryAutoLogin(). If the server is too old, the user
is silently logged out and returned to the auth screen to connect to
a compatible server.

Includes unit tests for version string parsing (including Python-style
pre-release versions like '2.5.0a2').

Closes #<issue-number>
2026-03-11 23:19:32 +05:30
Roland Geider
ecd0b6c6b4 Add overview page when a workout has been completed 2025-11-26 20:17:02 +01:00
Roland Geider
ae6db6ee07 Move to riverpod three
Needed to downgrade build_runner and mockito for now
2025-11-11 13:22:18 +01:00
Roland Geider
85ba00b654 Merge branch 'master' into feature/day-type
# Conflicts:
#	lib/models/workouts/day.g.dart
#	lib/models/workouts/day_data.g.dart
#	lib/models/workouts/set_config_data.g.dart
#	lib/models/workouts/slot_data.g.dart
#	lib/models/workouts/slot_entry.g.dart
#	lib/models/workouts/weight_unit.g.dart
#	test/auth/auth_screen_test.mocks.dart
#	test/core/settings_test.mocks.dart
#	test/exercises/contribute_exercise_test.mocks.dart
#	test/gallery/gallery_form_test.mocks.dart
#	test/gallery/gallery_screen_test.mocks.dart
#	test/measurements/measurement_categories_screen_test.mocks.dart
#	test/measurements/measurement_provider_test.mocks.dart
#	test/nutrition/nutritional_meal_form_test.mocks.dart
#	test/nutrition/nutritional_plan_form_test.mocks.dart
#	test/nutrition/nutritional_plan_screen_test.mocks.dart
#	test/nutrition/nutritional_plans_screen_test.mocks.dart
#	test/other/base_provider_test.mocks.dart
#	test/routine/day_form_test.mocks.dart
#	test/routine/gym_mode_screen_test.mocks.dart
#	test/routine/gym_mode_session_screen_test.mocks.dart
#	test/routine/repetition_unit_form_widget_test.mocks.dart
#	test/routine/routine_edit_screen_test.mocks.dart
#	test/routine/routine_edit_test.mocks.dart
#	test/routine/routine_form_test.mocks.dart
#	test/routine/routine_logs_screen_test.mocks.dart
#	test/routine/routine_screen_test.mocks.dart
#	test/routine/routines_provider_test.mocks.dart
#	test/routine/routines_screen_test.mocks.dart
#	test/routine/slot_entry_form_test.mocks.dart
#	test/routine/weight_unit_form_widget_test.mocks.dart
#	test/user/provider_test.mocks.dart
#	test/weight/weight_provider_test.mocks.dart
#	test/weight/weight_screen_test.mocks.dart
2025-10-09 17:39:39 +02:00
Roland Geider
93a11a16e4 Recreate generated files and reformat the repo
Seems the default dart formatting rules changed recently, and this was causing
huge diffs in branches
2025-10-09 17:39:02 +02:00
Roland Geider
39be6a3edf Allow setting the day type in the edit form 2025-10-06 11:36:27 +02:00
Roland Geider
798406eaa9 Make routineId nullable in session and related files
Sessions can be added ad-hoc, without needing to be part of any specific
routine.
2025-09-16 14:47:47 +02:00
Roland Geider
9a05c6a967 Fix test, there's no error header any more 2025-05-11 18:09:33 +02:00
Roland Geider
0d49030c60 Merge branch 'master' into fork/eyJhb/api-token
# Conflicts:
#	lib/screens/auth_screen.dart
#	test/nutrition/nutritional_plan_screen_test.mocks.dart
#	test/nutrition/nutritional_plans_screen_test.mocks.dart
#	test/workout/day_form_test.mocks.dart
#	test/workout/gym_mode_session_screen_test.mocks.dart
#	test/workout/repetition_unit_form_widget_test.mocks.dart
#	test/workout/routine_edit_screen_test.mocks.dart
#	test/workout/routine_edit_test.mocks.dart
#	test/workout/routine_form_test.mocks.dart
#	test/workout/routine_logs_screen_test.mocks.dart
#	test/workout/slot_entry_form_test.mocks.dart
#	test/workout/weight_unit_form_widget_test.mocks.dart
2025-05-11 18:04:09 +02:00
Roland Geider
013721ba71 Refactor WgerHttpException
We can now use a widget to show any errors returned by WgerHttpException. This has
to be added on a form-by-form basis, otherwise, the general error handling shows
the results in a modal dialog
2025-05-08 22:06:48 +02:00
Roland Geider
5e22d69bb1 Improve error handling and logging
Now we process and catch all errors that might happen in the application, instead
of silently ignoring them. These errors are shown in a better error dialog, that
shows the details to the user and allows to create an issue on GitHub with the
error and traceback data already filled in.
2025-05-07 18:19:15 +02:00
Roland Geider
ad1c286fe7 Commit generated files 2025-04-30 22:56:07 +02:00
Roland Geider
ece38a39d2 Refactor login screen
The api token toggle is now only visible when showing a custom server, since at
the moment this is the only time when such an auth method makes sense (plus it
keeps the rest of the UI cleaner). The different fields in the screen have been
moved to individual files, to make the structure clearer.
2025-04-30 22:50:55 +02:00
Roland Geider
61f61a64c5 Merge branch 'master' into feature/improve-min-app-version
# Conflicts:
#	lib/providers/auth.dart
2025-03-31 09:44:43 +02:00
Roland Geider
47f6aa36d3 Formatting 2025-03-29 14:32:58 +01:00
Yashas H Majmudar
7786416ed3 fix: auth screen test issue 2025-03-28 22:37:00 -04:00
Roland Geider
e4b550ab52 Refactor app version handling and update authentication flow
Previously, this was only triggered when logging in to the application. If a user
just opened the app, it would just stop working. We also now always check this min
version and have removed the option from the android manifest file since disabling
this doesn't make much sense and we have many other platforms as well (iOS, flatpak)
2025-03-28 17:22:36 +01:00
Roland Geider
d071d143df Update flutter to 3.29
The translations are not stored in a synthetic package anymore, but the
files are just copied to a specific folder so it can be more easily imported

Also, flutter_barcode_scanner was replaced by simple_barcode_scanner since
the first hasn't been updated in 3 years and was already causing problems
for some time
2025-03-18 17:28:19 +01:00
Roland Geider
079db5d5e0 Recreate generated files 2025-01-24 15:07:51 +01:00
Roland Geider
a770c97573 Add smoke test for the routine edit form 2025-01-21 20:58:57 +01:00