diff --git a/AGENTS.md b/AGENTS.md index a08083e9..3a4e61c8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -160,7 +160,7 @@ days / 36 sleep sessions to zero. **iOS has no connect-time demo purge anywhere* deletion of seeded rows is user-initiated inside `SeedData`, and it handles the demo/real mix by *detecting* it (`isDemo`, `source == "mock"`, `DataFreshness.demo`) and adapting the UI. Demo data coexisting with a real ring is an expected state. Demo rows are retired only from -Settings → Privacy & Data → Clear Demo Data. +Settings → Backup & data → Clear Demo Data. `ConnectPurge` now has exactly **one** member, `NOTHING`, and the single-branch `when`s that switch on it in `EventPersistenceSubscriber` and `EventPersistenceIdentityTest` read as dead code but are @@ -1116,5 +1116,10 @@ clutter came from ignoring one of them: on Postpartum stays even though Drinks has one: "can I feed now?" is asked on that screen. - **Notifications are reachable whether or not the coach is on.** Most of them (daily guidance, battery alerts) never needed it, and gating the row on the coach hid them all. +- **Settings groups are jobs, named as jobs** (`SettingsScreen`): My ring, Notifications, Goals & + tracking, AI Coach, Connected apps, Me, Data & privacy. A new setting goes where someone + arriving with that job would look — sleep-hour rules sit with the sleep goal, every unit sits + on the profile, the ring is unpaired from Ring & sync only — and a content screen is never a + Settings row (Drinks used to be one). - **A goal saved anywhere goes through `GoalSync.afterManualSave`** — it is what stops the field following the coach, sends the step goal to the ring and republishes the widget. diff --git a/app/src/main/assets/i18n/pt-BR.json b/app/src/main/assets/i18n/pt-BR.json index 2d38c098..8e2c8ec5 100644 --- a/app/src/main/assets/i18n/pt-BR.json +++ b/app/src/main/assets/i18n/pt-BR.json @@ -80,7 +80,7 @@ "A nudge about 30 minutes before your suggested bedtime.": "Um lembrete cerca de 30 minutos antes do horário sugerido para dormir.", "A painful, red or swollen leg or arm": "Uma perna ou braço dolorido, vermelho ou inchado", "A record for you and your doctor. PulseLoop doesn't check interactions or doses; ask your pharmacist.": "Um registro para você e seu médico. O PulseLoop não verifica interações nem doses; consulte seu farmacêutico.", - "A ring is paired. Forget it in Settings → Wearable first: the two would count the same steps and nights.": "Há um anel pareado. Esqueça-o primeiro em Configurações → Wearable: os dois contariam os mesmos passos e noites.", + "A ring is paired. Forget it in Settings → Ring & sync first: the two would count the same steps and nights.": "Há um anel pareado. Esqueça-o primeiro em Configurações → Anel e sincronização: os dois contariam os mesmos passos e noites.", "A screening questionnaire, not a diagnosis.": "Um questionário de rastreamento, não um diagnóstico.", "A solid active day so far.": "Um dia ativo e consistente até agora.", "A steady week. Keep it up.": "Uma semana estável. Continue assim.", @@ -219,6 +219,7 @@ "Back up now": "Fazer backup agora", "Backend proxy": "Proxy de backend", "Backing up…": "Fazendo backup…", + "Backup & data": "Backup e dados", "Balance Macros (30/40/30)": "Equilibrar macros (30/40/30)", "Banana": "Banana", "Barcode": "Código de barras", @@ -244,6 +245,7 @@ "Beta-blockers": "Betabloqueadores", "Beta-blockers lower heart rate; this is expected on that medication.": "Betabloqueadores reduzem a frequência cardíaca; isso é esperado com esse medicamento.", "Blood Pressure": "Pressão arterial", + "Blood glucose": "Glicose no sangue", "Blood oxygen": "Oxigênio no sangue", "Blood oxygen (SpO₂)": "Oxigênio no sangue (SpO₂)", "Blood oxygen (SpO₂) is the percentage of oxygen your blood carries. 95–100% is normal; altitude and lung conditions can lower it.": "O oxigênio no sangue (SpO₂) é a porcentagem de oxigênio que seu sangue transporta. De 95 a 100% é normal; altitude e problemas pulmonares podem reduzi-lo.", @@ -343,6 +345,7 @@ "Connect Strava": "Conectar Strava", "Connect ring": "Conectar anel", "Connected": "Conectado", + "Connected apps": "Apps conectados", "Connected as {0}. Workouts sync automatically when finished.": "Conectado como {0}. Os treinos são sincronizados automaticamente ao terminar.", "Connected to {0}": "Conectado a {0}", "Connected · {0}%": "Conectado · {0}%", @@ -403,6 +406,7 @@ "Daily or almost daily": "Diariamente ou quase", "Daily targets": "Metas diárias", "Dance": "Dança", + "Data & privacy": "Dados e privacidade", "Data Backup": "Backup de dados", "Data Types": "Tipos de dados", "Data behind this score": "Dados por trás desta pontuação", @@ -443,6 +447,7 @@ "Demo Data": "Dados de demonstração", "Describe": "Descrever", "Describe your meal": "Descreva sua refeição", + "Destructive actions: reset app data, or unpair the ring and reset. To only forget the ring, use Ring & sync.": "Ações destrutivas: redefinir os dados do app, ou desparear o anel e redefinir. Para apenas esquecer o anel, use Anel e sincronização.", "Destructive actions: unpair the ring, factory-reset app data, or both.": "Ações destrutivas: desparear o anel, redefinir os dados do app ou ambos.", "Details": "Detalhes", "Detect server & configure": "Detectar servidor e configurar", @@ -620,6 +625,8 @@ "Goal met on {0} of the last {1} days": "Meta atingida em {0} dos últimos {1} dias", "Goal progress: ": "Progresso da meta: ", "Goals": "Metas", + "Goals & sleep": "Metas e sono", + "Goals & tracking": "Metas e acompanhamento", "Goals, scores and Health Connect keep the ring's own count.": "Metas, pontuações e Health Connect mantêm a contagem do próprio anel.", "Good": "Bom", "Good afternoon": "Boa tarde", @@ -665,6 +672,7 @@ "Heart rate stayed at your quiet level with no steps": "A frequência cardíaca ficou no seu nível tranquilo, sem passos", "Heart rate up to {0} bpm": "Frequência cardíaca até {0} bpm", "Heart rate variability": "Variabilidade da frequência cardíaca", + "Heart rate variability (HRV)": "Variabilidade da frequência cardíaca (VFC)", "Heart rate when active": "Frequência cardíaca em atividade", "Heart rate {0} → {1} bpm": "Frequência cardíaca {0} → {1} bpm", "Heart-rate readings": "Leituras de frequência cardíaca", @@ -852,6 +860,7 @@ "Max": "Máx.", "Max tokens": "Máximo de tokens", "Maçã": "Maçã", + "Me": "Eu", "Meal": "Refeição", "Meal details": "Detalhes da refeição", "Meal name": "Nome da refeição", @@ -905,6 +914,7 @@ "Move {0} up": "Mover {0} para cima", "My Health": "Minha saúde", "My Health & Trends": "Minha saúde e tendências", + "My ring": "Meu anel", "NEXT MEAL IDEA · {0}": "IDEIA PARA A PRÓXIMA REFEIÇÃO · {0}", "NUTRITION": "NUTRIÇÃO", "Name": "Nome", @@ -1058,6 +1068,7 @@ "Overwhelming tiredness": "Cansaço extremo", "Ovos mexidos": "Ovos mexidos", "Own your ring data": "Seus dados do anel são seus", + "Oxygen saturation (SpO₂)": "Saturação de oxigênio (SpO₂)", "PAUSED": "PAUSADO", "Pace": "Ritmo", "Pair a ring to configure its all-day measurements.": "Pareie um anel para configurar as medições contínuas.", @@ -1215,6 +1226,7 @@ "Ride it out": "Aguentar firme", "Right at your limit": "Exatamente no seu limite", "Right at your usual {0} bpm": "Exatamente no seu habitual de {0} bpm", + "Ring & sync": "Anel e sincronização", "Ring Events": "Eventos do anel", "Ring battery alerts": "Alertas de bateria do anel", "Ring blood pressure is an estimate. Calibrate against a validated cuff in Settings → Calibration, and talk to a clinician about persistent high or low readings.": "A pressão arterial do anel é uma estimativa. Calibre com um medidor de braço validado em Configurações → Calibração e converse com um profissional de saúde sobre leituras persistentemente altas ou baixas.", @@ -1382,6 +1394,7 @@ "Step progress": "Progresso de passos", "Step {0} of {1}": "Etapa {0} de {1}", "Steps": "Passos", + "Steps & activity": "Passos e atividade", "Steps a day": "Passos por dia", "Steps collected": "Passos coletados", "Steps {0}{1}%": "Passos {0}{1}%", @@ -1577,6 +1590,7 @@ "Usual": "Habitual", "Usual price of a drink (optional)": "Preço habitual de uma bebida (opcional)", "Usual sleep midpoint {0} · this week {1}": "Ponto médio habitual do sono {0} · esta semana {1}", + "VO₂ max": "VO₂ máx", "Variable nights": "Noites irregulares", "Version": "Versão", "Very high": "Muito alto", @@ -1803,6 +1817,7 @@ "{0} of {1} heart-rate readings from {2} match your ring exactly. ": "{0} de {1} leituras de frequência cardíaca de {2} coincidem exatamente com seu anel. ", "{0} of {1} heart-rate samples match your ring exactly. This looks like PulseLoop's own data coming back — check that the app syncs from your watch only, not from Health Connect.": "{0} de {1} amostras de frequência cardíaca batem exatamente com o seu anel. Parecem ser dados do próprio PulseLoop voltando — confira se o app sincroniza só do seu relógio, não do Health Connect.", "{0} of {1} nights tracked": "{0} de {1} noites registradas", + "{0} of {1} on": "{0} de {1} ativados", "{0} of {1} tracked": "{0} de {1} registrados", "{0} over your limit": "{0} acima do seu limite", "{0} packets captured": "{0} pacotes capturados", diff --git a/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt b/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt index 34860bb4..edb8e418 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt @@ -152,7 +152,7 @@ fun HealthConnectSourceContent(onEnabled: (() -> Unit)? = null) { // Still reading the ring row and the grants: show neither the warning nor the button yet. } else if (hasRing && !enabled) { Text( - tr("A ring is paired. Forget it in Settings → Wearable first: the two would count the same steps and nights."), + tr("A ring is paired. Forget it in Settings → Ring & sync first: the two would count the same steps and nights."), fontSize = 12.sp, color = PulseColors.warning, ) } else if (!canRead) { diff --git a/app/src/main/java/com/pulseloop/ui/screens/SettingsScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/SettingsScreen.kt index c1cf132e..a29c9199 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/SettingsScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/SettingsScreen.kt @@ -125,96 +125,110 @@ fun SettingsScreen( onSetUp = { navigate("pairing") }, ) - // AI COACH. Notifications sit under General, not here: most of them (daily guidance, - // battery alerts) work without the coach and were unreachable while it was off. + // Grouped by the job people arrive with (fix my ring, silence a reminder, change a goal, + // set up the coach, connect an app, edit my details, back up), each named as that job. SettingsSection( - title = tr("AI Coach"), - rows = listOf( - SettingsRowItem(Icons.Filled.AutoAwesome, PulseColors.accent, tr("AI Coach"), coachTrailing) { - navigate("settings/coach") - }, - ), - ) - - // GENERAL — Physiology sits under User Profile (iOS SettingsView General group), feeding the - // optional inputs that tune the vitals reference ranges. Measurement Frequency sits under - // Physiology — only rings that expose a configurable measurement interval (Colmi) declare - // MEASUREMENT_INTERVAL, so the generic 56ff jring never shows this row (iOS #74: dropped the - // old ring-only "Device" section for this since the row had no other members). - SettingsSection( - title = tr("General"), + title = tr("My ring"), rows = buildList { - add(SettingsRowItem(Icons.Filled.AccountCircle, PulseColors.accent, tr("User Profile")) { - navigate("settings/profile") - }) - add(SettingsRowItem(Icons.Filled.MonitorHeart, PulseColors.hrv, tr("Physiology")) { - navigate("settings/physiology") - }) - add(SettingsRowItem(Icons.Filled.NotificationsActive, PulseColors.warning, tr("Notifications")) { - navigate("settings/checkins") - }) - add(SettingsRowItem(Icons.Filled.Language, PulseColors.info, tr("Language"), com.pulseloop.ui.i18n.L10n.language.let { if (it == com.pulseloop.ui.i18n.AppLanguage.SYSTEM) tr("System default") else it.label }) { - navigate("settings/language") + add(SettingsRowItem(Icons.Filled.Watch, PulseColors.accent, tr("Ring & sync")) { + navigate("settings/wearable") }) if (capabilities.contains(WearableCapability.MEASUREMENT_INTERVAL)) { add(SettingsRowItem(Icons.Filled.Timer, PulseColors.spo2, tr("Measurement Frequency")) { navigate("settings/measurement") }) } + // Calibration is jring-only (Colmi rings measure neither BP nor blood sugar). + if (capabilities.contains(WearableCapability.BLOOD_PRESSURE) || + capabilities.contains(WearableCapability.BLOOD_SUGAR) + ) { + add(SettingsRowItem(Icons.Filled.Tune, PulseColors.bloodPressure, tr("Calibration")) { + navigate("settings/calibration") + }) + } + add(SettingsRowItem(Icons.Filled.Watch, PulseColors.info, tr("Use without a ring")) { + navigate("settings/hc-source") + }) }, ) - // METRICS + // Always reachable: most notifications (daily guidance, battery alerts) work without the + // coach, and gating this row on it once hid them all. SettingsSection( - title = tr("Metrics"), + title = tr("Notifications"), rows = listOf( - SettingsRowItem(Icons.Filled.TrackChanges, PulseColors.readiness, tr("Goals")) { + SettingsRowItem(Icons.Filled.NotificationsActive, PulseColors.warning, tr("Notifications")) { + navigate("settings/checkins") + }, + ), + ) + + SettingsSection( + title = tr("Goals & tracking"), + rows = listOf( + SettingsRowItem(Icons.Filled.TrackChanges, PulseColors.readiness, tr("Goals & sleep")) { navigate("settings/goals") }, SettingsRowItem(Icons.Filled.RestaurantMenu, PulseColors.calories, tr("Nutrition")) { navigate("settings/nutrition") }, - SettingsRowItem(Icons.Filled.LocalBar, PulseColors.drinks, tr("Drinks")) { - navigate("drinks") + ), + ) + + SettingsSection( + title = tr("AI Coach"), + rows = listOf( + SettingsRowItem(Icons.Filled.AutoAwesome, PulseColors.accent, tr("AI Coach"), coachTrailing) { + navigate("settings/coach") }, ), ) - // RESOURCES — Calibration is jring-only (Colmi rings measure neither BP nor blood - // sugar); Developer is hidden until unlocked by tapping the version 7× in About. SettingsSection( - title = tr("Resources"), - rows = buildList { - if (capabilities.contains(WearableCapability.BLOOD_PRESSURE) || - capabilities.contains(WearableCapability.BLOOD_SUGAR) - ) { - add(SettingsRowItem(Icons.Filled.Tune, PulseColors.bloodPressure, tr("Calibration")) { - navigate("settings/calibration") - }) - } - if (developerUnlocked) { - add(SettingsRowItem(Icons.Filled.BugReport, PulseColors.danger, tr("Developer")) { - navigate("debug") - }) - } - add(SettingsRowItem(Icons.Filled.Shield, PulseColors.success, tr("Privacy & Data")) { - navigate("settings/privacy") - }) - add(SettingsRowItem(Icons.Filled.TrendingUp, PulseColors.calories, tr("Strava")) { - navigate("settings/strava") - }) - add(SettingsRowItem(Icons.Filled.Sync, PulseColors.success, tr("Health Connect")) { + title = tr("Connected apps"), + rows = listOf( + SettingsRowItem(Icons.Filled.Sync, PulseColors.success, tr("Health Connect")) { navigate("settings/health-connect") - }) - add(SettingsRowItem(Icons.Filled.Watch, PulseColors.info, tr("Use without a ring")) { - navigate("settings/hc-source") - }) - add(SettingsRowItem(Icons.Filled.Verified, PulseColors.info, tr("Accuracy check"), accuracyTrailing) { + }, + SettingsRowItem(Icons.Filled.TrendingUp, PulseColors.calories, tr("Strava")) { + navigate("settings/strava") + }, + SettingsRowItem(Icons.Filled.Verified, PulseColors.info, tr("Accuracy check"), accuracyTrailing) { navigate("settings/accuracy-check") + }, + ), + ) + + SettingsSection( + title = tr("Me"), + rows = listOf( + SettingsRowItem(Icons.Filled.AccountCircle, PulseColors.accent, tr("User Profile")) { + navigate("settings/profile") + }, + SettingsRowItem(Icons.Filled.MonitorHeart, PulseColors.hrv, tr("Physiology")) { + navigate("settings/physiology") + }, + SettingsRowItem(Icons.Filled.Language, PulseColors.info, tr("Language"), com.pulseloop.ui.i18n.L10n.language.let { if (it == com.pulseloop.ui.i18n.AppLanguage.SYSTEM) tr("System default") else it.label }) { + navigate("settings/language") + }, + ), + ) + + // Developer is hidden until unlocked by tapping the version 7× in About. + SettingsSection( + title = tr("Data & privacy"), + rows = buildList { + add(SettingsRowItem(Icons.Filled.Shield, PulseColors.success, tr("Backup & data")) { + navigate("settings/privacy") }) add(SettingsRowItem(Icons.Filled.Info, PulseColors.textMuted, tr("About PulseLoop")) { navigate("settings/about") }) + if (developerUnlocked) { + add(SettingsRowItem(Icons.Filled.BugReport, PulseColors.danger, tr("Developer")) { + navigate("debug") + }) + } }, ) diff --git a/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt b/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt index 4d4dfe36..84948a73 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt @@ -1225,6 +1225,24 @@ fun ProfileSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> Unit, Text(tr("Reset units to auto-detect"), style = MaterialTheme.typography.labelSmall) } } + // Every unit on one screen: glucose used to sit on Physiology, away from the rest. + var glucoseUnit by remember { mutableStateOf(keyStore.preferredGlucoseUnit) } + Row(verticalAlignment = Alignment.CenterVertically) { + Text(tr("Glucose unit"), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f)) + SingleChoiceSegmentedButtonRow { + GlucoseUnit.entries.forEachIndexed { i, u -> + SegmentedButton( + selected = glucoseUnit == u, + onClick = { + glucoseUnit = u + keyStore.preferredGlucoseUnit = u + com.pulseloop.widgets.WidgetSnapshotPublisher.publish(context) + }, + shape = SegmentedButtonDefaults.itemShape(i, GlucoseUnit.entries.size), + ) { Text(u.label) } + } + } + } Button( onClick = { @@ -1280,7 +1298,6 @@ fun PhysiologySettingsScreen(onBack: () -> Unit) { } var betaBlockers by remember { mutableStateOf(keyStore.usesBetaBlockers) } var lungCondition by remember { mutableStateOf(keyStore.hasKnownLungCondition) } - var glucoseUnit by remember { mutableStateOf(keyStore.preferredGlucoseUnit) } var savedMsg by remember { mutableStateOf(null) } SettingsSubScreen(title = tr("Physiology"), onBack = onBack) { @@ -1324,27 +1341,11 @@ fun PhysiologySettingsScreen(onBack: () -> Unit) { TriStateRow(tr("Known lung condition"), lungCondition) { lungCondition = it; savedMsg = null } } - PhysiologyCard(title = tr("Units"), footer = null) { - Row(verticalAlignment = Alignment.CenterVertically) { - Text(tr("Glucose unit"), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f)) - SingleChoiceSegmentedButtonRow { - GlucoseUnit.entries.forEachIndexed { i, u -> - SegmentedButton( - selected = glucoseUnit == u, - onClick = { glucoseUnit = u; savedMsg = null }, - shape = SegmentedButtonDefaults.itemShape(i, GlucoseUnit.entries.size), - ) { Text(u.label) } - } - } - } - } - Button( onClick = { keyStore.athleteMode = athleteMode keyStore.usesBetaBlockers = betaBlockers keyStore.hasKnownLungCondition = lungCondition - keyStore.preferredGlucoseUnit = glucoseUnit val entered = altitudeText.trim().toDoubleOrNull() keyStore.altitudeMeters = if (entered != null && entered > 0) (if (imperial) entered * 0.3048 else entered) else null @@ -1551,7 +1552,7 @@ fun GoalsSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> Unit) { goalDraft = com.pulseloop.ui.onboarding.GoalDraft.from(db.userGoalDao().get(), goalUnits) } - SettingsSubScreen(title = tr("Goals"), onBack = onBack) { + SettingsSubScreen(title = tr("Goals & sleep"), onBack = onBack) { Text( tr("Daily and weekly targets behind the activity rings."), style = MaterialTheme.typography.bodySmall, @@ -1587,6 +1588,8 @@ fun GoalsSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> Unit) { Text(it, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) } } + // Which hours count as sleep is a sleep setting, so it lives with the sleep goal. + QuietHoursCard() } } @@ -1771,7 +1774,8 @@ fun MeasurementSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> U /** * The opt-in quiet-hours gate (issue #79): sleep the ring opens outside the window is ignored on * import. The rationale lives on [QuietHoursPrefs]; this is just the controls — a switch and the - * two window ends, on the Wearable screen because it governs what a sync is allowed to store. + * two window ends, on the Goals & sleep screen beside the sleep goal: people look for "which + * hours count as sleep" with sleep, not with the ring. */ @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -1994,7 +1998,7 @@ fun WearableSettingsScreen( ?.let { DeviceHeroStatus.relativeShort(it, System.currentTimeMillis()) } ?: tr("Not yet") - SettingsSubScreen(title = tr("Wearable"), onBack = onBack) { + SettingsSubScreen(title = tr("Ring & sync"), onBack = onBack) { Card(Modifier.fillMaxWidth()) { Column(Modifier.padding(16.dp)) { Row(verticalAlignment = Alignment.CenterVertically) { @@ -2087,9 +2091,6 @@ fun WearableSettingsScreen( BackgroundSyncCard() } - if (device != null) { - QuietHoursCard() - } if (device != null) { Card(Modifier.fillMaxWidth()) { @@ -2470,7 +2471,7 @@ fun PrivacyDataSettingsScreen( } } - SettingsSubScreen(title = tr("Privacy & Data"), onBack = onBack) { + SettingsSubScreen(title = tr("Backup & data"), onBack = onBack) { // Data Backup — export/import full app data as JSON. Card(Modifier.fillMaxWidth()) { Column(Modifier.padding(16.dp)) { @@ -2538,21 +2539,11 @@ fun PrivacyDataSettingsScreen( Text(tr("App Data"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) Spacer(Modifier.height(8.dp)) Text( - tr("Destructive actions: unpair the ring, factory-reset app data, or both."), + tr("Destructive actions: reset app data, or unpair the ring and reset. To only forget the ring, use Ring & sync."), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, ) Spacer(Modifier.height(12.dp)) - OutlinedButton( - onClick = { pendingReset = ResetAction.UnpairRing }, - modifier = Modifier.fillMaxWidth(), - colors = ButtonDefaults.outlinedButtonColors(contentColor = MaterialTheme.colorScheme.error), - ) { - Icon(Icons.Filled.BluetoothDisabled, null, Modifier.size(16.dp)) - Spacer(Modifier.width(4.dp)) - Text(tr("Unpair Ring")) - } - Spacer(Modifier.height(8.dp)) OutlinedButton( onClick = { pendingReset = ResetAction.ResetAppData }, modifier = Modifier.fillMaxWidth(), @@ -2600,6 +2591,9 @@ fun PrivacyDataSettingsScreen( Card(Modifier.fillMaxWidth()) { Column(Modifier.padding(16.dp)) { var maskSensitive by remember { mutableStateOf(true) } + // The unmasked export is for protocol debugging: only offered once developer + // options are unlocked, so nobody shares raw health frames by accident. + val developer = remember { ApiKeyStore(context).developerUnlocked } Text(tr("Diagnostics"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) Spacer(Modifier.height(8.dp)) Text( @@ -2608,7 +2602,7 @@ fun PrivacyDataSettingsScreen( color = MaterialTheme.colorScheme.onSurfaceVariant, ) Spacer(Modifier.height(12.dp)) - Row(Modifier.switchRow(checked = maskSensitive, onCheckedChange = { maskSensitive = it }), verticalAlignment = Alignment.CenterVertically) { + if (developer) Row(Modifier.switchRow(checked = maskSensitive, onCheckedChange = { maskSensitive = it }), verticalAlignment = Alignment.CenterVertically) { Column(Modifier.weight(1f)) { Text(tr("Anonymize export"), style = MaterialTheme.typography.bodyMedium) Text( @@ -3403,7 +3397,18 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { if (availability == HealthConnectAvailability.AVAILABLE && prefs.isConnected) { Card(Modifier.fillMaxWidth()) { Column(Modifier.padding(16.dp)) { - Text(tr("Data Types"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + // Thirteen switches folded behind one row: most people set this once. + var typesOpen by remember { mutableStateOf(false) } + Row( + Modifier.fillMaxWidth().heightIn(min = 48.dp).clickable { typesOpen = !typesOpen }, + verticalAlignment = Alignment.CenterVertically, + ) { + Text(tr("Data Types"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f)) + Text( + if (typesOpen) tr("Hide") else tr("Show"), + style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary, + ) + } Spacer(Modifier.height(4.dp)) Text( tr("Exported only when switched on. A row stays dim until its permission is granted."), @@ -3433,7 +3438,13 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { HealthConnectPermissions.DataTypeRow.VO2_MAX to "VO\u2082 max", HealthConnectPermissions.DataTypeRow.RESTING_HEART_RATE to "Resting heart rate", ) - for ((row, label) in rows) { + if (!typesOpen) { + Text( + trf("{0} of {1} on", rows.count { (row, _) -> prefs.toggleFor(row) }, rows.size), + style = MaterialTheme.typography.bodyMedium, + ) + } + if (typesOpen) for ((row, label) in rows) { val rowPerms = HealthConnectPermissions.permissionsForRow(row) val rowGranted = rowPerms.isEmpty() || rowPerms.any { it in granted } Row( @@ -3455,7 +3466,7 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { verticalAlignment = Alignment.CenterVertically, ) { Column(Modifier.weight(1f)) { - Text(label, style = MaterialTheme.typography.bodyMedium) + Text(tr(label), style = MaterialTheme.typography.bodyMedium) if (!rowGranted) { Text( tr("Awaiting permission"),