The previous logic didn't consult the app's supportedLocales. For the Android 13 per-app
picker this was fine (the user picked a locale that's also in `locales_config.xml`), but
for users whose primary locale wasn't in the supportedLocales list but whose secondary
one *was*, the app would fall through to English instead of honoring the secondary
Closes#930. The validateLanguage stub in AddExerciseProvider was making
the API call but ignoring the response and always returning false. This
wires it up properly: the method now returns null on success or the
server's error message on a language mismatch (caught from the 400
WgerHttpException). The stepper's onStepContinue is now async-aware for
steps 2 (Description) and 3 (Translation) — it calls validateLanguage
after form validation passes, blocks navigation, and displays the error
inline if the check fails. Mocks regenerated to reflect the return type
change from Future<bool> to Future<String?>.
Mirrors the React refactor in wger-project/react#1237 addressing
Roland's review — the SwitchListTile + conditional Slider pair
expressed one semantic decision ("what grade ceiling?") through two
controls. Folded "Off" into the slider itself:
- Slider stops are now Off | A | B | C | D | E (was A..E, gated by
a SwitchListTile).
- Off position sends no `nutriscoreMax`; A..E map as before.
- Heading changed from "Filter by Nutri-Score" to "Nutri-Score
filter", with a dynamic helper ("No filter" / "<grade> or better").
- Model: `IngredientFilters.nutriscoreMax` is now nullable; removed
`filterNutriscore`. `copyWith` takes a `clearNutriscoreMax` flag
because Dart's `??` cannot distinguish "no argument" from "null".
- Storage collapsed: `saveIngredientNutriscoreMax(null)` removes the
key; `getIngredientNutriscoreMax()` returns `null` when absent.
- Riverpod notifier: removed `toggleNutriscore`; `chooseNutriscoreMax`
now takes `NutriScore?`.
- l10n: removed `filterNutriscoreMax`; added `filterNutriscoreOff`,
`filterNutriscoreNoFilter`, `filterNutriscoreOrBetter` (placeholder).
Tests updated: 61/61 pass.
Adds a "Filter by Nutri-Score" switch and an A–E discrete slider to
the ingredient search filter popover. The worst acceptable grade is
sent to the backend as `nutriscore__lte=<a|b|c|d|e>`, matching the
new filter exposed by wger-project/wger#2295.
- Extend `IngredientFilters` with `filterNutriscore` + `nutriscoreMax`
- Persist both settings through `PreferenceHelper`
- Expose `toggleNutriscore` and `chooseNutriscoreMax` on the riverpod
notifier
- Propagate `nutriscoreMax` through `NutritionPlansProvider.searchIngredient`
- Add English strings `filterNutriscore` / `filterNutriscoreMax`
- Widget tests cover: slider hidden until switch flipped, query emitted
with/without the filter
- Update stale generated Mockito overrides across the four test files
that mock `NutritionPlansProvider` so the new named arg lines up
Refs wger-project/wger#2295
We can simply use the regular "exerciseinfo" endpoint, like we do for
ingredients. We still call fetchAndSetExercise for them, which is not
efficient, but
When adding an extra exercise during a workout, addExerciseAfterPage()
creates a SetConfigData with no unit objects loaded. Log.fromSetConfigData
was using the weightUnit/repetitionUnit setters which overwrite the default
IDs with null when the objects are null, causing the server to reject the
request with a ValidationError ("Repetitions unit must be present").
Fixes#1149
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This allows the user to add different slots (sets) to an exercise, like
10 x 10kg, 8 x 12kg, 6 x 15kg. Also note that this is purely a UI change,
as it was already possible to simply add the same exercise again.
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>