Skip to content

Offline gym log for Android. No account, no ads, no internet.

Platform and settings adjustments for iOS

InlitX3a747348b15f
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index bf38dce..889ade4 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -463,6 +463,7 @@ class SettingsScreen extends StatelessWidget {
hint: t.trainReminderRowHint,
),
),
+ if (Platform.isAndroid)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => showAppSheet<void>(
@@ -563,7 +564,7 @@ class SettingsScreen extends StatelessWidget {
const SizedBox(width: 6),
Icon(PhosphorIconsBold.caretRight, size: 14, color: gc.textTertiary),
]),
- hint: t.healthSettingHint),
+ hint: health(t.healthSettingHint)),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
@@ -767,7 +768,7 @@ class SettingsScreen extends StatelessWidget {
(t.homeRecommended, PhosphorIconsRegular.sparkle),
(t.homeRoutines, PhosphorIconsRegular.folders),
(t.homeWeekStats, PhosphorIconsRegular.chartBar),
- (t.stepsSetting, PhosphorIconsRegular.footprints),
+ (health(t.stepsSetting), PhosphorIconsRegular.footprints),
(t.healthSetting, PhosphorIconsRegular.heartbeat),
(t.gamificationSetting, PhosphorIconsRegular.medal),
(t.gymPass, PhosphorIconsRegular.qrCode),
diff --git a/lib/services/device_kind.dart b/lib/services/device_kind.dart
index bd84090..ce5dda9 100644
--- a/lib/services/device_kind.dart
+++ b/lib/services/device_kind.dart
@@ -13,7 +13,7 @@ class DeviceKind {
static Future<bool> isLowEnd() async {
if (lowEndOverride case final forced?) return forced;
- if (kIsWeb || !Platform.isAndroid) return false;
+ if (kIsWeb || !(Platform.isAndroid || Platform.isIOS)) return false;
try {
return await _channel.invokeMethod<bool>('isLowEnd') ?? false;
} catch (_) {
diff --git a/lib/services/headphones.dart b/lib/services/headphones.dart
index 8989196..de293ce 100644
--- a/lib/services/headphones.dart
+++ b/lib/services/headphones.dart
@@ -9,7 +9,7 @@ class Headphones {
static const _channel = MethodChannel('gymmane/device');
static Future<bool> connected() async {
- if (kIsWeb || !Platform.isAndroid) return false;
+ if (kIsWeb || !(Platform.isAndroid || Platform.isIOS)) return false;
try {
return await _channel.invokeMethod<bool>('headphones') ?? false;
} catch (_) {
diff --git a/lib/services/voice_coach.dart b/lib/services/voice_coach.dart
index 7460729..3265fe0 100644
--- a/lib/services/voice_coach.dart
+++ b/lib/services/voice_coach.dart
@@ -10,28 +10,28 @@ class VoiceCoach {
static bool enabled = true;
static Future<void> say(String text, String lang) async {
- if (!enabled || kIsWeb || !Platform.isAndroid || text.trim().isEmpty) return;
+ if (!enabled || kIsWeb || !(Platform.isAndroid || Platform.isIOS) || text.trim().isEmpty) return;
try {
await _channel.invokeMethod('say', {'text': text, 'lang': lang});
} catch (_) {}
}
static Future<void> sayAndWait(String text, String lang) async {
- if (kIsWeb || !Platform.isAndroid || text.trim().isEmpty) return;
+ if (kIsWeb || !(Platform.isAndroid || Platform.isIOS) || text.trim().isEmpty) return;
try {
await _channel.invokeMethod('sayWait', {'text': text, 'lang': lang});
} catch (_) {}
}
static Future<void> stop() async {
- if (!enabled || kIsWeb || !Platform.isAndroid) return;
+ if (!enabled || kIsWeb || !(Platform.isAndroid || Platform.isIOS)) return;
try {
await _channel.invokeMethod('stop');
} catch (_) {}
}
static Future<String> check(String lang) async {
- if (kIsWeb || !Platform.isAndroid) return 'noEngine';
+ if (kIsWeb || !(Platform.isAndroid || Platform.isIOS)) return 'noEngine';
try {
return await _channel.invokeMethod<String>('check', {'lang': lang}) ?? 'noEngine';
} catch (_) {
@@ -40,7 +40,7 @@ class VoiceCoach {
}
static Future<void> openSettings() async {
- if (kIsWeb || !Platform.isAndroid) return;
+ if (kIsWeb || !(Platform.isAndroid || Platform.isIOS)) return;
try {
await _channel.invokeMethod('settings');
} catch (_) {}
diff --git a/lib/state/fit_state.dart b/lib/state/fit_state.dart
index 4c2f78e..b1d3212 100644
--- a/lib/state/fit_state.dart
+++ b/lib/state/fit_state.dart
@@ -292,6 +292,8 @@ class FitState extends FitCore
showRecommended = data['showRecs'] as bool? ?? true;
showWeekStats = data['showWeek'] as bool? ?? true;
showRoutineRow = data['showRoutineRow'] as bool? ?? true;
+ homeOrder = [...((data['homeOrder'] as List?) ?? const []).whereType<String>()];
+ customGear = [...((data['customGear'] as List?) ?? const []).whereType<String>()];
levelHints = data['levelHints'] as bool? ?? true;
toastSound = data['toastSound'] as bool? ?? true;
final auto = data['autoProgress'] as String? ?? 'off';
@@ -551,6 +553,8 @@ class FitState extends FitCore
'showRecs': showRecommended,
'showWeek': showWeekStats,
'showRoutineRow': showRoutineRow,
+ if (homeOrder.isNotEmpty) 'homeOrder': homeOrder,
+ if (customGear.isNotEmpty) 'customGear': customGear,
'levelHints': levelHints,
'toastSound': toastSound,
if (autoProgress != 'off') 'autoProgress': autoProgress,
@@ -778,6 +782,8 @@ class FitState extends FitCore
highRefresh = false;
showWeekStats = true;
showRoutineRow = true;
+ homeOrder = List.of(kHomeBlocks);
+ customGear = [];
levelHints = true;
toastSound = true;
autoProgress = 'off';
@@ -1034,7 +1040,8 @@ class FitState extends FitCore
' "exercises": [\n'
' {"name": "Barbell Bench Press", "sets": 4, "reps": 8, "weight": 60, "rest": 120,\n'
' "plan": [{"type": "warmup", "reps": 10, "weight": 30}]},\n'
- ' {"name": "Barbell Bent Over Row", "sets": 4, "reps": 8, "superset": true},\n'
+ ' {"name": "Barbell Bent Over Row", "reps": 8, "superset": true,\n'
+ ' "plan": [{"reps": 8, "weight": 50}, {"reps": 8, "weight": 50}, {"reps": 6, "weight": 45}]},\n'
' {"name": "Dumbbell Biceps Curl", "sets": 3, "reps": 12}\n'
' ]\n'
' },\n'
@@ -1215,6 +1222,7 @@ class FitState extends FitCore
for (final p in item.plan)
PlannedSet(
reps: p.reps ?? item.reps,
+ repsMax: p.reps == null ? item.repsMax : p.repsMax,
weightKg: p.weightKg ?? (p.kind == SetKind.warmup.index ? null : item.weightKg),
kind: setKindFrom(p.kind),
sec: p.sec ?? item.sec,
@@ -1228,7 +1236,7 @@ class FitState extends FitCore
return [
...explicit,
for (var i = working; i < wanted.clamp(0, 20); i++)
- PlannedSet(reps: item.reps, weightKg: item.weightKg, sec: item.sec, km: item.km),
+ PlannedSet(reps: item.reps, repsMax: item.repsMax, weightKg: item.weightKg, sec: item.sec, km: item.km),
];
}
@@ -1259,6 +1267,7 @@ class FitState extends FitCore
{
if (p.kind != SetKind.normal) 'type': _kindNames[p.kind.index],
if (p.reps != null) 'reps': p.reps,
+ if (p.repsMax != null) 'repsMax': p.repsMax,
if (p.weightKg != null) 'weight': _round3(p.weightKg!),
if (p.sec != null) 'time': p.sec,
if (p.km != null) 'distance': p.km,
diff --git a/lib/state/settings_state.dart b/lib/state/settings_state.dart
index fd29f6f..1406b6c 100644
--- a/lib/state/settings_state.dart
+++ b/lib/state/settings_state.dart
@@ -2,6 +2,8 @@ part of 'fit_state.dart';
const String kBgPhotoId = 'bg';
+const List<String> kHomeBlocks = ['weekdays', 'steps', 'week', 'routines', 'activity', 'recommended', 'folders', 'nutrition'];
+
mixin SettingsState on FitCore, ToolsState, LibraryState {
String themePref = 'dark';
@@ -35,6 +37,8 @@ mixin SettingsState on FitCore, ToolsState, LibraryState {
bool showRecommended = true;
bool showWeekStats = true;
bool showRoutineRow = true;
+ List<String> homeOrder = List.of(kHomeBlocks);
+ List<String> customGear = [];
bool levelHints = true;
bool toastSound = true;
String autoProgress = 'off';
@@ -608,6 +612,38 @@ mixin SettingsState on FitCore, ToolsState, LibraryState {
notifyListeners();
}
+ List<String> get homeOrderShown {
+ final out = [
+ for (final id in homeOrder)
+ if (kHomeBlocks.contains(id)) id,
+ ];
+ for (final (i, id) in kHomeBlocks.indexed) {
+ if (!homeOrder.contains(id)) out.insert(i < out.length ? i : out.length, id);
+ }
+ return out;
+ }
+
+ String addCustomGear(String name) {
+ final clean = name.trim();
+ final all = [...kEquipment, ...customGear];
+ for (final e in all) {
+ if (e.toLowerCase() == clean.toLowerCase()) return e;
+ }
+ customGear = [...customGear, clean];
+ _persist();
+ notifyListeners();
+ return clean;
+ }
+
+ void setHomeOrder(List<String> order) {
+ homeOrder = [
+ for (final id in order)
+ if (kHomeBlocks.contains(id)) id,
+ ];
+ _persist();
+ notifyListeners();
+ }
+
void toggleRecommended() {
showRecommended = !showRecommended;
_persist();
diff --git a/lib/widgets/ui_kit.dart b/lib/widgets/ui_kit.dart
index 41fe34f..e439218 100644
--- a/lib/widgets/ui_kit.dart
+++ b/lib/widgets/ui_kit.dart
@@ -807,6 +807,7 @@ class StepperControl extends StatelessWidget {
required this.onDec,
required this.onInc,
this.onEdit,
+ this.onLongPress,
this.minWidth = 70,
this.btnSize = 30,
this.gap = 14,
@@ -818,6 +819,7 @@ class StepperControl extends StatelessWidget {
final VoidCallback onDec;
final VoidCallback onInc;
final VoidCallback? onEdit;
+ final VoidCallback? onLongPress;
final double minWidth;
final double btnSize;
final double gap;
@@ -843,7 +845,7 @@ class StepperControl extends StatelessWidget {
child: RollingText(value, style: AppTheme.f(fontSize, weight: FontWeight.w700, color: gc.text)),
);
if (onEdit != null) {
- label = GestureDetector(behavior: HitTestBehavior.opaque, onTap: onEdit, child: label);
+ label = GestureDetector(behavior: HitTestBehavior.opaque, onTap: onEdit, onLongPress: onLongPress, child: label);
}
return Ltr(
child: Row(