Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ Read this before touching ring/BLE hardware code (`app/src/main/java/com/pulselo

**The owner's standing instruction (2026-11-04): open a PR for every change and, once it's verified
(CI green, the repo's own tests and checks run, no unresolved review threads), merge it yourself;
don't leave it waiting.** Use a merge commit, the way `main`'s history does. A release is a separate
step: the Release workflow (`release.yml`, `workflow_dispatch`) with the next `v{name}+{code}` tag,
run when the owner asks for one. The same rule is in the Gabriel Design System's AGENTS.md.
don't leave it waiting.** Use a merge commit, the way `main`'s history does.

**Then release, every time** (owner's correction, 2026-11-04: an earlier "only when asked" was a
mistake). After each merge to `main`, run the Release workflow (`release.yml`,
`workflow_dispatch`) with the next `v{name}+{code}` tag: check the releases list first, since
another session may have taken the next number, and confirm the release carries both the APK and
`SHA256SUMS.txt`. The merge rule is also in the Gabriel Design System's AGENTS.md; this release
rule is PulseLoop's.

## Commits carry no agent attribution

Expand Down Expand Up @@ -1308,8 +1313,8 @@ serving, AI-estimate source); changing a number marks it `userEdited`, as a barc
## Type, colour and chrome: one of each role (audit, v2.11.52)

- **Type sizes come from `PulseType.SCALE`** (12, 14, 16, 20, 24, 28, 32, 40). 12sp is the floor
for anything that carries meaning; `PulseTypeScaleTest` fails on any other inline size in the
main screens. The tracked caps label over a card or section is `PulseType.eyebrow` (12sp,
for anything that carries meaning; `PulseTypeScaleTest` fails on any other inline size in any
source file. The tracked caps label over a card or section is `PulseType.eyebrow` (12sp,
1sp tracking, `textSecondary`) everywhere — don't hand-roll another letter-spacing.
- **Mint is the brand and the thing to tap, nothing else.** `success` (good, in range,
connected) is its own green, REM is cyan, connecting is amber. The readiness ring keeps the
Expand Down
59 changes: 59 additions & 0 deletions app/src/main/assets/i18n/pt-BR.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object PendingActionExecutor {

val sessions = db.activitySessionDao().recent(200)
val session = sessions.firstOrNull { it.id == action.activityId }
?: return "That workout no longer exists."
?: return com.pulseloop.ui.i18n.tr("That workout no longer exists.")

val typeLabel = activityLabels[session.type] ?: session.type

Expand All @@ -46,11 +46,11 @@ object PendingActionExecutor {
updatedAt = System.currentTimeMillis(),
)
)
"Deleted the $typeLabel session."
com.pulseloop.ui.i18n.trf("Deleted the {0} session.", com.pulseloop.ui.i18n.tr(typeLabel))
}
PendingActionKind.UPDATE_ACTIVITY_SESSION -> {
applyUpdates(db, action.updates, session)
"Updated the $typeLabel session."
com.pulseloop.ui.i18n.trf("Updated the {0} session.", com.pulseloop.ui.i18n.tr(typeLabel))
}
}
}
Expand All @@ -64,7 +64,7 @@ object PendingActionExecutor {
*/
private suspend fun executeMeal(action: PendingAction, db: PulseLoopDatabase): String {
val entry = db.mealEntryDao().byId(action.activityId)
?: return "That meal no longer exists."
?: return com.pulseloop.ui.i18n.tr("That meal no longer exists.")
return when (action.kind) {
PendingActionKind.DELETE_MEAL_ENTRY -> {
val name = entry.name
Expand Down
23 changes: 10 additions & 13 deletions app/src/main/java/com/pulseloop/coach/schema/CoachActionCardView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.pulseloop.coach.orchestration.PendingAction
import com.pulseloop.coach.orchestration.PendingActionKind

Expand All @@ -37,32 +38,28 @@ fun CoachActionCardView(
modifier = Modifier
.fillMaxWidth()
.dither(tone, 0.08f, RoundedCornerShape(8.dp))
.padding(14.dp),
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.CenterVertically) {
Icon(Icons.Filled.Warning, null, tint = tone, modifier = Modifier.size(14.dp))
Text(
"Confirm action",
style = MaterialTheme.typography.labelSmall,
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {
Icon(Icons.Filled.Warning, null, tint = tone, modifier = Modifier.size(22.dp))
Text(com.pulseloop.ui.i18n.tr("CONFIRM CHANGE"), style = com.pulseloop.ui.theme.PulseType.eyebrow)
}

Text(action.summary, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurface)
Text(action.summary, fontSize = 14.sp, color = PulseColors.textPrimary)

Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
PulseButton(PulseButtonStyle.Outlined,
onClick = onCancel,
modifier = Modifier.weight(1f),
) {
Text("Cancel")
Text(com.pulseloop.ui.i18n.tr("Cancel"))
}
PulseButton(
// Tonal, tinted by the risk: the tab's one filled accent stays the Actions button.
PulseButton(PulseButtonStyle.Tonal,
onClick = onConfirm,
modifier = Modifier.weight(1f),
colors = ButtonDefaults.buttonColors(containerColor = tone),
colors = ButtonDefaults.filledTonalButtonColors(containerColor = tone.copy(alpha = 0.22f), contentColor = tone),
) {
Text(action.confirmLabel)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fun CoachToolTraceDisclosure(messageId: String, viewModel: CoachViewModel?) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
modifier = Modifier.clickable { expanded = !expanded },
modifier = Modifier.heightIn(min = 48.dp).clickable(role = androidx.compose.ui.semantics.Role.Button) { expanded = !expanded },
) {
Icon(Icons.Filled.Build, null, tint = PulseColors.textMuted, modifier = Modifier.size(11.dp))
Text(
Expand Down Expand Up @@ -74,7 +74,7 @@ fun CoachToolTraceDisclosure(messageId: String, viewModel: CoachViewModel?) {
}

private fun collapsedLabel(calls: List<CoachToolCallEntity>): String {
if (calls.size > 2) return "Used ${calls.size} tools"
if (calls.size > 2) return com.pulseloop.ui.i18n.trf("Used {0} tools", calls.size)
return calls.joinToString(" → ") { displayLabel(it) }
}

Expand All @@ -93,12 +93,7 @@ private fun ToolTraceRow(call: CoachToolCallEntity) {
)
Column(verticalArrangement = Arrangement.spacedBy(1.dp)) {
Text(displayLabel(call), fontSize = 12.sp, fontWeight = FontWeight.Medium, color = PulseColors.textSecondary)
if (call.outputJSON?.isNotBlank() == true) {
Text(
call.outputJSON, fontSize = 12.sp, color = PulseColors.textMuted,
maxLines = 1, overflow = TextOverflow.Ellipsis,
)
}
// The raw tool output (JSON) is a log, not a state: it stays in the usage sheet's data.
}
}
}
8 changes: 4 additions & 4 deletions app/src/main/java/com/pulseloop/coach/tools/NutritionTools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ object NutritionTools {
ctx.pendingActions.add(PendingAction(
kind = PendingActionKind.UPDATE_MEAL_ENTRY,
activityId = mealId,
summary = "Update \"${entry.name}\" from ${CoachDataAccess.localDateString(entry.timestamp)}?",
confirmLabel = "Save changes",
summary = com.pulseloop.ui.i18n.trf("Update \"{0}\" from {1}?", entry.name, CoachDataAccess.localDateString(entry.timestamp)),
confirmLabel = com.pulseloop.ui.i18n.tr("Save changes"),
mealUpdates = updates,
))
ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to edit that meal."}""")
Expand Down Expand Up @@ -425,8 +425,8 @@ object NutritionTools {
ctx.pendingActions.add(PendingAction(
kind = PendingActionKind.DELETE_MEAL_ENTRY,
activityId = mealId,
summary = "Delete \"${entry.name}\" (${entry.calories.roundToLong()} kcal) from ${CoachDataAccess.localDateString(entry.timestamp)}?",
confirmLabel = "Delete",
summary = com.pulseloop.ui.i18n.trf("Delete \"{0}\" ({1} kcal) from {2}?", entry.name, entry.calories.roundToLong(), CoachDataAccess.localDateString(entry.timestamp)),
confirmLabel = com.pulseloop.ui.i18n.tr("Delete"),
))
ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to delete that meal."}""")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,8 @@ object ActionTools {
ctx.pendingActions.add(com.pulseloop.coach.orchestration.PendingAction(
kind = com.pulseloop.coach.orchestration.PendingActionKind.UPDATE_ACTIVITY_SESSION,
activityId = activityId,
summary = "Update your ${session.type} session from ${CoachDataAccess.localDateString(session.startedAt)}?",
confirmLabel = "Save changes",
summary = com.pulseloop.ui.i18n.trf("Update your {0} session from {1}?", session.type, CoachDataAccess.localDateString(session.startedAt)),
confirmLabel = com.pulseloop.ui.i18n.tr("Save changes"),
updates = updates,
))
ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to edit that workout."}""")
Expand Down Expand Up @@ -933,8 +933,8 @@ object ActionTools {
ctx.pendingActions.add(com.pulseloop.coach.orchestration.PendingAction(
kind = com.pulseloop.coach.orchestration.PendingActionKind.DELETE_ACTIVITY_SESSION,
activityId = activityId,
summary = "Delete your ${session.type} session from ${CoachDataAccess.localDateString(session.startedAt)}? This can't be undone.",
confirmLabel = "Delete",
summary = com.pulseloop.ui.i18n.trf("Delete your {0} session from {1}? This can't be undone.", session.type, CoachDataAccess.localDateString(session.startedAt)),
confirmLabel = com.pulseloop.ui.i18n.tr("Delete"),
))
ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to delete that workout."}""")
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/pulseloop/service/LabReports.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ object LabReports {
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
ReadResult.Failure(trf("Reading failed: {0}", e.message ?: e.javaClass.simpleName))
android.util.Log.w("LabReports", "Reading the report failed", e)
ReadResult.Failure(tr("Couldn't read the report. Check your connection and try again."))
}
}

Expand Down
26 changes: 26 additions & 0 deletions app/src/main/java/com/pulseloop/ui/components/AppChrome.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pulseloop.ui.components

import androidx.compose.material.icons.automirrored.filled.ArrowBack
import com.pulseloop.ui.i18n.trf

import com.pulseloop.ui.i18n.tr
Expand Down Expand Up @@ -288,3 +289,28 @@ fun SectionHeaderCaps(title: String, modifier: Modifier = Modifier, action: (@Co
action?.invoke()
}
}

/**
* The top bar of every pushed screen: a back arrow, the title centred in `PulseType.title`, and
* optional actions. One component so pushed screens stop hand-rolling a Box + IconButton header
* in three slightly different type styles (audit, v2.11.58).
*/
@OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class)
@Composable
fun PulseTopBar(
title: String,
onBack: () -> Unit,
actions: @Composable androidx.compose.foundation.layout.RowScope.() -> Unit = {},
) {
androidx.compose.material3.CenterAlignedTopAppBar(
title = { Text(title, style = com.pulseloop.ui.theme.PulseType.title, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis) },
navigationIcon = {
androidx.compose.material3.IconButton(onClick = onBack) {
androidx.compose.material3.Icon(androidx.compose.material.icons.Icons.AutoMirrored.Filled.ArrowBack, com.pulseloop.ui.i18n.tr("Back"))
}
},
actions = actions,
windowInsets = androidx.compose.foundation.layout.WindowInsets(0, 0, 0, 0),
colors = androidx.compose.material3.TopAppBarDefaults.topAppBarColors(containerColor = com.pulseloop.ui.theme.PulseColors.background),
)
}
16 changes: 12 additions & 4 deletions app/src/main/java/com/pulseloop/ui/components/DeviceHeroCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,33 @@ fun DeviceHeroCard(
verticalArrangement = Arrangement.spacedBy(14.dp),
) {
status.batteryText?.let { batteryText ->
// Tinted by level: always green read "fine" at 5%.
val pct = batteryText.filter { it.isDigit() }.toIntOrNull()
val batteryTone = when {
pct == null -> PulseColors.textSecondary
pct <= 20 -> PulseColors.danger
pct <= 50 -> PulseColors.warning
else -> PulseColors.success
}
Row(
Modifier
.clip(CircleShape)
.dither(PulseColors.success, 0.12f)
.padding(horizontal = 9.dp, vertical = 6.dp),
.dither(batteryTone, 0.12f)
.padding(horizontal = 8.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
Icon(
Icons.Filled.BatteryFull,
contentDescription = null,
modifier = Modifier.size(12.dp),
tint = PulseColors.success,
tint = batteryTone,
)
Text(
batteryText,
fontSize = 12.sp,
fontWeight = FontWeight.SemiBold,
color = PulseColors.success,
color = batteryTone,
)
}
}
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/com/pulseloop/ui/components/TodayTiles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.Layout
Expand Down Expand Up @@ -130,7 +129,6 @@ fun TodayTile(
Box(
Modifier
.size(8.dp)
.shadow(5.dp, CircleShape, ambientColor = color.copy(alpha = 0.7f), spotColor = color.copy(alpha = 0.7f))
.clip(CircleShape)
.background(color),
)
Expand Down Expand Up @@ -492,7 +490,6 @@ fun CoachMessageCard(
Box(
Modifier
.size(6.dp)
.shadow(5.dp, CircleShape, ambientColor = PulseColors.accent, spotColor = PulseColors.accent)
.clip(CircleShape)
.background(PulseColors.accent),
)
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/com/pulseloop/ui/components/VitalCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
Expand Down Expand Up @@ -66,8 +65,8 @@ fun VitalCard(
) {
Column(
modifier = Modifier.padding(
horizontal = if (compact) 16.dp else 22.dp,
vertical = if (compact) 16.dp else 20.dp,
horizontal = if (compact) 16.dp else 24.dp,
vertical = 16.dp,
),
verticalArrangement = Arrangement.spacedBy(if (compact) 6.dp else 8.dp),
) {
Expand All @@ -91,7 +90,6 @@ private fun CardHeader(state: VitalCardState, compact: Boolean, footerText: Stri
Box(
Modifier
.size(8.dp)
.shadow(5.dp, CircleShape, ambientColor = accent, spotColor = accent)
.clip(CircleShape)
.background(accent),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ fun WorkoutMapView(
contentAlignment = Alignment.Center,
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text("No route yet", style = MaterialTheme.typography.labelMedium, color = Color.White)
Text("Move outdoors to start tracking your route.", style = MaterialTheme.typography.labelSmall, color = Color.White.copy(alpha = 0.6f))
Text(com.pulseloop.ui.i18n.tr("No route yet"), style = MaterialTheme.typography.labelMedium, color = com.pulseloop.ui.theme.PulseColors.textPrimary)
Text(com.pulseloop.ui.i18n.tr("Move outdoors to start tracking your route."), style = MaterialTheme.typography.labelSmall, color = com.pulseloop.ui.theme.PulseColors.textSecondary)
}
}
} else {
Expand Down Expand Up @@ -81,7 +81,7 @@ fun WorkoutMapView(
}
drawPath(
path = path,
color = PulseColors.accent,
color = PulseColors.distance,
style = Stroke(width = 4f, cap = StrokeCap.Round),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private fun EditBadge(
fun HiddenMetricsTray(hidden: List<DashboardCard>, onRestore: (DashboardCard) -> Unit) {
if (hidden.isEmpty()) return
Column(Modifier.fillMaxWidth().padding(vertical = 8.dp)) {
Text("HIDDEN", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Text(com.pulseloop.ui.i18n.tr("HIDDEN"), style = com.pulseloop.ui.theme.PulseType.eyebrow)
hidden.forEach { card ->
Row(
Modifier.fillMaxWidth().padding(vertical = 2.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ private fun MetricCard(
fontSize = 12.sp, color = verdictColor(summary.verdict),
maxLines = 2, overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(start = 8.dp).widthIn(max = 140.dp)
.clip(RoundedCornerShape(10.dp)).background(PulseColors.cardSoft).padding(horizontal = 8.dp, vertical = 3.dp),
.clip(RoundedCornerShape(16.dp)).background(PulseColors.cardSoft).padding(horizontal = 8.dp, vertical = 4.dp),
)
}
Text(AccuracyReportText.reading(summary, check.referenceLabel), fontSize = 12.sp, color = PulseColors.textSecondary)
if (summary.verdict == Verdict.CONSISTENTLY_HIGH || summary.verdict == Verdict.CONSISTENTLY_LOW) {
correction?.invoke(summary)
}
if (!expanded) {
Text(tr("Details"), fontSize = 12.sp, color = PulseColors.accent, modifier = Modifier.clickable(onClick = onToggle))
com.pulseloop.ui.components.PulseButton(com.pulseloop.ui.components.PulseButtonStyle.Text, onClick = onToggle) { Text(tr("Details")) }
return@AccuracyCard
}
if (m.kind != ComparisonMetric.Kind.STAGES && summary.validDays > 0) {
Expand Down
Loading
Loading