Offline gym log for Android. No account, no ads, no internet.
Dart androidbodybuildingdartexercisesf-droidfitnessfluttergymgym-apphealthprivacyself-hostedworkoutworkout-appworkout-tracker
Update tests, dependencies and README
InlitX802a3b62392d
diff --git a/README.md b/README.mdindex fcab589..440bd86 100644--- a/README.md+++ b/README.md@@ -157,7 +157,21 @@ which APK? Take `arm64-v8a`.| Android 7.0+ | Supported || Wear OS 3+ | In progress || iOS 15+ | In progress |-| Desktop | Planned |+| Web, self-hosted | Supported |++### Self-hosted++The full app also runs in the browser from your own server, laid out for big+screens, with your data in one folder on that machine:++```sh+curl -fsSLO https://raw.githubusercontent.com/InlitX/GymMane/main/compose.yaml+docker compose up -d+```++No Docker? There's a one-line installer for Linux and macOS and a zip for+Windows. Everything, including syncing with the phone through Syncthing, is in+[SELFHOST.md](SELFHOST.md).## Privacydiff --git a/analysis_options.yaml b/analysis_options.yamlindex 317ff8e..522ae17 100644--- a/analysis_options.yaml+++ b/analysis_options.yaml@@ -5,6 +5,8 @@ analyzer:- lib/l10n/app_localizations*.dart- build/**- android/**+ - server/**+ - packages/**formatter:page_width: 110diff --git a/pubspec.lock b/pubspec.lockindex e160e74..527361f 100644--- a/pubspec.lock+++ b/pubspec.lock@@ -349,6 +349,13 @@ packages:description: fluttersource: sdkversion: "0.0.0"+ gymmane_merge:+ dependency: "direct main"+ description:+ path: "packages/gymmane_merge"+ relative: true+ source: path+ version: "1.0.0"home_widget:dependency: "direct main"description:@@ -995,7 +1002,7 @@ packages:source: hostedversion: "15.2.0"web:- dependency: transitive+ dependency: "direct main"description:name: websha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"diff --git a/pubspec.yaml b/pubspec.yamlindex 36c2ac6..b26b3b9 100644--- a/pubspec.yaml+++ b/pubspec.yaml@@ -27,9 +27,12 @@ dependencies:url_launcher: ^6.3.2video_player: ^2.9.2archive: ^4.0.9+ gymmane_merge:+ path: packages/gymmane_mergebarcode: ^2.2.9zxing2: ^0.2.4app_settings: ^8.0.3+ web: ^1.1.1dev_dependencies:flutter_test:diff --git a/test/calculators_test.dart b/test/calculators_test.dartindex a672270..4d60a5e 100644--- a/test/calculators_test.dart+++ b/test/calculators_test.dart@@ -5,7 +5,7 @@ import 'package:gymmane/state/fit_state.dart';void main() {test('every tool in the menu has a screen behind it', () {expect(kToolMeta.map((t) => t.id).toSet(),- {'rm', 'bmi', 'cal', 'bf', 'ffmi', 'plate', 'warmup', 'rpe', 'dots', 'wilks'});+ {'rm', 'bmi', 'cal', 'bf', 'ffmi', 'plate', 'warmup', 'rpe', 'dots', 'wilks', 'protein', 'water'});for (final t in kToolMeta) {expect(t.name.trim(), isNotEmpty);expect(t.desc.trim(), isNotEmpty);@@ -213,4 +213,17 @@ void main() {expect(fit.bmiWeight, fit.profile.weightKg);fit.updateProfile(sex: 'male');});++ test('protein and water follow weight, goal and training', () {+ fit.protWeight = 80;+ fit.setProtGoal('hold');+ expect((fit.protLow, fit.protHigh), (110, 145));+ fit.setProtGoal('lose');+ expect((fit.protLow, fit.protHigh), (145, 175));+ fit.waterWeight = 80;+ fit.waterMinutes = 0;+ expect(fit.waterLiters, 2.8);+ fit.bumpWaterMinutes(60);+ expect(fit.waterLiters, 3.5);+ });}diff --git a/test/nutrition_beta_keys.txt b/test/nutrition_beta_keys.txtindex a65e919..95d2473 100644--- a/test/nutrition_beta_keys.txt+++ b/test/nutrition_beta_keys.txt@@ -35,6 +35,7 @@ mealPlanNewmealPlansTitlemovedMealToastmovedToDay+notifSuppTakenotifSuppTapnotifSuppTitleForperDayUnitdiff --git a/test/nutrition_test.dart b/test/nutrition_test.dartindex aae70c9..1c90e48 100644--- a/test/nutrition_test.dart+++ b/test/nutrition_test.dart@@ -7,6 +7,7 @@ import 'package:gymmane/models/nutrition.dart';import 'package:gymmane/models/workout.dart';import 'package:gymmane/services/food_library.dart';import 'package:gymmane/services/local_store.dart';+import 'package:gymmane/services/supplement_reminder.dart';import 'package:gymmane/services/sticker_cutout.dart';import 'package:gymmane/state/fit_state.dart';import 'package:shared_preferences/shared_preferences.dart';@@ -117,6 +118,22 @@ void main() {expect(fit.takenOn(DateTime.now()), isEmpty);expect(fit.addSupplement(' '), isNull);});++ test('#354 «Tomado» desde el aviso marca ese día sin desmarcar si ya estaba', () {+ final a = fit.addSupplement('Creatina')!;+ final b = fit.addSupplement('Omega 3')!;+ final at = DateTime.now().subtract(const Duration(days: 1));+ final day = DateTime(at.year, at.month, at.day);+ final payload = SupplementReminder.payloadFor(at, [a.id, b.id]);+ expect(SupplementReminder.idsOf(payload), [a.id, b.id]);+ expect(SupplementReminder.dayOf(payload), day);+ expect(SupplementReminder.idsOf('supp:${a.id}'), [a.id]);+ fit.takeSupplementsOn(day, [a.id, b.id, 'nope']);+ expect(fit.takenOn(day), {a.id, b.id});+ fit.takeSupplementsOn(day, [a.id]);+ expect(fit.takenOn(day), {a.id, b.id});+ expect(fit.takenOn(DateTime.now()), isEmpty);+ });});group('objetivos', () {@@ -287,6 +304,20 @@ void main() {expect(r.total.kcal, greaterThan(400));});+ test('#355 la foto de una comida guardada se conserva al editarla y al guardar', () {+ final dish = fit.searchDishes('arroz con pollo').single;+ final r = fit.saveRecipe('Mi arroz', dish.items, photo: 'recipe_1.jpg')!;+ expect(r.photo, 'recipe_1.jpg');+ fit.updateRecipe(r.id, dish.items.take(1).toList());+ fit.renameRecipe(r.id, 'Arroz');+ final kept = fit.recipes.single;+ expect(kept.photo, 'recipe_1.jpg');+ expect(Recipe.fromJson(kept.toJson()).photo, 'recipe_1.jpg');+ fit.setRecipePhoto(r.id, '');+ expect(fit.recipes.single.photo, isEmpty);+ expect(fit.recipes.single.toJson().containsKey('ph'), isFalse);+ });+test('se buscan sin tildes y no se guardan solos', () {expect(fit.searchDishes('bolonesa').single.name, 'Espaguetis a la boloñesa');final r = fit.searchDishes('cafe con leche').single;diff --git a/test/rest_timer_test.dart b/test/rest_timer_test.dartindex ce35e66..9f107d1 100644--- a/test/rest_timer_test.dart+++ b/test/rest_timer_test.dart@@ -54,6 +54,55 @@ void main() {fit.saveAndExit();});+ test('#346 descanso al cambiar de ejercicio tras la última serie', () {+ final bench = fit.matchExerciseByName('Bench Press')!.id;+ final squat = fit.matchExerciseByName('Squat')!.id;+ fit.startRoutine(routineOf([bench, squat]));+ fit.endCountdown();+ fit.setChangeRest(150);+ final n = fit.session!.exercises[0].sets.length;+ final normal = fit.normalRestAfter(0, 0);+ expect(normal, isNot(150));+ for (var i = 0; i < n - 1; i++) {+ fit.toggleSet(0, i);+ expect(fit.restTotal, normal);+ fit.skipRest();+ }+ expect(fit.normalRestAfter(0, n - 1), 150);+ fit.toggleSet(0, n - 1);+ expect(fit.restTotal, 150);+ fit.skipRest();+ fit.setChangeRest(0);+ fit.saveAndExit();+ });++ test('#357 descanso entre lados: el primer check cierra un lado', () {+ final curl = fit.matchExerciseByName('Dumbbell Curl')!.id;+ if (!fit.isSidedReps(curl)) fit.toggleSidedReps(curl);+ fit.startRoutine(routineOf([curl]));+ fit.endCountdown();+ fit.setSideRest(30);+ final st = fit.session!.exercises[0].sets.firstWhere((x) => x.repsR != null);+ final j = fit.session!.exercises[0].sets.indexOf(st);+ fit.toggleSet(0, j);+ expect(st.half, isTrue);+ expect(st.done, isFalse);+ expect(fit.restTotal, 30);+ expect(fit.session!.restSwitch, isTrue);+ fit.toggleSet(0, j);+ expect(st.done, isTrue);+ expect(st.half, isFalse);+ expect(fit.session!.restSwitch, isFalse);+ fit.skipRest();+ fit.setSideRest(0);+ fit.toggleSet(0, j);+ fit.toggleSet(0, j);+ expect(st.done, isTrue);+ expect(st.half, isFalse);+ fit.toggleSidedReps(curl);+ fit.saveAndExit();+ });+test('fija el descanso al tiempo elegido', () {rest();fit.setRest(200);diff --git a/test/units_test.dart b/test/units_test.dartindex adc12da..f07e4dd 100644--- a/test/units_test.dart+++ b/test/units_test.dart@@ -121,4 +121,19 @@ void main() {fit.setExerciseUnits(id, 'kg');expect(fit.exerciseUnits.containsKey(id), isFalse, reason: 'igual que la app no se guarda');});++ test('#358 un cardio puede ir en km aunque la app vaya en lb', () {+ fit.setUnits('lb');+ final id = fit.allExercises.firstWhere((e) => fit.modeOf(e.id) == 'cardio').id;+ expect(fit.distanceUnitFor(id), 'mi');+ fit.setExerciseDistance(id, 'km');+ expect(fit.distanceUnitFor(id), 'km');+ expect(fit.distanceUnit, 'mi');+ expect(fit.distanceLabelFor(id, 5), '5 km');+ expect(fit.fromDisplayKmFor(id, 3), 3);+ expect(fit.toJson()['exDist'], {id: 'km'});+ fit.setExerciseDistance(id, 'mi');+ expect(fit.exerciseDistance.containsKey(id), isFalse, reason: 'igual que la app no se guarda');+ fit.setUnits('kg');+ });}