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
14 changes: 13 additions & 1 deletion app/src/main/assets/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
"Body fat {0}%": "Gordura corporal {0}%",
"Body metrics": "Medidas corporais",
"Body temperature": "Temperatura corporal",
"Breakfast": "Café da manhã",
"Breastfeeding and formula": "Amamentação e fórmula",
"Breastfeeding only": "Só amamentação",
"Breastfeeding only, day and night": "Só amamentação, de dia e de noite",
Expand Down Expand Up @@ -300,6 +301,7 @@
"Cardio": "Cardio",
"Cardio capacity (VO₂max)": "Capacidade cardio (VO₂max)",
"Cardio capacity {0}, estimated from resting heart rate and age": "Capacidade cardio {0}, estimada a partir da frequência cardíaca em repouso e da idade",
"Cardio load": "Carga cardio",
"Cardio load today": "Carga cardio hoje",
"Castanhas": "Castanhas",
"Casual or brisk walking": "Caminhada leve ou rápida",
Expand Down Expand Up @@ -452,6 +454,7 @@
"Device: not recorded": "Dispositivo: não registrado",
"Diagnostics": "Diagnósticos",
"Diastolic": "Diastólica",
"Dinner": "Jantar",
"Disabled": "Desativado",
"Disconnect": "Desconectar",
"Disconnect Strava?": "Desconectar o Strava?",
Expand Down Expand Up @@ -486,6 +489,7 @@
"Early evening, when you're under 70% of your step goal. Off in Rest Mode.": "No início da noite, quando você estiver abaixo de 70% da sua meta de passos. Desativado no Modo Descanso.",
"Edit": "Editar",
"Edit goals": "Editar metas",
"Edit life stage": "Editar fase da vida",
"Edit sleep record": "Editar registro de sono",
"Edit this record's times": "Editar os horários deste registro",
"Edit workout": "Editar treino",
Expand Down Expand Up @@ -696,6 +700,7 @@
"How much you were awake once asleep. Some waking is normal; long or frequent wake-ups lower this.": "Quanto tempo você ficou acordado depois de adormecer. Despertar um pouco é normal; despertares longos ou frequentes reduzem esta nota.",
"How often the ring measures in the background. Shorter heart-rate intervals give finer history at the cost of battery.": "Com que frequência o anel mede em segundo plano. Intervalos menores de frequência cardíaca dão um histórico mais detalhado, mas gastam mais bateria.",
"How often you exercised this week. Three or more sessions a week is a good target.": "Com que frequência você se exercitou nesta semana. Três ou mais sessões por semana é uma boa meta.",
"How your last months went: health areas, trends and habits": "Como foram seus últimos meses: áreas da saúde, tendências e hábitos",
"How your ring compares with {0}, the device you chose to trust. This is agreement between two consumer devices, not a lab measurement.": "Como seu anel se compara com {0}, o dispositivo em que você escolheu confiar. É a concordância entre dois aparelhos de consumo, não uma medição de laboratório.",
"Human milk banks (rBLH)": "Bancos de leite humano (rBLH)",
"I don't see sleep data for last night. Wear your ring overnight and sync in the morning so I can compare your sleep against your baseline.": "Não vejo dados de sono da noite passada. Use o anel durante a noite e sincronize de manhã para eu comparar seu sono com sua linha de base.",
Expand Down Expand Up @@ -741,6 +746,7 @@
"Keep still — measuring heart rate & SpO₂…": "Fique parado — medindo frequência cardíaca e SpO₂…",
"Keep still — measuring heart rate…": "Fique parado — medindo frequência cardíaca…",
"Keep still — measuring {0}…": "Fique parado — medindo {0}…",
"Keep the ring snug and your hand still until it finishes.": "Mantenha o anel justo e a mão parada até terminar.",
"Known lung condition": "Doença pulmonar conhecida",
"LAST 3 DAYS": "ÚLTIMOS 3 DIAS",
"LAST CAFFEINE": "ÚLTIMA CAFEÍNA",
Expand All @@ -758,6 +764,7 @@
"Last import {0}": "Última importação {0}",
"Last night": "Ontem à noite",
"Last night's heart rate and HRV readings weren't enough to score recovery": "As leituras de frequência cardíaca e HRV da noite passada não foram suficientes para calcular a recuperação",
"Last night: all within your usual range": "Noite passada: tudo dentro do seu normal",
"Last night: {0}. A few dry nights will show what it does to you.": "Noite passada: {0}. Algumas noites sem álcool vão mostrar o efeito em você.",
"Last night: {0}. Your night looked close to your dry ones.": "Noite passada: {0}. Sua noite ficou parecida com as noites sem álcool.",
"Last night: {0}. {1}.": "Noite passada: {0}. {1}.",
Expand Down Expand Up @@ -830,6 +837,7 @@
"Lower risk": "Risco menor",
"Lowest heart rate {0} before waking": "Frequência cardíaca mais baixa {0} antes de acordar",
"Lowest {0} · {1} readings": "Mínimo {0} · {1} leituras",
"Lunch": "Almoço",
"Luteal": "Lútea",
"MOOD CHECK-IN": "CHECK-IN DE HUMOR",
"MY WEEK": "MINHA SEMANA",
Expand Down Expand Up @@ -1011,7 +1019,7 @@
"On track": "No caminho certo",
"On until {0}/{1}: activity nudges paused, the coach eases off.": "Ativo até {0}/{1}: lembretes de atividade pausados, o Coach pega mais leve.",
"On. PulseLoop syncs your ring about every 30 minutes, even while the phone is idle.": "Ativado. O PulseLoop sincroniza seu anel a cada 30 minutos, mesmo com o celular ocioso.",
"Once per dose, at its time, for what you add in My Health → Medications & supplements.": "Uma vez por dose, no horário dela, para o que você adicionar em Minha saúde → Medicamentos e suplementos.",
"Once per dose, at its time, for what you add with + Log → Medication or supplement.": "Uma vez por dose, no horário, para o que você adicionar em + Registrar → Medicamento ou suplemento.",
"One tap for the usual ones": "Um toque para as de sempre",
"Only needed if you started the server with --api-key. Leave blank otherwise.": "Só é necessário se você iniciou o servidor com --api-key. Caso contrário, deixe em branco.",
"Only new data from now on": "Apenas dados novos daqui em diante",
Expand Down Expand Up @@ -1046,6 +1054,7 @@
"Out of sync": "Fora de sincronia",
"Outdoor or treadmill runs": "Corridas ao ar livre ou na esteira",
"Output tokens": "Tokens de saída",
"Outside your usual last night: {0}": "Fora do seu normal na noite passada: {0}",
"Overwhelming tiredness": "Cansaço extremo",
"Ovos mexidos": "Ovos mexidos",
"Own your ring data": "Seus dados do anel são seus",
Expand Down Expand Up @@ -1327,6 +1336,7 @@
"Slightly off": "Um pouco fora",
"Slow breathing: in for 4 seconds, out for 6.": "Respiração lenta: inspire por 4 segundos, expire por 6.",
"Small signs in your biometrics of something straining your body.": "Sinais leves nos seus dados biométricos de algo sobrecarregando seu corpo.",
"Snack": "Lanche",
"Snap your plate; the AI estimates it": "Fotografe seu prato; a IA faz a estimativa",
"So far (preliminary)": "Até agora (preliminar)",
"Solid": "Boa",
Expand Down Expand Up @@ -1383,6 +1393,7 @@
"Strava Not Configured": "Strava não configurado",
"Strength or circuit training": "Musculação ou treino em circuito",
"Stress": "Estresse",
"Stress & breathing": "Estresse e respiração",
"Stress management": "Gestão do estresse",
"Stressful": "Estressante",
"Stressful day": "Dia estressante",
Expand Down Expand Up @@ -1427,6 +1438,7 @@
"Take the check": "Fazer o teste",
"Taken": "Tomado",
"Talk it through": "Conversar sobre isso",
"Tap to start": "Toque para começar",
"Tapioca com ovo": "Tapioca com ovo",
"Tatá, te amo!": "Tatá, te amo!",
"Team or racket sports": "Esportes coletivos ou de raquete",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,30 @@ object HealthInsightsRepository {
return Snapshot(nights, need, debt, radar, todayStress, resilience, bodyClock, cardio, areas, habits, hrToday, sleepWindows, workoutWindows, cardioLoad)
}

/** Sleep need, debt and body clock: what the Sleep tab shows under last night. */
data class SleepBalance(val need: SleepNeed, val debt: SleepDebt?, val bodyClock: BodyClock?)

suspend fun sleepBalance(db: PulseLoopDatabase, now: Long = System.currentTimeMillis(), zone: ZoneId = ZoneId.systemDefault()): SleepBalance {
val inputs = ReadinessRepository.loadInputs(db, now, zone)
val nights = (inputs.history + listOfNotNull(inputs.lastNight)).sortedBy { it.day }
val today = Instant.ofEpochMilli(now).atZone(zone).toLocalDate()
val need = SleepNeed.estimate(nights, db.userGoalDao().get()?.sleepMinutes ?: 480, today)
return SleepBalance(need, SleepDebt.from(nights, need, today), BodyClock.compute(nights, zone))
}

/** Today's cardio load, for the Activity tab; null until there are enough days of heart rate. */
suspend fun cardioLoadToday(db: PulseLoopDatabase, now: Long = System.currentTimeMillis(), zone: ZoneId = ZoneId.systemDefault()): CardioLoad.Result? {
val inputs = ReadinessRepository.loadInputs(db, now, zone)
val nights = inputs.history + listOfNotNull(inputs.lastNight)
val today = Instant.ofEpochMilli(now).atZone(zone).toLocalDate()
val hr29 = db.measurementDao().rangeReal(MeasurementKind.HEART_RATE.name, today.minusDays(29).atStartOfDay(zone).toInstant().toEpochMilli(), now)
.map { it.timestamp to it.value }
val nightRanges = nights.map { it.startAt..it.endAt }
return runCatching {
CardioLoad.compute(hr29, { t -> nightRanges.any { t in it } }, today, zone, db.userProfileDao().get()?.age)
}.getOrNull()
}

// ── Trends ───────────────────────────────────────────────────────────────

enum class TrendMetric(private val labelEn: String, val unit: String) {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/pulseloop/ui/screens/AccuracyCheckUi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ fun AccuracyCheckSettingsScreen(onBack: () -> Unit) {
}

if (hasRing) AccuracyCorrectionsCard()
// The phone-steps comparison is the same question ("is my ring counting right?"), so it
// lives here rather than in My Health.
if (hasRing) StepCalibrationCard(db)

val past = history.filter { it.state == AccuracyCheckEntity.STATE_DONE }
if (past.isNotEmpty()) {
Expand Down
39 changes: 14 additions & 25 deletions app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -194,38 +194,24 @@ fun ActivityScreen(
) {
Icon(Icons.Filled.CalendarMonth, tr("Workout history"), tint = PulseColors.textSecondary)
}
}
}

item { DetectedActivityCard() }

item {
Row(
Modifier
.fillMaxWidth()
.heightIn(min = 68.dp)
.clip(RoundedCornerShape(8.dp))
.background(PulseColors.card)
.border(1.dp, PulseColors.borderSubtle, RoundedCornerShape(8.dp))
.clickable { navController?.navigate("log_past_activity") }
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
// Logging a forgotten workout used to be its own full-width card between the
// summary and the day's workouts; it is the same job as recording one.
Box(
Modifier.size(40.dp).clip(CircleShape).dither(PulseColors.accent, 0.18f),
Modifier
.size(60.dp)
.clip(CircleShape)
.background(PulseColors.card)
.border(1.dp, PulseColors.borderSubtle, CircleShape)
.clickable(role = Role.Button) { navController?.navigate("log_past_activity") },
contentAlignment = Alignment.Center,
) {
Icon(Icons.Filled.History, null, tint = PulseColors.accent, modifier = Modifier.size(20.dp))
Icon(Icons.Filled.History, tr("Log Past Activity"), tint = PulseColors.textSecondary)
}
Spacer(Modifier.width(12.dp))
Column(Modifier.weight(1f)) {
Text(tr("Log Past Activity"), fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary)
Text(tr("Add a workout you forgot to record"), fontSize = 12.sp, color = PulseColors.textMuted)
}
Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, null, tint = PulseColors.textMuted)
}
}

item { DetectedActivityCard() }

item {
Text(
tr("TODAY"),
Expand Down Expand Up @@ -260,6 +246,9 @@ fun ActivityScreen(
}
}

// Moved from My Health: today's load belongs beside today's activity.
if (state.dayOffset == 0) item { CardioLoadCard(state.workoutsLoaded to state.finishedWorkouts.size) }

item { WeeklyGoalCard(state, days, onTap = { goalsOpen = true }) }
// The blocks behind today's total, each removable (issue #70). Under the summary rather
// than beside it: it answers "why is that number wrong", which is a question you only ask
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/com/pulseloop/ui/screens/MedsUi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
Expand Down Expand Up @@ -72,6 +73,10 @@ fun MedsScreen(onBack: () -> Unit) {
maxLines = 1, overflow = TextOverflow.Ellipsis, textAlign = TextAlign.Center,
modifier = Modifier.align(Alignment.Center).padding(horizontal = 56.dp),
)
// Adding is setup, not the daily job: it sits in the header so today's doses lead.
IconButton(onClick = { adding = true }, modifier = Modifier.align(Alignment.CenterEnd)) {
Icon(Icons.Filled.Add, tr("Add medication or supplement"), tint = PulseColors.textSecondary)
}
}
Column(
Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp),
Expand Down Expand Up @@ -147,7 +152,10 @@ fun MedsScreen(onBack: () -> Unit) {
}
}
}
Button(onClick = { adding = true }, modifier = Modifier.fillMaxWidth()) { Text(tr("Add medication or supplement")) }
// With nothing added yet, adding is the only thing to do here: keep the big button.
if (medsLoaded != null && meds.isEmpty()) {
Button(onClick = { adding = true }, modifier = Modifier.fillMaxWidth()) { Text(tr("Add medication or supplement")) }
}
Text(
tr("A record for you and your doctor. PulseLoop doesn't check interactions or doses; ask your pharmacist."),
fontSize = 11.sp, color = PulseColors.textMuted,
Expand Down
Loading
Loading