From bf589c14811f883d9a957fc356a753212eedecfc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:13:19 +0000 Subject: [PATCH 1/6] Fix five P2 audit findings: workout snackbar, pairing top bar, chart zoom buttons, Customize cards at the end, MCP auto-off on Android 15 - Detected workout Add/Yes-a-nap now confirms with a snackbar ("Workout added: ", "Nap added") and says when the save failed. The app gets one snackbar host on its Scaffold (AppSnackbar / LocalAppSnackbar), shown on the app's scope so it outlives the card. - Pairing pushed from Settings has a PulseTopBar with a back arrow; onboarding's use is unchanged. - TrendChart offers zoom out / zoom in buttons (48dp, textSecondary) beside the pan slider and reset, so zooming needs no pinch (WCAG 2.5.7). - "Customize cards" leaves the top of Today and Vitals for a quiet text link at the end of the list, which becomes the Done bar in the same place while editing. - MCP auto-off: on Android 15+ the choices are 1/4/6 h and a stored 8 h reads as 6 (McpConfig.autoOffHours, unit-tested), since a dataSync service gets about 6 h a day there. Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w --- AGENTS.md | 3 +- .../main/java/com/pulseloop/mcp/McpConfig.kt | 23 ++++++++++ .../main/java/com/pulseloop/mcp/McpPrefs.kt | 8 ++-- .../java/com/pulseloop/ui/PulseLoopApp.kt | 11 +++++ .../pulseloop/ui/components/AppSnackbar.kt | 41 +++++++++++++++++ .../com/pulseloop/ui/components/Charts.kt | 46 +++++++++++++++---- .../pulseloop/ui/dashboard/DashboardEdit.kt | 23 +++++++--- .../pulseloop/ui/screens/ActivityScreen.kt | 16 ++++++- .../com/pulseloop/ui/screens/PairingScreen.kt | 5 ++ .../java/com/pulseloop/ui/screens/Screens.kt | 17 +++---- .../com/pulseloop/ui/screens/TodayScreen.kt | 15 +++--- .../java/com/pulseloop/mcp/McpAutoOffTest.kt | 44 ++++++++++++++++++ 12 files changed, 212 insertions(+), 40 deletions(-) create mode 100644 app/src/main/java/com/pulseloop/ui/components/AppSnackbar.kt create mode 100644 app/src/test/java/com/pulseloop/mcp/McpAutoOffTest.kt diff --git a/AGENTS.md b/AGENTS.md index b2fad66b..d2051734 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1160,7 +1160,8 @@ their data. Each rule fails silently if broken: `ArchivedSettings`** — a restore on a new phone must start off with nothing paired. - **Off by default, foreground while on, never back by itself**: `START_NOT_STICKY`, no boot receiver, auto-off after the chosen hours (default 8), and stopping for any reason clears the - switch. The notification's tap stops it. Type `dataSync` (Android 15 ends it at its daily + switch. On Android 15+ the choices stop at 6 h and a stored 8 reads as 6 + (`McpConfig.autoOffHours`): a `dataSync` service gets about 6 h a day there. The notification's tap stops it. Type `dataSync` (Android 15 ends it at its daily limit through `onTimeout`; keep that override). - **The `instructions` say it is not a diagnostic tool** and the numbers are estimates — the same rule the coach follows. Keep them in step with the coach's prompt. diff --git a/app/src/main/java/com/pulseloop/mcp/McpConfig.kt b/app/src/main/java/com/pulseloop/mcp/McpConfig.kt index e675c04b..3ab86842 100644 --- a/app/src/main/java/com/pulseloop/mcp/McpConfig.kt +++ b/app/src/main/java/com/pulseloop/mcp/McpConfig.kt @@ -29,4 +29,27 @@ object McpConfig { URL: $url Header: Authorization: Bearer $token """.trimIndent() + + /** + * Android 15 (API 35) gives a `dataSync` foreground service about six hours in every 24, then + * calls `onTimeout` (which [McpService] honours by stopping). A longer auto-off can't be kept + * there, so it isn't offered, and a longer stored choice reads as the cap. + */ + const val DATA_SYNC_LIMIT_SDK = 35 + const val DATA_SYNC_LIMIT_HOURS = 6 + + /** The auto-off lengths offered on a device running [sdkInt]; the last is the default. */ + fun autoOffChoices(sdkInt: Int): List = + if (sdkInt >= DATA_SYNC_LIMIT_SDK) listOf(1, 4, DATA_SYNC_LIMIT_HOURS) else listOf(1, 4, 8) + + fun defaultAutoOffHours(sdkInt: Int): Int = autoOffChoices(sdkInt).last() + + /** + * A stored auto-off length as this device can honour it: capped at [DATA_SYNC_LIMIT_HOURS] on + * Android 15 and later, and the default when it isn't one of the choices offered here. + */ + fun autoOffHours(stored: Int, sdkInt: Int): Int { + val capped = if (sdkInt >= DATA_SYNC_LIMIT_SDK) stored.coerceAtMost(DATA_SYNC_LIMIT_HOURS) else stored + return capped.takeIf { it in autoOffChoices(sdkInt) } ?: defaultAutoOffHours(sdkInt) + } } diff --git a/app/src/main/java/com/pulseloop/mcp/McpPrefs.kt b/app/src/main/java/com/pulseloop/mcp/McpPrefs.kt index 6bc472bb..91ea456d 100644 --- a/app/src/main/java/com/pulseloop/mcp/McpPrefs.kt +++ b/app/src/main/java/com/pulseloop/mcp/McpPrefs.kt @@ -28,8 +28,9 @@ class McpPrefs(context: Context) : McpTokenStorage { get() = prefs.getLong(KEY_OFF_AT, 0L) set(v) { prefs.edit().putLong(KEY_OFF_AT, v).apply() } + /** Clamped to what this Android version lets a `dataSync` service run (McpConfig.autoOffHours). */ var autoOffHours: Int - get() = prefs.getInt(KEY_HOURS, DEFAULT_HOURS).takeIf { it in HOURS_CHOICES } ?: DEFAULT_HOURS + get() = McpConfig.autoOffHours(prefs.getInt(KEY_HOURS, McpConfig.defaultAutoOffHours(SDK)), SDK) set(v) { prefs.edit().putInt(KEY_HOURS, v).apply() } /** Whether a request may be answered now: switched on and not past its auto-off time. */ @@ -50,8 +51,9 @@ class McpPrefs(context: Context) : McpTokenStorage { private const val KEY_OFF_AT = "offAt" private const val KEY_HOURS = "autoOffHours" private const val KEY_TOOLS = "pairedTools" - const val DEFAULT_HOURS = 8 - val HOURS_CHOICES = listOf(1, 4, 8) + private val SDK get() = android.os.Build.VERSION.SDK_INT + /** The auto-off lengths this device offers (1, 4 and 8 h; 6 h instead of 8 on Android 15+). */ + val HOURS_CHOICES: List get() = McpConfig.autoOffChoices(SDK) private val json = Json { ignoreUnknownKeys = true } } } diff --git a/app/src/main/java/com/pulseloop/ui/PulseLoopApp.kt b/app/src/main/java/com/pulseloop/ui/PulseLoopApp.kt index f9042926..f5143954 100644 --- a/app/src/main/java/com/pulseloop/ui/PulseLoopApp.kt +++ b/app/src/main/java/com/pulseloop/ui/PulseLoopApp.kt @@ -429,8 +429,17 @@ fun PulseLoopApp() { // sits in the same place whichever tab is open, and the coach is the sheet's first row. val fabEntry by navController.currentBackStackEntryAsState() val showLogFab = fabEntry?.destination?.route in tabRoutes + // The app's one snackbar host (a confirmation after an action whose card goes away, such + // as adding a detected workout). Screens reach it through LocalAppSnackbar. + val snackbarHostState = remember { SnackbarHostState() } + val snackbarScope = rememberCoroutineScope() + val appSnackbar = remember(snackbarHostState, snackbarScope) { + com.pulseloop.ui.components.AppSnackbar(snackbarHostState, snackbarScope) + } + CompositionLocalProvider(com.pulseloop.ui.components.LocalAppSnackbar provides appSnackbar) { Scaffold( containerColor = com.pulseloop.ui.theme.PulseColors.background, + snackbarHost = { com.pulseloop.ui.components.AppSnackbarHost(snackbarHostState) }, floatingActionButton = { // Pops in on the tabs that have it and out on the ones that don't, rather than // blinking with the screen change. @@ -987,11 +996,13 @@ fun PulseLoopApp() { PairingScreen( bleClient = bleClient, onConnected = { navController.popBackStack() }, + onBack = { navController.popBackStack() }, ) } } } // Row: rail + content } + } // CompositionLocalProvider(LocalAppSnackbar) val logStep by LaunchRequests.openLog.collectAsState() logStep?.let { step -> diff --git a/app/src/main/java/com/pulseloop/ui/components/AppSnackbar.kt b/app/src/main/java/com/pulseloop/ui/components/AppSnackbar.kt new file mode 100644 index 00000000..cf54ad52 --- /dev/null +++ b/app/src/main/java/com/pulseloop/ui/components/AppSnackbar.kt @@ -0,0 +1,41 @@ +package com.pulseloop.ui.components + +import androidx.compose.material3.Snackbar +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.ui.Modifier +import com.pulseloop.ui.theme.PulseColors +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch + +/** + * The app's one snackbar host, owned by `PulseLoopApp`'s Scaffold and reached through + * [LocalAppSnackbar]. It shows on the app's own scope, so a message outlives the card or screen + * that asked for it (a detected workout's card disappears the moment it is added). A newer + * message replaces the one showing rather than queueing behind it. TalkBack announces it. + */ +class AppSnackbar(val host: SnackbarHostState, private val scope: CoroutineScope) { + fun show(message: String) { + scope.launch { + host.currentSnackbarData?.dismiss() + host.showSnackbar(message) + } + } +} + +/** Null outside `PulseLoopApp` (previews, onboarding-only hosts): callers skip the message. */ +val LocalAppSnackbar = staticCompositionLocalOf { null } + +/** The host's look: a card-coloured bar with primary text, no accent (it isn't a tap target). */ +@Composable +fun AppSnackbarHost(host: SnackbarHostState, modifier: Modifier = Modifier) { + SnackbarHost(host, modifier) { data -> + Snackbar( + snackbarData = data, + containerColor = PulseColors.card, + contentColor = PulseColors.textPrimary, + ) + } +} diff --git a/app/src/main/java/com/pulseloop/ui/components/Charts.kt b/app/src/main/java/com/pulseloop/ui/components/Charts.kt index 76e84411..12b26cc2 100644 --- a/app/src/main/java/com/pulseloop/ui/components/Charts.kt +++ b/app/src/main/java/com/pulseloop/ui/components/Charts.kt @@ -18,6 +18,8 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Refresh +import androidx.compose.material.icons.filled.ZoomIn +import androidx.compose.material.icons.filled.ZoomOut import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -490,27 +492,51 @@ fun TrendChart( } } - // Scroll slider + zoom-reset — shown only while zoomed in. The slider pans the - // visible window across the time domain; reset returns to the full (unzoomed) view. - if (interactive && zoom > 1f) { + // Zoom without a pinch (WCAG 2.5.7): zoom out / zoom in buttons on every chart that can + // zoom, stepping 2× about the middle of what is on screen. While zoomed in, a slider pans + // the visible window across the time domain and reset returns to the full view. + if (interactive && maxZoom > 1f) { + fun zoomBy(factor: Float) { + val oldWindow = 1f / zoom + val centre = windowStart + oldWindow / 2f + val newZoom = (zoom * factor).coerceIn(1f, maxZoom) + val newWindow = 1f / newZoom + windowStart = (centre - newWindow / 2f).coerceIn(0f, (1f - newWindow).coerceAtLeast(0f)) + zoom = newZoom + scrubX = null + } val sliderWindow = 1f / zoom val maxStart = (1f - sliderWindow).coerceAtLeast(0f) - if (maxStart > 0f) { - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - ) { + val iconTint = PulseColors.textSecondary + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + ) { + if (zoom > 1f && maxStart > 0f) { Slider( value = windowStart.coerceIn(0f, maxStart), onValueChange = { windowStart = it.coerceIn(0f, maxStart) }, valueRange = 0f..maxStart, modifier = Modifier.weight(1f), ) - IconButton(onClick = { zoom = 1f; windowStart = 0f }) { + } else { + Spacer(Modifier.weight(1f)) + } + // IconButton is a 48dp target; disabled at either end of the range. + IconButton(onClick = { zoomBy(0.5f) }, enabled = zoom > 1f) { + Icon(Icons.Filled.ZoomOut, contentDescription = tr("Zoom out"), + tint = if (zoom > 1f) iconTint else iconTint.copy(alpha = 0.38f)) + } + IconButton(onClick = { zoomBy(2f) }, enabled = zoom < maxZoom) { + Icon(Icons.Filled.ZoomIn, contentDescription = tr("Zoom in"), + tint = if (zoom < maxZoom) iconTint else iconTint.copy(alpha = 0.38f)) + } + if (zoom > 1f) { + IconButton(onClick = { zoom = 1f; windowStart = 0f; scrubX = null }) { Icon( Icons.Filled.Refresh, contentDescription = tr("Reset zoom"), - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = iconTint, ) } } diff --git a/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt b/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt index f0f89559..35e3253f 100644 --- a/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt +++ b/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt @@ -43,6 +43,7 @@ import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp /** * Edit-mode controller for a dashboard tab's card grid (iOS #64, Android adaptation). A long-press @@ -135,7 +136,7 @@ fun rememberDashboardEditState(scope: MetricScope, store: MetricPrefsStore): Das * Wraps a card's content with the edit-mode overlay: a "–" hide badge (top-start) and up/down move * controls (top-end), shown only while [DashboardEditState.editing]. While editing, a transparent * scrim over the card body swallows taps so the card's own tap-to-navigate is suppressed; the hide/ - * move controls sit above the scrim. Edit mode is entered via [CustomizeCardsButton], not a + * move controls sit above the scrim. Edit mode is entered via [CustomizeCardsFooter], not a * long-press, to avoid conflicting with each card's existing clickable. */ @Composable @@ -221,12 +222,22 @@ fun HiddenMetricsTray(hidden: List, onRestore: (DashboardCard) -> } } -/** Low-emphasis entry point that puts the dashboard into edit mode (Android's explicit substitute - * for iOS's long-press). Show it only when not already editing. */ +/** + * The last item of a customizable tab (Today, Vitals): a quiet "Customize cards" text link that + * puts the dashboard into edit mode (Android's explicit substitute for iOS's long-press), and the + * Done bar in the same place while editing. A rare action, so it lives at the end of the scroll + * rather than above the cards, and never at card weight. + */ @Composable -fun CustomizeCardsButton(onClick: () -> Unit) { - PulseButton(PulseButtonStyle.Text, onClick = onClick) { - Text(tr("Customize"), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant) +fun CustomizeCardsFooter(editState: DashboardEditState) { + Row(Modifier.fillMaxWidth().padding(top = 8.dp), horizontalArrangement = Arrangement.Center) { + if (editState.editing) { + ReorderDoneBar { editState.exit() } + } else { + PulseButton(PulseButtonStyle.Text, onClick = { editState.enterEditing() }) { + Text(tr("Customize cards"), fontSize = 14.sp, color = com.pulseloop.ui.theme.PulseColors.textSecondary) + } + } } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt index 98d72aa4..957c80d3 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt @@ -935,6 +935,7 @@ private fun DetectedActivityCard() { val context = androidx.compose.ui.platform.LocalContext.current val db = remember { com.pulseloop.data.PulseLoopDatabase.getInstance(context) } val scope = rememberCoroutineScope() + val snackbar = com.pulseloop.ui.components.LocalAppSnackbar.current var tick by remember { mutableIntStateOf(0) } val proposals by produceState>(emptyList(), tick) { value = runCatching { com.pulseloop.service.ActivityDetection.load(context, db) }.getOrDefault(emptyList()) @@ -973,7 +974,20 @@ private fun DetectedActivityCard() { // FlowRow: the two translated actions wrap rather than overflow the card. FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) { PulseButton(PulseButtonStyle.Tonal, onClick = { - scope.launch { runCatching { com.pulseloop.service.ActivityDetection.accept(context, db, p, type) }; tick++ } + scope.launch { + // The card leaves as soon as this lands, so the snackbar is the only + // sign it worked; a failure keeps the card and says so. + val saved = runCatching { com.pulseloop.service.ActivityDetection.accept(context, db, p, type) } + snackbar?.show( + when { + saved.isFailure && isNap -> tr("Couldn't add the nap. Try again.") + saved.isFailure -> tr("Couldn't add the workout. Try again.") + isNap -> tr("Nap added") + else -> trf("Workout added: {0}", ActivityMeta.label(type)) + }, + ) + tick++ + } }) { Text(if (isNap) tr("Yes, a nap") else tr("Add workout"), fontSize = 14.sp, fontWeight = FontWeight.SemiBold) } PulseButton(PulseButtonStyle.Text, onClick = { com.pulseloop.service.ActivityDetection.answer(context, p); tick++ }) { Text(tr("Not this"), fontSize = 14.sp, color = PulseColors.textSecondary) diff --git a/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt index 4ea28f29..4e8b3afd 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt @@ -88,6 +88,8 @@ fun PairingScreen( bleClient: RingBLEClient, onConnected: () -> Unit, onSkip: (() -> Unit)? = null, + /** Pushed from Settings: a top bar with a back arrow. Onboarding passes none; it has its own chrome. */ + onBack: (() -> Unit)? = null, ) { val state by bleClient.state.collectAsState() val context = LocalContext.current @@ -208,6 +210,9 @@ fun PairingScreen( } Column(Modifier.fillMaxSize().background(PulseColors.background)) { + // No bar title: "Add your ring" heads the page right below it, and saying it twice + // was the only thing a title would add. + onBack?.let { com.pulseloop.ui.components.PulseTopBar(title = "", onBack = it) } Column( Modifier .weight(1f) diff --git a/app/src/main/java/com/pulseloop/ui/screens/Screens.kt b/app/src/main/java/com/pulseloop/ui/screens/Screens.kt index eb005f40..b4acec89 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/Screens.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/Screens.kt @@ -48,13 +48,12 @@ import com.pulseloop.ui.components.toColor import com.pulseloop.ui.theme.PulseColors import com.pulseloop.ui.viewmodels.* import com.pulseloop.settings.ApiKeyStore -import com.pulseloop.ui.dashboard.CustomizeCardsButton +import com.pulseloop.ui.dashboard.CustomizeCardsFooter import com.pulseloop.ui.dashboard.DashboardCard import com.pulseloop.ui.dashboard.EditableCard import com.pulseloop.ui.dashboard.HiddenMetricsTray import com.pulseloop.ui.dashboard.MetricPrefsStore import com.pulseloop.ui.dashboard.MetricScope -import com.pulseloop.ui.dashboard.ReorderDoneBar import com.pulseloop.ui.dashboard.rememberDashboardEditState import com.pulseloop.settings.UnitConverter import com.pulseloop.settings.UnitSystem @@ -525,14 +524,8 @@ fun VitalsScreen( // Card order mirrors VitalsView.swift (HR, SpO₂, BP, HRV, Stress, Fatigue, Glucose, Temp) - // by default, but honors the user's per-metric visibility + order (iOS #64). Long-press a - // card to reorder/hide; the Hidden tray restores. - item { - Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { - if (editState.editing) ReorderDoneBar { editState.exit() } - else CustomizeCardsButton { editState.enterEditing() } - } - } + // by default, but honors the user's per-metric visibility + order (iOS #64). "Customize + // cards" at the end of the list reorders/hides; the Hidden tray restores. // Not before the first load: until then every series is empty and every supports* flag // false, so the list showed "No HR samples yet" cards and then grew as the rest arrived. @@ -553,6 +546,10 @@ fun VitalsScreen( } } + // The very end: a quiet "Customize cards" link (Done while editing). A rare action, so + // it no longer sits above the cards on every visit. + item { CustomizeCardsFooter(editState) } + item { Spacer(Modifier.height(32.dp)) } } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt index 347b351b..cbdc16c8 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt @@ -32,13 +32,12 @@ import com.pulseloop.service.VitalsThresholdEngine import com.pulseloop.settings.ApiKeyStore import com.pulseloop.settings.UnitConverter import com.pulseloop.ui.components.* -import com.pulseloop.ui.dashboard.CustomizeCardsButton +import com.pulseloop.ui.dashboard.CustomizeCardsFooter import com.pulseloop.ui.dashboard.DashboardCard import com.pulseloop.ui.dashboard.EditableCard import com.pulseloop.ui.dashboard.HiddenMetricsTray import com.pulseloop.ui.dashboard.MetricPrefsStore import com.pulseloop.ui.dashboard.MetricScope -import com.pulseloop.ui.dashboard.ReorderDoneBar import com.pulseloop.ui.dashboard.rememberDashboardEditState import com.pulseloop.util.Formats import com.pulseloop.ui.theme.PulseColors @@ -354,13 +353,8 @@ fun TodayScreen( } } - // Browse: the metric tiles. - item { - Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { - if (editState.editing) ReorderDoneBar { editState.exit() } - else CustomizeCardsButton { editState.enterEditing() } - } - } + // Browse: the metric tiles. Customizing them is rare, so its link waits at the end + // of the list rather than above the tiles on every visit. // Three across from 600dp (tablets, unfolded foldables) instead of two stretched tiles. val columns = if (screenWidthDp >= 600) 3 else 2 @@ -395,6 +389,9 @@ fun TodayScreen( if (editState.editing) { item { HiddenMetricsTray(hiddenCards) { editState.setHidden(it, false) } } } + // The end of the list: a quiet "Customize cards" link, which becomes the Done bar in + // the same place while editing, so leaving edit mode is where entering it was. + item { CustomizeCardsFooter(editState) } // The long view ("how have I been this month?") is the header's health line now, // on every tab, so Today no longer ends with its own My Health card. diff --git a/app/src/test/java/com/pulseloop/mcp/McpAutoOffTest.kt b/app/src/test/java/com/pulseloop/mcp/McpAutoOffTest.kt new file mode 100644 index 00000000..1630fed8 --- /dev/null +++ b/app/src/test/java/com/pulseloop/mcp/McpAutoOffTest.kt @@ -0,0 +1,44 @@ +package com.pulseloop.mcp + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Test + +/** Android 15 caps a dataSync foreground service at about six hours a day (McpConfig.autoOffHours). */ +class McpAutoOffTest { + private val android14 = 34 + private val android15 = 35 + + @Test + fun `older Android keeps the 1, 4 and 8 hour choices with 8 as the default`() { + assertEquals(listOf(1, 4, 8), McpConfig.autoOffChoices(android14)) + assertEquals(8, McpConfig.defaultAutoOffHours(android14)) + listOf(1, 4, 8).forEach { assertEquals(it, McpConfig.autoOffHours(it, android14)) } + } + + @Test + fun `Android 15 and later offer nothing above six hours`() { + listOf(android15, 36).forEach { sdk -> + val choices = McpConfig.autoOffChoices(sdk) + assertTrue(choices.all { it <= McpConfig.DATA_SYNC_LIMIT_HOURS }) + assertEquals(listOf(1, 4, 6), choices) + assertEquals(6, McpConfig.defaultAutoOffHours(sdk)) + } + } + + @Test + fun `a stored eight hours reads as six on Android 15`() { + assertEquals(6, McpConfig.autoOffHours(8, android15)) + assertEquals(6, McpConfig.autoOffHours(24, android15)) + assertEquals(4, McpConfig.autoOffHours(4, android15)) + assertEquals(1, McpConfig.autoOffHours(1, android15)) + } + + @Test + fun `a value that is not a choice falls back to the default`() { + assertEquals(8, McpConfig.autoOffHours(0, android14)) + assertEquals(8, McpConfig.autoOffHours(6, android14)) + assertEquals(6, McpConfig.autoOffHours(0, android15)) + assertEquals(6, McpConfig.autoOffHours(-3, android15)) + } +} From ccfeb528d4b1ceae5564fc502bc56103bf8628f2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:13:51 +0000 Subject: [PATCH 2/6] pt-BR strings for the P2 fixes Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w --- .claude/worktrees/agent-a048ba9f0ce71c30d | 1 + .claude/worktrees/agent-a62ddc505b3ed9e61 | 1 + .claude/worktrees/agent-aecf52508f38c44d0 | 1 + app/src/main/assets/i18n/pt-BR.json | 7 +++++++ 4 files changed, 10 insertions(+) create mode 160000 .claude/worktrees/agent-a048ba9f0ce71c30d create mode 160000 .claude/worktrees/agent-a62ddc505b3ed9e61 create mode 160000 .claude/worktrees/agent-aecf52508f38c44d0 diff --git a/.claude/worktrees/agent-a048ba9f0ce71c30d b/.claude/worktrees/agent-a048ba9f0ce71c30d new file mode 160000 index 00000000..8f6bae99 --- /dev/null +++ b/.claude/worktrees/agent-a048ba9f0ce71c30d @@ -0,0 +1 @@ +Subproject commit 8f6bae99cccbbc89fd9542291421d3d0c6731785 diff --git a/.claude/worktrees/agent-a62ddc505b3ed9e61 b/.claude/worktrees/agent-a62ddc505b3ed9e61 new file mode 160000 index 00000000..bf589c14 --- /dev/null +++ b/.claude/worktrees/agent-a62ddc505b3ed9e61 @@ -0,0 +1 @@ +Subproject commit bf589c14811f883d9a957fc356a753212eedecfc diff --git a/.claude/worktrees/agent-aecf52508f38c44d0 b/.claude/worktrees/agent-aecf52508f38c44d0 new file mode 160000 index 00000000..8f6bae99 --- /dev/null +++ b/.claude/worktrees/agent-aecf52508f38c44d0 @@ -0,0 +1 @@ +Subproject commit 8f6bae99cccbbc89fd9542291421d3d0c6731785 diff --git a/app/src/main/assets/i18n/pt-BR.json b/app/src/main/assets/i18n/pt-BR.json index 7f61a6b1..17eceea9 100644 --- a/app/src/main/assets/i18n/pt-BR.json +++ b/app/src/main/assets/i18n/pt-BR.json @@ -435,6 +435,8 @@ "Cost estimates aren't available for on-device or custom models.": "Estimativas de custo não estão disponíveis para modelos locais ou personalizados.", "Could not export diagnostics.": "Não foi possível exportar os diagnósticos.", "Could not open browser": "Não foi possível abrir o navegador", + "Couldn't add the nap. Try again.": "Não foi possível adicionar o cochilo. Tente de novo.", + "Couldn't add the workout. Try again.": "Não foi possível adicionar o treino. Tente de novo.", "Couldn't analyse the meal. Check your connection and try again, or enter it by hand.": "Não foi possível analisar a refeição. Verifique a conexão e tente de novo, ou digite à mão.", "Couldn't check for updates ({0}). Try again.": "Não foi possível procurar atualizações ({0}). Tente de novo.", "Couldn't check for updates. Check your connection and try again.": "Não foi possível procurar atualizações. Verifique sua conexão e tente de novo.", @@ -466,6 +468,7 @@ "Cuscuz com ovo": "Cuscuz com ovo", "Custom model slug (vendor/model)": "Slug de modelo personalizado (fornecedor/modelo)", "Customize": "Personalizar", + "Customize cards": "Personalizar cartões", "Cycle": "Ciclo", "Cycle of {0} days": "Ciclo de {0} dias", "Cycle · day {0}": "Ciclo · dia {0}", @@ -1081,6 +1084,7 @@ "NUTRITION": "NUTRIÇÃO", "Name": "Nome", "Name it so you'll recognise it later, like the app and the computer.": "Dê um nome que você reconheça depois, como o app e o computador.", + "Nap added": "Cochilo adicionado", "Near baseline": "Perto da linha de base", "Needs 5 nights in the last 2 weeks": "Precisa de 5 noites nas últimas 2 semanas", "Needs care": "Requer atenção", @@ -1945,6 +1949,7 @@ "Within a typical range for a non-fasting reading.": "Dentro da faixa típica para uma leitura sem jejum.", "Woke up": "Acordou", "Workout": "Treino", + "Workout added: {0}": "Treino adicionado: {0}", "Workout history": "Histórico de treinos", "Workout in progress": "Treino em andamento", "Workout not found": "Treino não encontrado", @@ -2027,6 +2032,8 @@ "Your usual {0}-day cycle would have ended {1} day{2} ago.": "Seu ciclo habitual de {0} dias teria terminado há {1} dia{2}.", "Your week at a glance": "Sua semana num relance", "Your workout is still recording. Finish it now, or keep recording?": "Seu treino ainda está sendo gravado. Finalizar agora ou continuar gravando?", + "Zoom in": "Aproximar", + "Zoom out": "Afastar", "a {0} fits.": "cabe um(a) {0}.", "above": "acima", "above {0}": "acima de {0}", From 8a106afe919b5cb907a3e7b81780de6deebefdf2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:13:58 +0000 Subject: [PATCH 3/6] Keep agent worktrees out of the repo Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w --- .claude/worktrees/agent-a048ba9f0ce71c30d | 1 - .claude/worktrees/agent-a62ddc505b3ed9e61 | 1 - .claude/worktrees/agent-aecf52508f38c44d0 | 1 - .gitignore | 1 + 4 files changed, 1 insertion(+), 3 deletions(-) delete mode 160000 .claude/worktrees/agent-a048ba9f0ce71c30d delete mode 160000 .claude/worktrees/agent-a62ddc505b3ed9e61 delete mode 160000 .claude/worktrees/agent-aecf52508f38c44d0 diff --git a/.claude/worktrees/agent-a048ba9f0ce71c30d b/.claude/worktrees/agent-a048ba9f0ce71c30d deleted file mode 160000 index 8f6bae99..00000000 --- a/.claude/worktrees/agent-a048ba9f0ce71c30d +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8f6bae99cccbbc89fd9542291421d3d0c6731785 diff --git a/.claude/worktrees/agent-a62ddc505b3ed9e61 b/.claude/worktrees/agent-a62ddc505b3ed9e61 deleted file mode 160000 index bf589c14..00000000 --- a/.claude/worktrees/agent-a62ddc505b3ed9e61 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bf589c14811f883d9a957fc356a753212eedecfc diff --git a/.claude/worktrees/agent-aecf52508f38c44d0 b/.claude/worktrees/agent-aecf52508f38c44d0 deleted file mode 160000 index 8f6bae99..00000000 --- a/.claude/worktrees/agent-aecf52508f38c44d0 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8f6bae99cccbbc89fd9542291421d3d0c6731785 diff --git a/.gitignore b/.gitignore index f70ee99c..23a3b8d4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ app/.DS_Store gradle/.DS_Store .DS_Store .kotlin/ +.claude/worktrees/ From 4501a9d4580089e01b3dadc713310d5b83f5818f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:14:23 +0000 Subject: [PATCH 4/6] UI P3s: Settings sub-screen cards, neutral progress, one filled button, spacing scale, Debug top bar - SettingsSubScreens: Material Card replaced by SubScreenCard (card colour, hairline, 8dp, textPrimary content colour), card titles in PulseType.title, save confirmations in success instead of mint. - Onboarding step bar and the update dialog's progress/changelog bullet no longer mint. - Record: Finish is an outlined error button, so Resume is the screen's only fill. - Debug uses PulseTopBar. - Off-scale spacing (2/6/10/14/20dp) moved onto 4/8/12/16 in onboarding editors, Settings sub-screens, Drinks, Coach, Debug and small components. Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w --- .../coach/schema/CoachToolTraceView.kt | 6 +- .../pulseloop/ui/components/MarkdownLite.kt | 6 +- .../pulseloop/ui/dashboard/DashboardEdit.kt | 2 +- .../com/pulseloop/ui/onboarding/Editors.kt | 10 +- .../com/pulseloop/ui/screens/CoachScreen.kt | 10 +- .../pulseloop/ui/screens/CoachUsageSheet.kt | 2 +- .../com/pulseloop/ui/screens/DebugScreen.kt | 17 +- .../java/com/pulseloop/ui/screens/DrinksUi.kt | 12 +- .../pulseloop/ui/screens/OnboardingScreen.kt | 5 +- .../com/pulseloop/ui/screens/RecordScreen.kt | 11 +- .../ui/screens/SettingsSubScreens.kt | 251 +++++++++--------- .../java/com/pulseloop/update/UpdateUi.kt | 12 +- 12 files changed, 176 insertions(+), 168 deletions(-) diff --git a/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt b/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt index 0809c749..0c5fc67e 100644 --- a/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt +++ b/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt @@ -64,8 +64,8 @@ fun CoachToolTraceDisclosure(messageId: String, viewModel: CoachViewModel?) { exit = shrinkVertically(tween(com.pulseloop.ui.theme.Motion.STANDARD_MS, easing = com.pulseloop.ui.theme.Motion.ease)), ) { Column( - verticalArrangement = Arrangement.spacedBy(6.dp), - modifier = Modifier.padding(top = 2.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.padding(top = 4.dp), ) { calls.forEach { call -> ToolTraceRow(call) } } @@ -84,7 +84,7 @@ private fun displayLabel(call: CoachToolCallEntity): String = @Composable private fun ToolTraceRow(call: CoachToolCallEntity) { val isError = call.statusRaw == "error" - Row(verticalAlignment = Alignment.Top, horizontalArrangement = Arrangement.spacedBy(6.dp)) { + Row(verticalAlignment = Alignment.Top, horizontalArrangement = Arrangement.spacedBy(8.dp)) { Icon( if (isError) Icons.Filled.Cancel else Icons.Filled.CheckCircle, null, diff --git a/app/src/main/java/com/pulseloop/ui/components/MarkdownLite.kt b/app/src/main/java/com/pulseloop/ui/components/MarkdownLite.kt index 3210c3b5..c64da430 100644 --- a/app/src/main/java/com/pulseloop/ui/components/MarkdownLite.kt +++ b/app/src/main/java/com/pulseloop/ui/components/MarkdownLite.kt @@ -26,7 +26,7 @@ import com.pulseloop.ui.theme.PulseColors /** * Minimal markdown renderer shared across the app (coach replies, the "What's new" update - * dialog): `## ` headings as semibold lines, `- `/`* `/`• ` bullet lines with accent dots, + * dialog): `## ` headings as semibold lines, `- `/`* `/`• ` bullet lines with muted dots, * `**bold**` inline, `[text](url)` links flattened to their text, and `` `code` `` unwrapped. * Anything else renders as-is. Full markdown (tables, images) is intentionally out of scope — * this exists so release notes and assistant text read cleanly instead of showing raw `#`/`*`. @@ -41,14 +41,14 @@ fun MarkdownLite( modifier: Modifier = Modifier, headingColor: Color = PulseColors.textPrimary, bodyColor: Color = PulseColors.textSecondary, - bulletColor: Color = PulseColors.accent, + bulletColor: Color = PulseColors.textSecondary, boldColor: Color = PulseColors.textPrimary, ) { Column(modifier, verticalArrangement = Arrangement.spacedBy(4.dp)) { text.split("\n").forEach { rawLine -> val line = rawLine.trimEnd() when { - line.isBlank() -> Spacer(Modifier.height(2.dp)) + line.isBlank() -> Spacer(Modifier.height(4.dp)) line.startsWith("#") -> Text( mdInline(line.trimStart('#', ' '), boldColor), fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = headingColor, diff --git a/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt b/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt index f0f89559..3807660f 100644 --- a/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt +++ b/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt @@ -208,7 +208,7 @@ fun HiddenMetricsTray(hidden: List, onRestore: (DashboardCard) -> Text(com.pulseloop.ui.i18n.tr("HIDDEN"), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = com.pulseloop.ui.theme.PulseColors.textSecondary) hidden.forEach { card -> Row( - Modifier.fillMaxWidth().padding(vertical = 2.dp), + Modifier.fillMaxWidth().padding(vertical = 4.dp), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, ) { diff --git a/app/src/main/java/com/pulseloop/ui/onboarding/Editors.kt b/app/src/main/java/com/pulseloop/ui/onboarding/Editors.kt index c5fc16e5..8ea4ef07 100644 --- a/app/src/main/java/com/pulseloop/ui/onboarding/Editors.kt +++ b/app/src/main/java/com/pulseloop/ui/onboarding/Editors.kt @@ -78,7 +78,7 @@ fun ProfileEditor( if (showUnits) { SectionHeaderCaps(tr("Units")) FormCard { - Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { + Column(verticalArrangement = Arrangement.spacedBy(12.dp)) { Text( tr("Measurement units"), fontSize = 14.sp, @@ -133,7 +133,7 @@ fun ProfileEditor( HorizontalDivider(color = PulseColors.borderSubtle) Column( - Modifier.padding(vertical = 10.dp), + Modifier.padding(vertical = 12.dp), verticalArrangement = Arrangement.spacedBy(8.dp), ) { Text( @@ -453,7 +453,7 @@ private fun DecimalValueSheet( } Column( - Modifier.fillMaxWidth().padding(horizontal = 20.dp, vertical = 8.dp), + Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(12.dp), ) { Text( @@ -469,7 +469,7 @@ private fun DecimalValueSheet( .clip(RoundedCornerShape(8.dp)) .background(PulseColors.card) .border(1.dp, PulseColors.borderSubtle, RoundedCornerShape(8.dp)) - .padding(14.dp), + .padding(16.dp), ) { if (text.isEmpty()) { Text( @@ -629,7 +629,7 @@ private fun GoalSliderCard( .padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp), ) { - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) { + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) { Box( Modifier .size(30.dp) diff --git a/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt index 82f514de..8c72d8d7 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt @@ -209,7 +209,7 @@ fun CoachHeader( Row( Modifier .fillMaxWidth() - .padding(start = if (onBack != null) 4.dp else 16.dp, end = 16.dp, top = 10.dp, bottom = 10.dp), + .padding(start = if (onBack != null) 4.dp else 16.dp, end = 16.dp, top = 12.dp, bottom = 12.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), ) { @@ -305,10 +305,10 @@ private fun MessageBubble(msg: CoachViewModel.ChatMessage, viewModel: CoachViewM .then(if (msg.isError) Modifier.dither(errorColor, 0.12f) else Modifier) .then(if (msg.isError) Modifier.border(1.dp, errorColor.copy(alpha = 0.5f), RoundedCornerShape(8.dp)) else Modifier) .padding(horizontal = 16.dp, vertical = 12.dp), - verticalArrangement = Arrangement.spacedBy(6.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { if (msg.attachments.isNotEmpty()) { - Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) { + Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { msg.attachments.forEach { ref -> val bmp = rememberAttachmentBitmap(ref) bmp?.let { @@ -439,7 +439,7 @@ private fun Composer( } if (staged.isNotEmpty()) { Row( - Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 6.dp), + Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), ) { staged.forEach { ref -> @@ -477,7 +477,7 @@ private fun Composer( } } Row( - Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 6.dp), + Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp), ) { diff --git a/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt b/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt index fa3aea50..05d7b15d 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt @@ -160,7 +160,7 @@ private fun MessageBreakdownRow(message: CoachMessageEntity) { val preview = message.body.replace("\n", " ").take(30) val tokens = trf("{0} in · {1} out", message.inputTokens ?: 0, message.outputTokens ?: 0) val cost = message.costUSD?.let { "$" + "%.4f".format(it) } ?: "—" - Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { + Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { Text(preview.ifEmpty { tr("(no text)") }, fontSize = 12.sp, color = PulseColors.textPrimary, maxLines = 1) Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) { Text(tokens, fontSize = 12.sp, color = PulseColors.textMuted) diff --git a/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt index cb486e27..12a0c5d7 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt @@ -59,15 +59,8 @@ fun DebugScreen(viewModel: DiagnosticsViewModel, onBack: () -> Unit = {}) { Scaffold( contentWindowInsets = WindowInsets(0, 0, 0, 0), topBar = { - TopAppBar( - title = { Text(tr("Debug")) }, - navigationIcon = { - IconButton(onClick = onBack) { - Icon(Icons.Filled.ArrowBack, contentDescription = tr("Back")) - } - }, - windowInsets = WindowInsets(0, 0, 0, 0), - ) + // The shared pushed-screen bar (AppChrome), not a hand-rolled TopAppBar. + com.pulseloop.ui.components.PulseTopBar(title = tr("Debug"), onBack = onBack) }, ) { padding -> LazyColumn(Modifier.fillMaxSize().padding(padding).padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { @@ -247,13 +240,13 @@ private fun DebugCard( @Composable private fun EventRow(event: WearableLogEntity, timeFmt: SimpleDateFormat) { val isError = event.levelRaw == "ERROR" - Row(Modifier.fillMaxWidth().padding(vertical = 2.dp), verticalAlignment = Alignment.Top) { + Row(Modifier.fillMaxWidth().padding(vertical = 4.dp), verticalAlignment = Alignment.Top) { Icon( Icons.Filled.Circle, null, Modifier.padding(top = 5.dp).size(8.dp), tint = if (isError) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.primary, ) - Spacer(Modifier.width(6.dp)) + Spacer(Modifier.width(8.dp)) Text( "${timeFmt.format(Date(event.timestamp))} · ${event.deviceTypeRaw} · ${event.message}", style = MaterialTheme.typography.bodySmall, @@ -265,7 +258,7 @@ private fun EventRow(event: WearableLogEntity, timeFmt: SimpleDateFormat) { @Composable private fun PacketRow(packet: RawPacketEntity, timeFmt: SimpleDateFormat) { val arrow = if (packet.directionRaw == PacketDirection.INCOMING.name) "↓" else "↑" - Column(Modifier.fillMaxWidth().padding(vertical = 2.dp)) { + Column(Modifier.fillMaxWidth().padding(vertical = 4.dp)) { Text( "$arrow ${timeFmt.format(Date(packet.timestamp))} · ${packet.deviceTypeRaw.orEmpty()} · ${packet.decodedKind}", style = MaterialTheme.typography.labelSmall, diff --git a/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt b/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt index c3816f2a..606f99d1 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt @@ -332,7 +332,7 @@ private fun DrinksWelcome(onStart: () -> Unit) { var limitTouched by remember { mutableStateOf(false) } var showSize by remember { mutableStateOf(false) } - Column(Modifier.fillMaxWidth().padding(vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(14.dp)) { + Column(Modifier.fillMaxWidth().padding(vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) { Text(tr("Drink less, sleep better"), fontSize = 24.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary) Benefit(Icons.Filled.LocalBar, tr("Log a drink in one tap")) Benefit(Icons.Filled.EventAvailable, tr("A weekly limit and dry days you choose")) @@ -504,7 +504,7 @@ private fun LogCard(db: PulseLoopDatabase, s: DrinksRepository.Snapshot, onChang } .padding(horizontal = 4.dp, vertical = 12.dp), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.spacedBy(6.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { Icon(t.icon, null, tint = PulseColors.drinks, modifier = Modifier.size(24.dp)) Text(t.short, fontSize = 12.sp, color = PulseColors.textPrimary, textAlign = TextAlign.Center, maxLines = 2, overflow = TextOverflow.Ellipsis) @@ -713,7 +713,7 @@ private fun InsightCard(s: DrinksRepository.Snapshot) { @Composable private fun ImpactRow(label: String, i: DrinkInsights.Impact?) { - Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { + Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { Text(label, fontSize = 14.sp, fontWeight = FontWeight.Medium, color = PulseColors.textPrimary) val text = if (i == null) tr("Not enough nights yet") else buildList { i.hrvPct?.let { add("HRV ${if (it >= 0) "+" else "−"}${kotlin.math.abs(it)}%") } @@ -730,7 +730,7 @@ private fun ImpactRow(label: String, i: DrinkInsights.Impact?) { private fun Stat(value: String, label: String, modifier: Modifier) { Column( modifier.clip(RoundedCornerShape(8.dp)).background(PulseColors.card).padding(12.dp), - verticalArrangement = Arrangement.spacedBy(2.dp), + verticalArrangement = Arrangement.spacedBy(4.dp), ) { Text(value, fontSize = 20.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary, maxLines = 1, softWrap = false) Text(label, fontSize = 12.sp, color = PulseColors.textMuted, maxLines = 2, overflow = TextOverflow.Ellipsis) @@ -749,7 +749,7 @@ private fun TrendsTab(s: DrinksRepository.Snapshot) { } DrinkCard(tr("Last 8 weeks")) { WeeksChart(s) - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) { + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { Box(Modifier.width(16.dp).height(2.dp).background(PulseColors.textMuted)) Text(trf("your limit of {0}", std(s.weeklyLimit)), fontSize = 12.sp, color = PulseColors.textMuted) } @@ -964,7 +964,7 @@ private fun DrinkSettings(onChange: () -> Unit, onTurnedOff: () -> Unit) { Text(tr("Your drinks stay on this phone. They aren't sent to Health Connect or included in diagnostics."), fontSize = 12.sp, color = PulseColors.textMuted) PulseButton(PulseButtonStyle.Text, onClick = { confirmOff = true }) { Icon(Icons.Filled.Close, null, tint = PulseColors.danger, modifier = Modifier.size(16.dp)) - Spacer(Modifier.width(6.dp)) + Spacer(Modifier.width(8.dp)) Text(tr("Turn off Drinks"), color = PulseColors.danger) } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt index b5522ae3..b6a6e1b7 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt @@ -312,7 +312,8 @@ private fun OnboardingTopBar( .weight(1f) .height(4.dp) .clip(CircleShape) - .background(if (item.index <= step.index) PulseColors.accent else PulseColors.cardSoft), + // Progress is a state, not a tap target: no mint. + .background(if (item.index <= step.index) PulseColors.textPrimary else PulseColors.elevated), ) } } @@ -622,7 +623,7 @@ private fun BaselineStep(source: BaselineSource, finish: () -> Unit) { Text("1", fontSize = 14.sp, fontWeight = FontWeight.Bold, color = milestone.tint) } } - Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { + Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { Text( milestone.title, fontSize = 14.sp, diff --git a/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt index f619c9de..1096dde1 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt @@ -6,6 +6,7 @@ import com.pulseloop.ui.components.PulseButton import com.pulseloop.ui.theme.PulseColors import androidx.activity.compose.BackHandler +import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -164,7 +165,15 @@ fun RecordScreen( Text(tr("Pause"), maxLines = 1, overflow = TextOverflow.Ellipsis) } } - PulseButton(onClick = onFinish, modifier = Modifier.weight(1f), colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.error)) { + // At most one filled button on the screen: Resume while paused. Finish ends the + // session, so it is an outlined button in the error colour rather than a second fill. + PulseButton( + PulseButtonStyle.Outlined, + onClick = onFinish, + modifier = Modifier.weight(1f), + colors = ButtonDefaults.outlinedButtonColors(contentColor = MaterialTheme.colorScheme.error), + border = BorderStroke(1.dp, MaterialTheme.colorScheme.error), + ) { Icon(Icons.Filled.Stop, null) Spacer(Modifier.width(8.dp)) Text(tr("Finish"), maxLines = 1, overflow = TextOverflow.Ellipsis) 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 66376a3a..1d3792ed 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt @@ -93,6 +93,7 @@ import com.pulseloop.settings.ZenModeListener import com.pulseloop.ui.components.DeviceHeroStatus import com.pulseloop.ui.components.ZoneLineChart import com.pulseloop.ui.theme.PulseColors +import com.pulseloop.ui.theme.PulseType import com.pulseloop.wearables.WearableModel import kotlin.math.roundToInt import kotlinx.coroutines.delay @@ -218,9 +219,9 @@ fun CoachSettingsScreen(onBack: () -> Unit) { SettingsSubScreen(title = tr("AI Coach"), onBack = onBack) { // AI Coach section — ported from CoachSettingsSection.swift - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("AI Coach"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("AI Coach"), style = PulseType.title) Spacer(Modifier.height(4.dp)) // Readiness differs by provider: the local mode is gated by the server address, // not a key, so the old key-only check told a correctly-configured user their @@ -869,10 +870,10 @@ fun CoachSettingsScreen(onBack: () -> Unit) { // Coach Memory — ported from CoachSettingsSection memoryRow if (memories.isNotEmpty() && coachEnabled) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically) { - Text(tr("Coach Memory"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f)) + Text(tr("Coach Memory"), style = PulseType.title, modifier = Modifier.weight(1f)) PulseButton(PulseButtonStyle.Text, onClick = { showMemory = !showMemory }) { Text(if (showMemory) tr("Hide") else trf("Show ({0})", memories.size)) } @@ -880,13 +881,10 @@ fun CoachSettingsScreen(onBack: () -> Unit) { if (showMemory) { Spacer(Modifier.height(8.dp)) memories.forEach { memory -> - Card( - Modifier.fillMaxWidth().padding(vertical = 4.dp), - colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), - ) { + SubScreenCard(Modifier.padding(vertical = 4.dp), color = PulseColors.cardSoft) { Row(Modifier.padding(12.dp).fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically) { Column(Modifier.weight(1f)) { - Text(memory.key, style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium) + Text(memory.key, style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.SemiBold) Text(memory.value, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 2) } IconButton(onClick = { memoryToDelete = memory.key }) { @@ -1024,9 +1022,9 @@ fun CheckInsSettingsScreen(onBack: () -> Unit) { // check-ins come last and explain themselves when the coach is off. DailyGuidanceSettingsCard() - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Detected workouts"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Detected workouts"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( tr("After a sync, what your ring saw you doing (a walk, a ride, strength training), to add with a tap. Nothing is logged without you."), @@ -1044,9 +1042,9 @@ fun CheckInsSettingsScreen(onBack: () -> Unit) { // Ring battery alerts — independent of the coach toggle (iOS #61a puts this in its own // NotificationsSettingsView section): a local notification at <20% / <10%, once per day. - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Ring battery alerts"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Ring battery alerts"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( tr("Get notified when your ring drops below 20% and 10%, so tracking doesn't stop mid-day."), @@ -1069,9 +1067,9 @@ fun CheckInsSettingsScreen(onBack: () -> Unit) { } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Daily check-ins"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Daily check-ins"), style = PulseType.title) if (!coachEnabled) { Spacer(Modifier.height(4.dp)) Text( @@ -1178,9 +1176,9 @@ private fun DailyGuidanceSettingsCard() { var progress by remember { mutableStateOf(prefs.activityProgress) } var medsOn by remember { mutableStateOf(prefs.medReminders) } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { - Text(tr("Daily guidance"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Daily guidance"), style = PulseType.title) Text( tr("Built on your phone from your ring's data. No AI key needed."), style = MaterialTheme.typography.bodySmall, @@ -1343,7 +1341,7 @@ fun ProfileSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> Unit, modifier = Modifier.fillMaxWidth(), ) { Text(tr("Save profile")) } savedMsg?.let { - Text(it, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) + Text(it, style = MaterialTheme.typography.bodySmall, color = PulseColors.success) } } } @@ -1436,7 +1434,7 @@ fun PhysiologySettingsScreen(onBack: () -> Unit) { modifier = Modifier.fillMaxWidth(), ) { Text(tr("Save")) } savedMsg?.let { - Text(it, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) + Text(it, style = MaterialTheme.typography.bodySmall, color = PulseColors.success) } } } @@ -1444,7 +1442,7 @@ fun PhysiologySettingsScreen(onBack: () -> Unit) { /** A titled card with optional explanatory footer, matching iOS `SettingsGroup`. */ @Composable private fun PhysiologyCard(title: String, footer: String?, content: @Composable ColumnScope.() -> Unit) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Text(title, style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.SemiBold) Spacer(Modifier.height(8.dp)) @@ -1464,7 +1462,7 @@ private fun TriStateRow(title: String, value: Boolean?, onChange: (Boolean?) -> val options = listOf>("Not set" to null, "No" to false, "Yes" to true) // Stacked rather than side by side: three translated segments ("Não definido" …) left the // weighted title a few dp and broke it a character per line. - Column(verticalArrangement = Arrangement.spacedBy(6.dp)) { + Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { Text(title, style = MaterialTheme.typography.bodyMedium) SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) { options.forEachIndexed { i, (label, v) -> @@ -1503,7 +1501,7 @@ fun CalibrationSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> U var savedMsg by remember { mutableStateOf(null) } SettingsSubScreen(title = tr("Calibration"), onBack = onBack) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Text(tr("Blood pressure calibration"), style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.SemiBold) Text( @@ -1542,13 +1540,13 @@ fun CalibrationSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> U modifier = Modifier.fillMaxWidth(), ) { Text(tr("Save calibration")) } savedMsg?.let { - Spacer(Modifier.height(6.dp)) - Text(it, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) + Spacer(Modifier.height(8.dp)) + Text(it, style = MaterialTheme.typography.bodySmall, color = PulseColors.success) } } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Text(tr("Blood sugar calibration"), style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.SemiBold) Text( @@ -1665,7 +1663,7 @@ fun GoalsSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> Unit) { modifier = Modifier.fillMaxWidth(), ) { Text(tr("Save goals")) } goalSavedMsg?.let { - Text(it, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) + Text(it, style = MaterialTheme.typography.bodySmall, color = PulseColors.success) } } // Which hours count as sleep is a sleep setting, so it lives with the sleep goal. @@ -1740,9 +1738,9 @@ fun MeasurementSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> U } SettingsSubScreen(title = tr("Measurement frequency"), onBack = onBack) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Measurement"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Measurement"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( tr("How often the ring measures in the background. Shorter heart-rate intervals give finer history at the cost of battery."), @@ -1840,8 +1838,8 @@ fun MeasurementSettingsScreen(coordinator: RingSyncCoordinator?, onBack: () -> U modifier = Modifier.fillMaxWidth(), ) { Text(tr("Save measurement settings")) } cfgSavedMsg?.let { - Spacer(Modifier.height(6.dp)) - Text(it, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) + Spacer(Modifier.height(8.dp)) + Text(it, style = MaterialTheme.typography.bodySmall, color = PulseColors.success) } } } @@ -1888,7 +1886,7 @@ private fun QuietHoursCard() { onDispose { lifecycleOwner.lifecycle.removeObserver(observer) } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Row( Modifier.fillMaxWidth() @@ -1896,7 +1894,7 @@ private fun QuietHoursCard() { horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, ) { - Text(tr("Sleep quiet hours"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f)) + Text(tr("Sleep quiet hours"), style = PulseType.title, modifier = Modifier.weight(1f)) Switch(checked = enabled, onCheckedChange = null) } Text( @@ -2079,7 +2077,7 @@ fun WearableSettingsScreen( ?: tr("Not yet") SettingsSubScreen(title = tr("Ring & sync"), onBack = onBack) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Row(verticalAlignment = Alignment.CenterVertically) { Icon( @@ -2099,12 +2097,12 @@ fun WearableSettingsScreen( if (device?.firmwareVersion != null) { val rawFw = device!!.firmwareVersion!! val fwDisplay = if (rawFw.contains("V")) "V" + rawFw.substringAfterLast("V") else rawFw - Text(trf("Firmware: {0}", fwDisplay), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(top = 2.dp)) + Text(trf("Firmware: {0}", fwDisplay), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp)) } else if (device != null) { - Text(tr("Firmware: reading… (connect ring to read)"), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(top = 2.dp)) + Text(tr("Firmware: reading… (connect ring to read)"), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp)) } if (device != null) { - Text(trf("Last synced: {0}", lastSyncedLabel), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(top = 2.dp)) + Text(trf("Last synced: {0}", lastSyncedLabel), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp)) } if (deviceLoaded && device == null) { @@ -2173,9 +2171,9 @@ fun WearableSettingsScreen( if (device != null) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Ring management"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Ring management"), style = PulseType.title) Spacer(Modifier.height(8.dp)) Text( tr("Forget unbinds the ring and removes it from the app so it can be paired " + @@ -2321,9 +2319,9 @@ private fun BackgroundSyncCard() { onDispose { lifecycleOwner.lifecycle.removeObserver(observer) } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Reliable background sync"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Reliable background sync"), style = PulseType.title) Spacer(Modifier.height(8.dp)) Text( if (exempt) { @@ -2399,10 +2397,10 @@ private fun BatteryHistorySection(db: PulseLoopDatabase) { .map { VitalSample(timestampMs = it.timestamp, value = it.percent.toDouble()) } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically) { - Text(tr("Battery history"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f)) + Text(tr("Battery history"), style = PulseType.title, modifier = Modifier.weight(1f)) SingleChoiceSegmentedButtonRow { BatteryHistoryRange.entries.forEachIndexed { i, r -> SegmentedButton( @@ -2437,7 +2435,7 @@ private fun BatteryHistorySection(db: PulseLoopDatabase) { endMs = loaded.last().timestampMs, ), ) - Spacer(Modifier.height(10.dp)) + Spacer(Modifier.height(12.dp)) BatteryRuntimeEstimate(loaded) } } @@ -2553,9 +2551,9 @@ fun PrivacyDataSettingsScreen( SettingsSubScreen(title = tr("Backup & data"), onBack = onBack) { // Data Backup — export/import full app data as JSON. - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Data backup"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Data backup"), style = PulseType.title) Spacer(Modifier.height(8.dp)) Text( tr("Export all your data to a single JSON file for backup, device migration, or external analysis. Import restores everything — replacing all current data."), @@ -2621,9 +2619,9 @@ fun PrivacyDataSettingsScreen( AutoBackupCard() // App data — destructive reset/restore actions. - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("App data"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("App data"), style = PulseType.title) Spacer(Modifier.height(8.dp)) // Unpairing lives on Ring & sync only (one place for the ring); this card only // erases the app's own data. @@ -2646,9 +2644,9 @@ fun PrivacyDataSettingsScreen( } // Demo data — Android-only (iOS seeds via the Simulator's SeedData). - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Demo data"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Demo data"), style = PulseType.title) Spacer(Modifier.height(8.dp)) Text( tr("Explore the app without a ring. Seeds activity, HR, SpO2, sleep, and a coach conversation."), @@ -2667,13 +2665,13 @@ fun PrivacyDataSettingsScreen( } // Diagnostics export. - Card(Modifier.fillMaxWidth()) { + SubScreenCard { 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) + Text(tr("Diagnostics"), style = PulseType.title) Spacer(Modifier.height(8.dp)) Text( tr("Export app, device, and wearable logs as JSON for bug reports."), @@ -2918,19 +2916,16 @@ fun AboutSettingsScreen(onOpenDebug: () -> Unit, onBack: () -> Unit) { .clip(CircleShape) .background(PulseColors.elevated) .border(1.dp, PulseColors.borderSubtle, CircleShape) - .padding(horizontal = 16.dp, vertical = 10.dp) + .padding(horizontal = 16.dp, vertical = 12.dp) .semantics { liveRegion = LiveRegionMode.Polite }, ) } }, ) { // Version row: tap 7× to unlock Developer options; a tint/border builds with progress. - Card( - Modifier - .fillMaxWidth() - .clip(RoundedCornerShape(4.dp)) - .clickable { registerVersionTap() } - .border(1.5.dp, PulseColors.accent.copy(alpha = tapProgress * 0.9f), RoundedCornerShape(4.dp)), + SubScreenCard( + Modifier.border(1.5.dp, PulseColors.accent.copy(alpha = tapProgress * 0.9f), RoundedCornerShape(8.dp)), + onClick = { registerVersionTap() }, ) { Column( Modifier @@ -2938,7 +2933,7 @@ fun AboutSettingsScreen(onOpenDebug: () -> Unit, onBack: () -> Unit) { .dither(PulseColors.accent, tapProgress * 0.22f) .padding(16.dp), ) { - Text(tr("Version"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Version"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( trf("PulseLoop v{0} ({1})", com.pulseloop.BuildConfig.VERSION_NAME, com.pulseloop.BuildConfig.VERSION_CODE), @@ -2947,9 +2942,9 @@ fun AboutSettingsScreen(onOpenDebug: () -> Unit, onBack: () -> Unit) { } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("PulseLoop"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("PulseLoop"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( tr("An LLM-native health app that turns a cheap Bluetooth smart ring into a real, " + @@ -2964,18 +2959,16 @@ fun AboutSettingsScreen(onOpenDebug: () -> Unit, onBack: () -> Unit) { } // Project — source link + license (iOS AboutSettingsView "Project" section). - Card( - Modifier.fillMaxWidth().clickable { - try { - context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(REPO_URL))) - } catch (_: Exception) { - // No browser available — nothing to open. - } - }, - ) { + SubScreenCard(onClick = { + try { + context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(REPO_URL))) + } catch (_: Exception) { + // No browser available — nothing to open. + } + }) { Row(Modifier.padding(16.dp).fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) { Column(Modifier.weight(1f)) { - Text(tr("Source on GitHub"), style = MaterialTheme.typography.titleSmall, fontWeight = FontWeight.SemiBold) + Text(tr("Source on GitHub"), style = PulseType.title) Text( REPO_URL.removePrefix("https://"), style = MaterialTheme.typography.bodySmall, @@ -2986,9 +2979,9 @@ fun AboutSettingsScreen(onOpenDebug: () -> Unit, onBack: () -> Unit) { } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("License"), style = MaterialTheme.typography.titleSmall, fontWeight = FontWeight.SemiBold) + Text(tr("License"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( tr("Open-source health tracker. Ported from iOS.\nCC BY 4.0 · Free to share and " + @@ -3019,7 +3012,7 @@ fun NutritionSettingsScreen(onBack: () -> Unit, onNavigateToNutrition: () -> Uni SettingsSubScreen(title = tr("Nutrition"), onBack = onBack) { CoachManagedCard(com.pulseloop.service.GoalSync.NUTRITION_FIELDS) { goalReload++ } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Row(Modifier.fillMaxWidth() .switchRow(checked = goal?.nutritionEnabled == true, enabled = goalLoaded, onCheckedChange = { enabled -> @@ -3038,7 +3031,7 @@ fun NutritionSettingsScreen(onBack: () -> Unit, onNavigateToNutrition: () -> Uni } if (goal?.nutritionEnabled == true) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { Text(tr("Daily Goals"), fontWeight = FontWeight.SemiBold) NutrientStepper(tr("Calories (kcal)"), goal?.intakeCalories ?: 2000.0, 50.0, 100.0, 10000.0) { v -> @@ -3066,7 +3059,7 @@ fun NutritionSettingsScreen(onBack: () -> Unit, onNavigateToNutrition: () -> Uni } } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { Text(tr("Quick Access"), fontWeight = FontWeight.SemiBold) Spacer(Modifier.height(8.dp)) @@ -3131,9 +3124,9 @@ fun StravaSettingsScreen(onBack: () -> Unit) { SettingsSubScreen(title = tr("Strava"), onBack = onBack) { if (!isConfigured) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Strava Not Configured"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Strava Not Configured"), style = PulseType.title) Spacer(Modifier.height(8.dp)) Text( tr("Add stravaClientId and stravaClientSecret to local.properties to enable Strava integration."), @@ -3145,9 +3138,9 @@ fun StravaSettingsScreen(onBack: () -> Unit) { return@SettingsSubScreen } - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Strava Integration"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Strava Integration"), style = PulseType.title) Spacer(Modifier.height(8.dp)) Text( if (isConnected) trf("Connected as {0}. Workouts sync automatically when finished.", athleteName) @@ -3217,9 +3210,9 @@ fun StravaSettingsScreen(onBack: () -> Unit) { } if (isConnected) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Auto Upload"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Auto Upload"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( "Finished workouts are automatically uploaded to Strava. GPS routes, heart rate data, and sport type are included.", @@ -3231,15 +3224,9 @@ fun StravaSettingsScreen(onBack: () -> Unit) { } statusMessage?.let { msg -> - Card( - Modifier.fillMaxWidth(), - // containerColor alone leaves contentColor Unspecified, so the Text falls back to - // LocalContentColor (dark) and renders near-invisible on this dark card. - colors = CardDefaults.cardColors( - containerColor = PulseColors.cardSoft, - contentColor = PulseColors.textPrimary, - ), - ) { + // SubScreenCard provides textPrimary as the content colour, so a Text without its + // own colour reads on this card. + SubScreenCard(color = PulseColors.cardSoft) { Text(msg, modifier = Modifier.padding(16.dp), style = MaterialTheme.typography.bodyMedium) } } @@ -3397,9 +3384,9 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { } SettingsSubScreen(title = tr("Health Connect"), onBack = onBack) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Health Connect"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Health Connect"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( tr("Export ring data to Health Connect so other apps and dashboards can show it. Exporting only writes. PulseLoop reads Health Connect only for features you turn on: body data in your profile, Use without a ring, and the accuracy check."), @@ -3475,7 +3462,7 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { } if (availability == HealthConnectAvailability.AVAILABLE && prefs.isConnected) { - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { // Thirteen switches folded behind one row: most people set this once. var typesOpen by remember { mutableStateOf(false) } @@ -3483,7 +3470,7 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { 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(tr("Data Types"), style = PulseType.title, modifier = Modifier.weight(1f)) Text( if (typesOpen) tr("Hide") else tr("Show"), style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.primary, @@ -3588,15 +3575,9 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { // exported; the card now stays, and says plainly what it can and cannot do without // permissions. if (availability == HealthConnectAvailability.AVAILABLE && (prefs.isConnected || hasExportState)) { - Card( - Modifier.fillMaxWidth(), - // containerColor alone leaves contentColor Unspecified, so the Text falls back to - // LocalContentColor (dark) and renders near-invisible on this dark card. - colors = CardDefaults.cardColors( - containerColor = PulseColors.cardSoft, - contentColor = PulseColors.textPrimary, - ), - ) { + // SubScreenCard provides textPrimary as the content colour, so a Text without its + // own colour reads on this card. + SubScreenCard(color = PulseColors.cardSoft) { val syncedAt = prefs.lastSyncAt Text( if (syncedAt != null) { @@ -3615,9 +3596,9 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { // Phase 6: "Remove PulseLoop data from Health Connect" (iOS removeAllExportedData parity). // Deletes only the records this app wrote, then clears every watermark + the last-sync // stamp so the export state matches an empty Health store. - Card(Modifier.fillMaxWidth()) { + SubScreenCard { Column(Modifier.padding(16.dp)) { - Text(tr("Remove exported data"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Remove exported data"), style = PulseType.title) Spacer(Modifier.height(4.dp)) Text( tr("Delete every record PulseLoop wrote to Health Connect and reset the export to start fresh. Your ring data in PulseLoop is untouched."), @@ -3647,13 +3628,7 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { // Removal runs in a worker, so its outcome arrives here through the store rather than // through this screen's own state — it survives navigating away and process death. prefs.removalStatus?.takeIf { it != HealthConnectPrefs.REMOVAL_IN_PROGRESS }?.let { msg -> - Card( - Modifier.fillMaxWidth(), - colors = CardDefaults.cardColors( - containerColor = PulseColors.cardSoft, - contentColor = PulseColors.textPrimary, - ), - ) { + SubScreenCard(color = PulseColors.cardSoft) { Row( Modifier.padding(16.dp).fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, @@ -3667,15 +3642,9 @@ fun HealthConnectSettingsScreen(onBack: () -> Unit) { } statusMessage?.let { msg -> - Card( - Modifier.fillMaxWidth(), - // containerColor alone leaves contentColor Unspecified, so the Text falls back to - // LocalContentColor (dark) and renders near-invisible on this dark card. - colors = CardDefaults.cardColors( - containerColor = PulseColors.cardSoft, - contentColor = PulseColors.textPrimary, - ), - ) { + // SubScreenCard provides textPrimary as the content colour, so a Text without its + // own colour reads on this card. + SubScreenCard(color = PulseColors.cardSoft) { Text(msg, modifier = Modifier.padding(16.dp), style = MaterialTheme.typography.bodyMedium) } } @@ -3835,8 +3804,8 @@ private fun CoachManagedCard(fields: Set, val following = remember(refresh, goal) { com.pulseloop.service.GoalSync.following(context).intersect(fields) } val g = goal ?: return - Card(Modifier.fillMaxWidth()) { - Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) { + SubScreenCard { + Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { Row(Modifier.switchRow(checked = following.size == fields.size, onCheckedChange = { on -> com.pulseloop.service.GoalSync.setFollowing(context, fields, on) scope.launch { @@ -3882,11 +3851,11 @@ private fun AutoBackupCard() { status = backupStatus(context) } } - Card(Modifier.fillMaxWidth()) { - Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { + SubScreenCard { + Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { Row(verticalAlignment = Alignment.CenterVertically) { Column(Modifier.weight(1f)) { - Text(tr("Automatic backups"), style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) + Text(tr("Automatic backups"), style = PulseType.title) Text( tr("Saves the same file as Export to a folder you choose, and keeps the latest 5."), style = MaterialTheme.typography.bodySmall, @@ -3941,3 +3910,31 @@ private fun backupStatus(context: android.content.Context): String { val fmt = java.text.SimpleDateFormat("EEE d MMM, HH:mm", java.util.Locale.getDefault()) return "Last backup: ${fmt.format(java.util.Date(last))}" } + +/** + * The surface every Settings sub-screen groups its controls on: the card colour, a hairline + * border and the one 8dp radius, like `SettingsSection` and the newer sub-screens. It replaces + * Material's `Card` here (which drew the elevated grey) and keeps Card's content contract, so + * text without its own colour still reads as primary text. + */ +@Composable +private fun SubScreenCard( + modifier: Modifier = Modifier, + color: androidx.compose.ui.graphics.Color = PulseColors.card, + borderColor: androidx.compose.ui.graphics.Color = PulseColors.borderSubtle, + onClick: (() -> Unit)? = null, + content: @Composable ColumnScope.() -> Unit, +) { + val shape = RoundedCornerShape(8.dp) + CompositionLocalProvider(LocalContentColor provides PulseColors.textPrimary) { + Column( + modifier + .fillMaxWidth() + .clip(shape) + .background(color) + .then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier) + .border(1.dp, borderColor, shape), + content = content, + ) + } +} diff --git a/app/src/main/java/com/pulseloop/update/UpdateUi.kt b/app/src/main/java/com/pulseloop/update/UpdateUi.kt index 26d4caa8..66bade88 100644 --- a/app/src/main/java/com/pulseloop/update/UpdateUi.kt +++ b/app/src/main/java/com/pulseloop/update/UpdateUi.kt @@ -51,7 +51,14 @@ fun UpdateDialog(info: UpdateInfo, onDismiss: () -> Unit) { if (downloading) { Text(trf("Downloading… {0}%", (progress * 100).toInt()), style = MaterialTheme.typography.bodyMedium) Spacer(Modifier.height(8.dp)) - LinearProgressIndicator(progress = { progress }, modifier = Modifier.fillMaxWidth()) + LinearProgressIndicator( + progress = { progress }, + modifier = Modifier.fillMaxWidth(), + // Progress is a state, not a tap target: no mint (theme colours, + // like the rest of this dialog). + color = MaterialTheme.colorScheme.onSurface, + trackColor = MaterialTheme.colorScheme.surfaceVariant, + ) } else { MarkdownLite( info.changelog, @@ -63,7 +70,8 @@ fun UpdateDialog(info: UpdateInfo, onDismiss: () -> Unit) { // be near-invisible on a light dialog. headingColor = MaterialTheme.colorScheme.onSurface, bodyColor = MaterialTheme.colorScheme.onSurfaceVariant, - bulletColor = MaterialTheme.colorScheme.primary, + // A bullet is not tappable, so it is not mint. + bulletColor = MaterialTheme.colorScheme.onSurfaceVariant, boldColor = MaterialTheme.colorScheme.onSurface, ) error?.let { From 47bfa1da18725224c2355c80fd8697c8e1b56aed Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 21:15:11 +0000 Subject: [PATCH 5/6] Carried P3s: unit keys, phone clock, locale dates, Log meal, MCP follows address changes - " min" / "bpm" / "ms" on My Health, Readiness and Postpartum go through trf("{0} min") etc. - BedtimeGuidance.fmt and SleepFormat.clockTime take the 12/24-hour flag and format through PhoneFormat (new LocalTime overload; JVM-safe pattern fallback). The wind-down notification and the Tonight card pass the phone's setting. - Accuracy dates use locale skeletons (MMMd, EEEMMMd) through PhoneFormat; the off-time in a day note follows the clock setting. Share/Copy texts keep their content. - "Log Meal" -> "Log meal" (key already translated). - McpService watches networks while it runs and calls McpServer.rebind on a change: drops addresses the phone lost, binds new private ones, keeps the rest. Still never mobile data or a public address. ACCESS_NETWORK_STATE added; threat model updated. Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w --- app/src/main/AndroidManifest.xml | 2 + .../health/HealthConnectTypeMappings.kt | 2 +- .../health/accuracy/AccuracyReportText.kt | 13 ++-- .../main/java/com/pulseloop/mcp/McpServer.kt | 53 ++++++++++++---- .../main/java/com/pulseloop/mcp/McpService.kt | 63 +++++++++++++++++++ .../pulseloop/notifications/GuidanceWorker.kt | 3 +- .../com/pulseloop/service/DailyGuidance.kt | 6 +- .../com/pulseloop/service/SleepInsights.kt | 12 ++-- .../pulseloop/ui/components/ActivityMeta.kt | 23 ++++++- .../pulseloop/ui/screens/AccuracyCheckUi.kt | 11 ++-- .../pulseloop/ui/screens/AccuracyReportUi.kt | 8 +-- .../com/pulseloop/ui/screens/GuidanceUi.kt | 9 +-- .../com/pulseloop/ui/screens/MyHealthUi.kt | 12 ++-- .../pulseloop/ui/screens/NutritionScreen.kt | 4 +- .../com/pulseloop/ui/screens/PostpartumUi.kt | 2 +- .../com/pulseloop/ui/screens/ReadinessUi.kt | 2 +- .../health/accuracy/AccuracyComparisonTest.kt | 14 +++++ .../com/pulseloop/mcp/McpServerSocketTest.kt | 27 ++++++++ .../ui/components/PhoneFormatClockTest.kt | 41 ++++++++++++ docs/mcp-threat-model.md | 14 ++++- 20 files changed, 260 insertions(+), 61 deletions(-) create mode 100644 app/src/test/java/com/pulseloop/ui/components/PhoneFormatClockTest.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 12e24f6a..1e61a210 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,6 +40,8 @@ + + A{Add} + A -->|saved| S[Snackbar: Workout added · card leaves] + A -->|error| F[Snackbar: Couldn't add… · card stays] + P[Settings › Add ring] --> Q[Pairing with top bar] -->|Back| P + C[Trend chart] --> Z[Zoom − / + buttons or pinch] --> R[Reset] +``` + +| # | Question | Result | +|---|---|---| +| 1 | Job | Pass | +| 2 | Entries | Pass: no new doors. Customize cards keeps its target | +| 3 | Happy path | Pass: no step added to a common action | +| 4 | Branches | Pass: Add has a success and a failure branch | +| 5 | States | Pass: success and failure for Add, both zoom limits, Android 15 hours | +| 6 | Errors | Pass: the silent failure is gone | +| 7 | Control | Pass: Back on pairing; zoom out and reset | +| 8 | Progress and resume | Not applicable | +| 9 | Memory | Pass: a stored 8 h is clamped, not lost | +| 10 | Exits | Pass | +| 11 | Conventions | Pass: Snackbar, `PulseTopBar`, PulseButton Text link | +| 12 | Speed | Pass | +| 13 | Accessibility | Pass: Snackbars are announced, single-pointer zoom, roles, 48dp | +| 14 | Ethics | Pass | +| 15 | Evidence | Unit tests (MCP clamp, PhoneFormat clock, accuracy day note, MCP rebind); CI | + +## impeccable (native audit) + +| Dimension | Before (v2.11.59) | After | +|---|---|---| +| Accessibility | 3–4 | 4 | +| Performance | 3–4 | 4 | +| Appearance & theming | 3–4 | 4 | +| Platform conformance | 3–4 | 4 | +| Adaptivity | 3 | 4 | +| **Total** | **17/20** | **20/20** | + +No open P0 to P2 in the app's own code. The only items left are the three in the table above +that no code change here can close. + +## graphic-design-fundamentals (§13) + +| # | Question | Result | +|---|---|---| +| 1–3 | Brief, concept, hierarchy | Pass: Customize cards drops to the end; the snackbar doesn't push layout | +| 4, 8 | Contrast, colour | Pass: no mint on anything you can't tap; the snackbar has no mint | +| 5–7 | Alignment, spacing, typography | Pass: spacing on the scale, `PulseType` titles, 20dp icons | +| 9–10 | Consistency, simplicity | Pass: one card surface in Settings, one top bar, one filled button per screen | +| 11–12 | Real size, accessibility | Pass (by reading) | +| 13 | Production | Pass: every `tr()` key has a pt-BR entry (script-checked), every `Icons.*` is imported, no off-scale `fontSize`, no direct Material button | + +## less-is-more + +| Element | Question | Action | +|---|---|---| +| "Customize cards" at full weight above the cards | 5 (rare action) | Moved to a quiet link at the end | +| Second filled button on Record | 2 | Outlined | +| Mint bullets and progress | 1 | Neutral | +| Snackbar on Add | 1 (feedback) | Added: it replaces a silent result, not a step | + +| Dimension | 0–4 | +|---|---| +| Elements per screen, compared with before | 4 | +| Duplicates left | 4 | +| Text to read when tired | 4 | +| Taps on the common actions (must not rise) | 4 (none rose) | + +## Verdict + +Merge. **Green:** there is no open P0, P1, P2 or P3 in the app's code. Three items remain outside +the code: a measurement on the owner's phone, two design-system decisions, and the canvas sync. +They are listed above with who acts.