Commit Graph

63 Commits

Author SHA1 Message Date
Roland Geider
d62d0e8f8c Merge pull request #1326 from charugupta-dev/fix/145-muscle-widget-duplicates
Handle duplicate muscles on muscle overview
2026-08-21 21:36:31 +02:00
Roland Geider
c69a34c2f1 Simplify duplicate muscle handling in MuscleWidget
A muscle id uniquely identifies a muscle, so matching by id and matching by
value are equivalent here.
2026-08-21 20:58:06 +02:00
Roland Geider
2c26c93d68 Merge remote-tracking branch 'origin/master' into fix/build-phase-ui-side-effects 2026-08-21 18:01:56 +02:00
Roland Geider
095323f29b Merge pull request #1327 from wger-project/feature/better-online-gating
Better online gating
2026-08-21 17:48:01 +02:00
Roland Geider
2073d462e6 Show a plain outage as disconnected, not as a sync error 2026-08-21 14:46:27 +02:00
Charu7596
067ce06a80 Handle duplicate muscles in MuscleWidget
Ensure muscles appearing in both primary and secondary lists only render the primary background, and deduplicate muscles by ID within each list. Fixes #145
2026-08-20 12:48:15 +05:30
Ben Tucker
fe33f693a8 fix(core): make UI side effects and provider reads safe during build
Errors handled while the widget tree is building crashed or wedged the
app in three related ways:

- FlutterError.onError showed dialogs and snackbars synchronously.
  Pushing a route mid-build trips the navigator's !_debugLocked
  assertion, and because the one-dialog guard was set before showDialog
  threw, its release never attached: every later error dialog was then
  silently suppressed while nothing was on screen, leaving a blank,
  unresponsive app until restart. Snackbars crashed outright via the
  messenger's setState.
- The sync status and barcode dialogs did ref.read inside their route
  builders, which run during build. With the provider chain dirty (any
  token refresh dirties wgerBase -> auth), the read flushed it there and
  Riverpod scheduled a scope refresh mid-build. The barcode builder also
  created its search future inline, re-firing the search on every dialog
  rebuild.
- Provider create bodies that widgets watch during build read providers
  synchronously: the dashboard's routine hydration chain crashed on cold
  start right after a token refresh, and TrophyStateNotifier.build()
  has the same shape in the post-login window, where invalidation order
  left networkStatusProvider dirty while its dependents rebuilt.

lib/core/build_safety.dart adds the two idioms as helpers: runAfterFrame
defers UI side effects past the build phase, yieldPastBuild yields
provider create bodies past their synchronous phase (a microtask, not a
timer, since widget tests assert !timersPending at teardown). The error
dialog guard is released when the context is gone or the push fails, the
snackbar helpers re-resolve the messenger inside the callback, the
dialog builders snapshot their providers in the tap handler, and
post-login invalidation runs leaf-first. Regression tests cover each
shape.
2026-08-16 17:29:43 -05:00
Roland Geider
2374e1b0ba Replace flutter_svg_icons with a local SvgIcon widget 2026-08-15 21:52:07 +02:00
Roland Geider
9a97202dd4 Cleanup 2026-08-14 17:37:47 +02:00
Roland Geider
e794ee6bba Let user actions try the server instead of trusting a cached status 2026-08-14 15:42:14 +02:00
Roland Geider
6eb6197923 Set the day on sessions created automatically for logs
See https://github.com/wger-project/wger/issues/2460
2026-08-13 14:05:30 +02:00
Roland Geider
98373438ab Cover the routine carry-forward, supersets and the resume path 2026-08-10 10:29:22 +02:00
Roland Geider
7ac0a1ebeb Include measurements taken on the end day of a chart window 2026-08-10 09:24:16 +02:00
Roland Geider
8178d2bcaf Persist cleared fields when editing local rows 2026-08-10 09:24:01 +02:00
Roland Geider
a582ae9a03 Remove dead RiR placeholder and log target status code 2026-08-10 00:21:10 +02:00
Roland Geider
b5cf828cb0 Add a setting for detailed logging 2026-08-09 22:47:48 +02:00
Roland Geider
5c77a99bfc Apply dynamic color to the high contrast themes too 2026-08-04 12:19:52 +02:00
Roland Geider
762b679eac Only offer dynamic color where the platform supports it 2026-08-04 12:10:34 +02:00
Roland Geider
a1f4844f6c Replace more hard coded colors with theme generated ones 2026-08-04 11:52:29 +02:00
Roland Geider
1af9471ef4 Replace more hard coded colors with theme generated ones 2026-08-04 11:41:17 +02:00
Roland Geider
2c63aa0e21 Replace more hard coded colors with theme generated ones 2026-08-04 11:35:32 +02:00
Roland Geider
07aa325ec5 Generate chart colors from the scheme instead of a fixed palette 2026-08-04 11:24:10 +02:00
Roland Geider
33750a19b1 Paint the macro gauges in the theme's primary color 2026-08-04 00:20:21 +02:00
Roland Geider
ec20dd45de Use theme colors instead of fixed ones 2026-08-04 00:01:39 +02:00
Praharsha2007
d2dacb116d feat : implemented dynamic colour support 2026-08-03 21:15:00 +05:30
Roland Geider
c334ce6695 Wait for the user profile before hydrating a routine 2026-07-30 22:15:44 +02:00
Roland Geider
88f72a64bd Fix the unit dropdowns in the slot entry form discarding the selection 2026-07-30 21:50:41 +02:00
Roland Geider
fe6d0a59df Default the weight unit from the profile for app-created entries and ad-hoc exercises 2026-07-30 21:47:01 +02:00
Roland Geider
ee0313b458 Merge remote-tracking branch 'origin/master' into default-weight-profile
# Conflicts:
#	lib/features/routines/providers/routines_notifier.dart
#	lib/features/routines/providers/routines_notifier.g.dart
#	test/features/exercises/providers/exercise_filters_notifier_test.mocks.dart
#	test/features/routines/helpers/routine_form_test_overrides.dart
#	test/features/routines/models/log_test.dart
#	test/features/routines/providers/routines_notifier_test.dart
#	test/features/routines/providers/routines_notifier_test.mocks.dart
#	test/features/routines/widgets/forms/routine_form_test.dart
2026-07-30 21:14:16 +02:00
Roland Geider
914e9ac575 Surface involuntary logouts and revalidate the session on app resume
This makes it obvious why users are redirected to the auth screen, since the
snackbar could be easily missed.

See #1265
2026-07-30 15:47:04 +02:00
Roland Geider
1a58dd8f71 Warn in the settings while certificates are not being verified 2026-07-30 14:23:37 +02:00
Roland Geider
0ecd06ff3c Read the certificate setting from the provider instead of mirroring it 2026-07-30 14:06:19 +02:00
Roland Geider
3a57479585 Scope the self-signed setting to one host and apply without a restart 2026-07-30 13:57:41 +02:00
Roland Geider
41378988d0 Merge branch 'master' into feat/allow-self-signed-certs
# Conflicts:
#	lib/core/app_settings_notifier.dart
#	lib/core/app_settings_notifier.g.dart
#	lib/core/http_overrides.dart
#	lib/features/auth/widgets/auth_card.dart
#	lib/main.dart
#	test/features/account/widgets/settings_test.dart
2026-07-30 13:20:33 +02:00
Roland Geider
fb43a9fdd2 Allow setting the meal when logging individual ingredients 2026-07-30 12:30:02 +02:00
Roland Geider
24c3a93d97 Filter out empty logs
Closes #1293
2026-07-30 11:38:57 +02:00
Roland Geider
4f4b32e61d Make exerciseObj in SlotEntry hydration-safe 2026-07-29 14:46:54 +02:00
Roland Geider
0cf4111c8d Set fixed size for logo
This was causing tests to fail due to the screen size and the sharding behaviour
in CI
2026-07-28 17:05:07 +02:00
Matz Hilven
b7a0d4893c Hydrate the exercise when copying a past log in gym mode
Not copying an exercise that isn't there keeps the crash away, but gym
mode then holds a log with no exercise, which would bite the next reader.

The past logs widget already knows the exercise from the set config, so
pass it down to setLog, which assigns it through the exercise setter so
that exerciseId stays consistent.

The notifier test worked around the old behaviour by setting exerciseObj
on every fixture, with a comment explaining that copyWith needs it. That
was the bug, written down, so it's gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XzxNFoPMxsFPxHD3P2Ma3w
2026-07-28 00:11:08 +02:00
Matz Hilven
1b199bd06e Fix crash when copying a log with no hydrated exercise
Log.exerciseObj was declared late and is only ever assigned when
hydrating the logs of a routine's sessions. Logs read from the database
are built through drift's row class and only carry exerciseId, so
copyWith threw a LateInitializationError when it unconditionally read
the field. Copying a past log in gym mode does exactly that.

Make the field nullable behind a getter that throws a descriptive error,
add exerciseObjOrNull for callers that legitimately handle logs straight
from the database, and only carry the exercise over when there is one.

Hydrating the exercise in watchLogsByExerciseDrift instead would mean
joining its translations, images, muscles and equipment for every log,
which most callers don't need.

The log page tests mocked the query with the test routine's logs, which
are hydrated, which is why this was never caught. They now return logs
without an exercise, like the real query does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XzxNFoPMxsFPxHD3P2Ma3w
2026-07-28 00:07:43 +02:00
Roland Geider
44c111376d Allow to configure showing and hiding the workout duration 2026-07-24 13:55:03 +02:00
Roland Geider
ac3b463304 Some cleanup 2026-07-24 13:40:41 +02:00
Arya
2f60553a99 Add elapsed workout timer and update workout start time handling 2026-07-23 17:13:02 +05:30
Roland Geider
db98af0ac7 Make sure the code can work with nullable routines in workout logs 2026-07-17 18:25:22 +02:00
Mustafa Senoglu
cc483f3dae fix: make routineId nullable in WorkoutLogTable to prevent crash
Server allows workout logs without a routine (free/ad-hoc logging),
but the app's Drift table declared routineId as non-nullable.
This caused a null check operator crash when PowerSync delivered
a row with routine_id = NULL.

Changes:
- WorkoutLogTable.routineId: integer() → integer().nullable()
- Log.routineId: late int → int?
- Log constructor: required this.routineId → this.routineId
- Log.toCompanion: handle null routineId with Value.absent()

Fixes #1250
2026-07-09 14:15:04 +03:00
Roland Geider
388b403b5d Cleanup some of the new translation keys 2026-07-09 12:45:06 +02:00
Roland Geider
79d663f17f Move gym-mode settings directly into GymModeOptions
I'd say the widget is not big enough to be split up (yet)
2026-07-09 12:01:34 +02:00
Roland Geider
275523f75b Take the repetition unit ID into account while deduping 2026-07-08 17:49:38 +02:00
Roland Geider
569c51c98a Fix setLogScopeWeeks
We now pass clearLogScopeWeeks so that selecting "current routine" actually
resets the scope instead of keeping the previous week count
2026-07-08 17:00:41 +02:00
pankaj-basnet
583982ba1d feat(gym-mode): add logScopeWeeks and showDistinctLogs to GymModeState
- implement persistence for log scope and distinct settings
- refactor(logs): update pastExerciseLogsProvider to support custom scope and deduplication
- feat(ui): add log scope controls to StartPage and LogPage
2026-07-07 22:40:25 +05:45