diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index d273b9da2..39d865df8 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -15,6 +15,7 @@
metric its import. Guarded by health_manifest_test.dart -->
+
diff --git a/lib/features/health/models/health_metric.dart b/lib/features/health/models/health_metric.dart
index b7669247e..609f200ce 100644
--- a/lib/features/health/models/health_metric.dart
+++ b/lib/features/health/models/health_metric.dart
@@ -180,6 +180,15 @@ const List healthMetrics = [
toCategoryValue: _bodyFatToPercent,
enabled: true,
),
+ HealthMetric(
+ // Both platforms report kilograms, like body weight. Unlike it, the
+ // category holds only kg: the per-entry unit of locked decision #9 is
+ // body weight's alone.
+ metricType: MetricType.leanBodyMass,
+ dataType: HealthDataType.LEAN_BODY_MASS,
+ toCategoryValue: _identity,
+ enabled: true,
+ ),
HealthMetric(
metricType: MetricType.height,
dataType: HealthDataType.HEIGHT,
diff --git a/lib/features/measurements/models/measurement_category.dart b/lib/features/measurements/models/measurement_category.dart
index 1886e0d0f..5b5083c7c 100644
--- a/lib/features/measurements/models/measurement_category.dart
+++ b/lib/features/measurements/models/measurement_category.dart
@@ -179,6 +179,7 @@ enum MetricType {
custom('custom'),
bodyWeight('body_weight'),
bodyFat('body_fat'),
+ leanBodyMass('lean_body_mass'),
height('height'),
bloodPressure('blood_pressure'),
bloodPressureSystolic('blood_pressure_systolic'),
@@ -306,6 +307,7 @@ enum MetricType {
MetricType.custom => '',
MetricType.bodyWeight => 'Weight',
MetricType.bodyFat => 'Body fat',
+ MetricType.leanBodyMass => 'Lean body mass',
MetricType.height => 'Height',
MetricType.bloodPressure => 'Blood pressure',
MetricType.bloodPressureSystolic => 'Systolic',
@@ -332,7 +334,7 @@ enum MetricType {
/// follows the profile.
String get defaultUnit => switch (this) {
MetricType.custom => '',
- MetricType.bodyWeight => 'kg',
+ MetricType.bodyWeight || MetricType.leanBodyMass => 'kg',
MetricType.bodyFat || MetricType.bloodOxygen => '%',
MetricType.height => 'cm',
MetricType.bloodPressure ||
@@ -364,7 +366,10 @@ enum MetricType {
/// context. Custom categories are typically hand-kept body measurements
/// (waist, biceps), so they qualify; the typed health metrics do not.
bool get correlatesWithNutrition => switch (this) {
- MetricType.bodyWeight || MetricType.bodyFat || MetricType.custom => true,
+ MetricType.bodyWeight ||
+ MetricType.bodyFat ||
+ MetricType.leanBodyMass ||
+ MetricType.custom => true,
_ => false,
};
@@ -380,6 +385,8 @@ enum MetricType {
MetricType.bodyWeight =>
unit == 'lb' ? const MetricLimits(44, 770, 66, 661) : const MetricLimits(20, 350, 30, 300),
MetricType.bodyFat => const MetricLimits(2, 60, 5, 50),
+ // Always below the body weight it is part of, so the floor can sit lower
+ MetricType.leanBodyMass => const MetricLimits(10, 250, 30, 90),
MetricType.height => const MetricLimits(50, 250, 140, 210),
MetricType.bloodPressureSystolic => const MetricLimits(50, 250, 90, 180),
MetricType.bloodPressureDiastolic => const MetricLimits(30, 150, 50, 110),
@@ -420,6 +427,7 @@ enum MetricType {
num? binWidth([String? unit]) => switch (this) {
MetricType.bodyWeight => unit == 'lb' ? 1 : 0.5,
MetricType.bodyFat => 0.5,
+ MetricType.leanBodyMass => 0.5,
MetricType.height => 1,
MetricType.bloodPressureSystolic || MetricType.bloodPressureDiastolic => 5,
MetricType.heartRate => 2,
@@ -445,6 +453,7 @@ extension MeasurementMetricTypeL10n on MetricType {
MetricType.custom => l10n.metricCustom,
MetricType.bodyWeight => l10n.metricBodyWeight,
MetricType.bodyFat => l10n.metricBodyFat,
+ MetricType.leanBodyMass => l10n.metricLeanBodyMass,
MetricType.height => l10n.metricHeight,
MetricType.bloodPressure => l10n.metricBloodPressure,
MetricType.bloodPressureSystolic => l10n.metricBloodPressureSystolic,
diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb
index 844d600a3..763df614e 100644
--- a/lib/l10n/app_de.arb
+++ b/lib/l10n/app_de.arb
@@ -1136,6 +1136,7 @@
"reorderCategories": "Kategorien neu anordnen",
"metricCustom": "Benutzerdefiniert",
"metricBodyWeight": "Körpergewicht",
+ "metricLeanBodyMass": "Magermasse",
"metricBodyFat": "Körperfett",
"metricHeight": "Körpergröße",
"metricBloodPressure": "Blutdruck",
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index d6003ad2e..ea62eab67 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -730,6 +730,10 @@
"@metricBodyWeight": {
"description": "Label for body weight measurement"
},
+ "metricLeanBodyMass": "Lean body mass",
+ "@metricLeanBodyMass": {
+ "description": "Label for lean body mass measurement"
+ },
"metricBodyFat": "Body fat",
"@metricBodyFat": {
"description": "Label for body fat percentage measurement"
diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb
index 046cf3a8e..bf3f3651a 100644
--- a/lib/l10n/app_es.arb
+++ b/lib/l10n/app_es.arb
@@ -1175,6 +1175,7 @@
"reorderCategories": "Reordenar categorías",
"metricCustom": "Personalizado",
"metricBodyWeight": "Peso corporal",
+ "metricLeanBodyMass": "Masa magra",
"metricBodyFat": "Grasa corporal",
"metricHeight": "Altura",
"metricBloodPressure": "Presión arterial",
diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb
index c0cb4dee7..6bc506280 100644
--- a/lib/l10n/app_fr.arb
+++ b/lib/l10n/app_fr.arb
@@ -1146,6 +1146,7 @@
"reorderCategories": "Réorganiser les catégories",
"metricCustom": "Personnalisé",
"metricBodyWeight": "Poids corporel",
+ "metricLeanBodyMass": "Masse maigre",
"metricBodyFat": "Graisse corporelle",
"metricHeight": "Taille",
"metricBloodPressure": "Pression artérielle",
diff --git a/test/features/health/health_manifest_test.dart b/test/features/health/health_manifest_test.dart
index ec4d85aae..3a03bab0c 100644
--- a/test/features/health/health_manifest_test.dart
+++ b/test/features/health/health_manifest_test.dart
@@ -29,6 +29,7 @@ import 'package:wger/features/health/models/health_metric.dart';
const _readPermissions = {
HealthDataType.WEIGHT: 'android.permission.health.READ_WEIGHT',
HealthDataType.BODY_FAT_PERCENTAGE: 'android.permission.health.READ_BODY_FAT',
+ HealthDataType.LEAN_BODY_MASS: 'android.permission.health.READ_LEAN_BODY_MASS',
HealthDataType.HEIGHT: 'android.permission.health.READ_HEIGHT',
HealthDataType.BLOOD_PRESSURE_SYSTOLIC: 'android.permission.health.READ_BLOOD_PRESSURE',
HealthDataType.BLOOD_PRESSURE_DIASTOLIC: 'android.permission.health.READ_BLOOD_PRESSURE',
diff --git a/test/features/health/models/health_metric_test.dart b/test/features/health/models/health_metric_test.dart
index 417577fe8..b0959d382 100644
--- a/test/features/health/models/health_metric_test.dart
+++ b/test/features/health/models/health_metric_test.dart
@@ -30,6 +30,7 @@ void main() {
enabledHealthMetrics.map((m) => m.metricType),
containsAll([
MetricType.bodyFat,
+ MetricType.leanBodyMass,
MetricType.height,
MetricType.bodyWeight,
MetricType.bloodPressure,
@@ -42,7 +43,7 @@ void main() {
MetricType.energy,
]),
);
- expect(enabledHealthMetrics.length, 11);
+ expect(enabledHealthMetrics.length, 12);
});
test('daily aggregation is set per metric', () {