diff --git a/README.md b/README.md
index 64dfdfef..1f53a0e5 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# PulseLoop Android
+🇷🇺 [Русская версия README](README.ru.md)
+
> ⚠️ **Disclaimer:** This app is provided as-is and is not a medical application.
> The rings are not medical devices. This app does not replace professional
> healthcare. Always consult your doctor for any medical concerns.
diff --git a/README.ru.md b/README.ru.md
new file mode 100644
index 00000000..7984171e
--- /dev/null
+++ b/README.ru.md
@@ -0,0 +1,114 @@
+# PulseLoop Android
+
+> ⚠️ **Важно:** приложение предоставляется «как есть» и не является медицинским.
+> Кольца — не медицинские устройства. Приложение не заменяет врача: по любым
+> вопросам здоровья обращайтесь к специалисту.
+
+PulseLoop Android — порт [PulseLoop для iOS](https://github.com/saksham2001/PulseLoopiOS):
+приложения-компаньона для недорогих смарт-колец на платформах 56ff/Jring и Colmi/Yawell QRing.
+Приложение работает с кольцом напрямую по Bluetooth, без облака производителя и без аккаунта,
+и добавляет поверх ваших данных ИИ-коуча. Полная документация — в [README на английском](README.md).
+
+
+
+
+
+## Русский язык в приложении
+
+- **Весь интерфейс**: экраны «Сегодня», «Показатели», «Сон», «Активность», «Коуч»,
+ настройки и все их разделы, онбординг, подключение кольца, питание, тренировки, виджеты.
+- **Уведомления**: сводки коуча, низкий заряд кольца, тренировка в реальном времени.
+- **Описания зон и показателей**: нормы пульса, SpO₂, ВСР, давления, глюкозы, температуры,
+ стресса и усталости, а также анализ сна.
+- **ИИ-коуч отвечает по-русски.** Промпты и описания инструментов остались на английском:
+ модели надёжнее работают с ними в оригинале, а часть ответов разбирается по точным
+ английским токенам. К каждому системному промпту добавляется указание писать ответ на
+ языке приложения. Это касается чата, карточек-сводок, уведомлений и ИИ-оценки еды.
+- **Даты и время** выводятся по правилам языка: 24-часовой формат и порядок «11 нояб.».
+- Склонение по числам (`1 шаг`, `3 шага`, `5 шагов`) сделано через plurals.
+
+Остались на английском: экран для разработчиков (Debug), технические заметки автоопределения
+локального LLM-сервера, названия моделей и их описания, а также журналы и экспорт
+диагностики — они нужны для отчётов об ошибках в оригинальном проекте.
+
+## Язык приложения
+
+Язык берётся из системы. Если телефон на русском, приложение тоже будет на русском. В остальных
+случаях оно останется на английском. На Android 13+ язык можно выбрать отдельно для приложения:
+**Настройки Android → Приложения → PulseLoop → Язык**.
+
+## Подключение кольца
+
+1. При первом запуске мастер настройки проведёт через подключение: пролистайте карусель до
+ своей модели и нажмите **«Подключить кольцо»**.
+2. Если мастер уже пройден, откройте **«Настройки»** и нажмите карточку устройства вверху.
+3. Держите кольцо рядом и «разбудите» его (ненадолго снимите с зарядки), затем выберите его
+ в списке найденных.
+4. Кольцо подключится, синхронизирует историю, и показатели начнут заполняться.
+
+### Профиль и калибровка
+
+Кольцам **56ff/Jring** для точной оценки сахара в крови и калорий нужен ваш профиль:
+**возраст, рост, вес и пол**. Их можно указать при первой настройке или в
+**«Настройки → Профиль»**. Данные хранятся **только на телефоне**.
+
+Давление измеряется датчиком напрямую, и профиль для него не нужен. Кольцам **Colmi**
+профиль не нужен вообще: давление и сахар они не поддерживают.
+
+Для 56ff/Jring можно откалибровать давление по тонометру, а сахар — по результату анализа
+или глюкометра: **«Настройки → Калибровка»**. Раздел показывается только для колец, которые
+поддерживают эти показатели.
+
+## Поддержка колец
+
+| Возможность | 56ff / Jring | Colmi QRing |
+|---|---|---|
+| Пульс (разовый замер, в реальном времени, история) | ✅ | ✅ |
+| SpO₂ (разовый замер, история) | ✅ | ✅ |
+| Шаги, расстояние, калории | ✅ | ✅ |
+| Сон (лёгкий, глубокий, бодрствование) | ✅ | ✅ |
+| Сон (REM) | ❌ | ✅ |
+| Давление | ✅ | ❌ |
+| Сахар в крови | ✅ | ❌ |
+| ВСР | ❌ | ✅ |
+| Стресс | ✅ | ✅ |
+| Усталость | ✅ | ✅ |
+| Температура кожи | ❌ | ✅ |
+| Заряд батареи | ✅ | ✅ |
+| Поиск устройства | ✅ | ✅ |
+
+Полный список моделей, особенности протоколов и раздел про диагностику — в
+[README на английском](README.md).
+
+## Известные проблемы
+
+- **«Забыть кольцо» может не до конца очистить стек Bluetooth.** Тогда при следующем поиске
+ кольцо не видно ни PulseLoop, ни другим приложениям. **Помогает перезагрузка телефона.**
+
+## Сборка
+
+```bash
+./gradlew assembleDebug
+```
+
+Минимальная версия: Android 8.0 (SDK 26).
+
+## Как устроен перевод (для разработчиков)
+
+- Строки лежат в `app/src/main/res/values/strings.xml` (английский) и
+ `app/src/main/res/values-ru/strings.xml` (русский).
+- В Composable-функциях используется `stringResource(...)` / `pluralStringResource(...)`.
+- Коду без `Context` (сервисы, построители состояния, движок порогов) строки отдаёт
+ `com.pulseloop.util.L10n`. В приложении он берёт их из ресурсов, а в JVM-юнит-тестах читает
+ английский `values/strings.xml`, поэтому тесты с английскими строками проходят без изменений.
+- Даты форматирует `com.pulseloop.util.LocaleFormats` по шаблонам-«скелетам» Android.
+- Язык ответов ИИ задаёт `com.pulseloop.coach.context.CoachLanguage` по строке `coach_language`
+ из того перевода, который Android реально выбрал. Если для языка телефона перевода нет,
+ интерфейс и коуч остаются на английском.
+
+Чтобы добавить ещё один язык, создайте `values-<код>/strings.xml` (в `coach_language` укажите
+английское название языка, например `German`) и добавьте код в `res/xml/locales_config.xml`.
+
+## Лицензия
+
+См. [README](README.md) и [родительский проект](https://github.com/saksham2001/PulseLoopiOS).
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9cbb15d9..3898b068 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -33,6 +33,9 @@
missing entirely, so every workout start crashed on API 34+. -->
+
+
@@ -75,6 +78,7 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
+ android:localeConfig="@xml/locales_config"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@android:style/Theme.Material.Light.NoActionBar">
@@ -129,7 +133,7 @@
+ English
PulseLoop
@@ -11,4 +15,1248 @@
A Today tile of your choice — activity, sleep, heart rate, and more.
Two Metric Tiles
Two Today tiles side by side, each configurable.
+ No HR samples yet — sync your ring to start your trend.
+ Hourly readings are estimated from heart rate — this ring\'s hourly SpO₂ isn\'t a separate measurement. Spot readings you take are measured.
+ No SpO₂ samples yet — take a reading to start your trend.
+ Systolic
+ Diastolic
+ No blood pressure data yet.
+ Measuring… updates when complete
+ No HRV data yet — HRV builds up over a few hours of wear.
+ No stress data yet — take a measurement.
+ Estimated from HRV — your ring doesn\'t measure stress
+ No fatigue data yet — take a measurement.
+ No blood sugar data yet.
+ No temperature data yet — temperature trends appear after overnight wear.
+ Vitals
+ Live measurements and trends
+ HR
+ SpO₂
+ BP
+ HRV
+ Keep still — measuring heart rate…
+ Keep still — measuring blood oxygen…
+ Keep still — measuring blood pressure, SpO₂, stress, fatigue & blood sugar…
+ Keep still — measuring heart rate & SpO₂…
+ Keep still — measuring %1$s…
+ BP & HRV
+ %1$s %2$ds
+ Measuring… %1$ds
+ Measure
+ The ring disconnected during measurement.
+ The ring isn\'t detecting your finger. Put it on snugly, then try again.
+ Couldn\'t get a steady reading. Keep the ring snug and your hand still, then try again.
+ mmHg
+ Back
+ Previous
+ Next
+ Not enough data for this period.
+ Latest
+ Average
+ Min
+ Max
+ REFERENCE ZONES
+ WHAT THIS MEANS
+ READINGS
+ Hide readings
+ Show readings
+ Estimated
+ Delete this reading
+
+ - Show %1$d more
+ - Show %1$d more
+
+ Delete this reading?
+ %1$s at %2$s.\n\nThis can\'t be undone.
+ The reading stays deleted the next time this day syncs.
+ Delete
+ Cancel
+ Stress
+ Temp
+ heart rate variability
+ stress
+ temperature
+ Estimated from HRV — your ring doesn\'t measure stress. Scored against your own recent HRV readings, so it says how this reading compares with your normal, not how you compare with anyone else.
+ On this ring the same heart rate always comes with the same hourly SpO₂, so a night-time dip here follows a low sleeping heart rate rather than measuring oxygen.
+ Estimated wellness metric — not for dosing or diabetes decisions. No smart ring or watch is FDA-authorized to measure or estimate glucose on its own.
+ Ring blood pressure is an estimate. Calibrate against a validated cuff in Settings → Calibration, and talk to a clinician about persistent high or low readings.
+ Heart rate
+ Blood oxygen
+ Stress
+ Fatigue
+ Skin temperature
+ Blood pressure
+ Blood sugar
+ Resting heart rate reflects how hard your heart works at rest. A typical adult range is 60–100 bpm; fitness, medication, caffeine, and stress all shift it.
+ Blood oxygen (SpO₂) is the percentage of oxygen your blood carries. 95–100% is normal; altitude and lung conditions can lower it.
+ Heart-rate variability is the variation between beats. It\'s highly individual, so we track it against your personal baseline rather than a universal cutoff.
+ Blood pressure is systolic over diastolic (mmHg). The category is the worse of the two. A ring estimate is not a substitute for a cuff.
+ A device wellness score from 0–100 based on heart-rate patterns. Lower is calmer. It\'s an estimate, not a medical stress measure.
+ A device wellness score from 0–100 estimating tiredness. Higher means more fatigue. It\'s a ring estimate, not a clinical scale.
+ An estimated glucose value. No smart ring is cleared to measure glucose, so treat this as a wellness estimate only.
+ Skin temperature from the ring runs cooler than core body temperature. Trends over time matter more than any single reading.
+ Today
+ Week
+ Month
+ AI Coach
+ local server
+ Active — %1$s
+ Server address needed
+ API key needed
+ Disabled
+ Enable AI Coach
+ Notifications are off for PulseLoop. Turn them on in Android Settings to get check-ins.
+ OpenRouter (100+ models)
+ Local / self-hosted (no key needed)
+ Provider
+ Toggle visibility
+ Update Key
+ Save Key
+ Remove
+ Saved ✓
+ %1$s API Key
+ Custom model slug (vendor/model)
+ Privacy routing
+ Only providers that don\'t retain data
+ Route by
+ Balanced (default)
+ Cheapest first
+ Fastest first
+ Lowest latency first
+ Server address
+ Default ports — Ollama 11434 · LM Studio 1234 · llama.cpp 8080 · vLLM 8000 · SGLang 30000. The /v1 path is added for you.
+ Couldn\'t reach the server.
+ Detecting…
+ Detect server & configure
+ Sending three tiny test messages. This can take a minute if the model still has to load.
+ Model
+ Choose a model
+ Model name
+ API key (optional)
+ Only needed if you started the server with --api-key. Leave blank otherwise.
+ Tool calling
+ Lets the coach read your data. Detect sets this for you; turn it off if your server rejects tools (vLLM needs --enable-auto-tool-choice).
+ Response format
+ Max tokens
+ Timeout (s)
+ Leave max tokens blank to let the server decide. Raise the timeout for a large model on CPU — a slow reply is not retried.
+ Stored securely in Android Keystore. Never leaves your device except to call the model. Provider changes apply from your next message.
+ Reasoning effort
+ Default
+ Model decides (default)
+ Image attachments
+ Attach photos to coach messages
+ Web Search
+ Uses additional tokens
+ Google Search grounding may need a paid Gemini plan — free-tier keys can be refused, and the coach then answers without web results.
+ Write Actions
+ Set goals, log, edit data
+ Live Measurements
+ Trigger real-time ring readings
+ Use location & weather
+ Grounds suggestions in your city\'s current weather
+ Coach Memory
+ Hide
+ Show (%1$d)
+ Enable Coach Check-Ins?
+ Get a daily check-in from your coach. You can change this anytime in Coach Check-Ins.
+ Enable
+ Not now
+ Coach Check-Ins
+ AI Coach is off
+ Enable the AI Coach to change these — daily check-ins are written by the coach from your recent trends.
+ Daily check-ins
+ Daily Check-in Notifications
+ Notifications are disabled for PulseLoop in Android Settings.
+ Morning
+ Evening
+ PulseLoop Coach
+ This is a test check-in notification.
+ Send Test Check-in Now
+ Ring battery alerts
+ Get notified when your ring drops below 20% and 10%, so tracking doesn\'t stop mid-day.
+ Low Battery Notifications
+ User Profile
+ Your age, sex, height and weight let the ring compute accurate calories (and, on 56ff/Jring rings, blood sugar). Blood pressure is measured directly by the sensor.
+ Reset units to auto-detect
+ Saved & sent to ring ✓
+ Saved — will sync on next connect
+ Save profile
+ Physiology
+ Optional refinements to how your vitals are interpreted. Leave anything unset and PulseLoop uses sensible defaults.
+ Fitness
+ Treats a low resting heart rate as a sign of fitness rather than a concern, and relaxes the low-HR threshold.
+ Athlete mode
+ Environment
+ Above ~2000 m, normal blood-oxygen readings run lower. We use this to avoid false low-oxygen warnings.
+ Typical altitude (ft)
+ Typical altitude (m)
+ Health context
+ Optional. Both can change what\'s expected for your heart rate or oxygen, so we adjust labels instead of alarming.
+ Beta-blockers
+ Known lung condition
+ Units
+ Glucose unit
+ Save
+ Not set
+ No
+ Yes
+ Calibration
+ Blood pressure calibration
+ Optional. Enter a recent cuff reading so the ring offsets its values to match.
+ Save calibration
+ Blood sugar calibration
+ Optional. The ring estimates glucose from your profile, not a real sensor. Enter a recent lab/meter reading (mg/dL) to offset the displayed value to match.
+ Reading (mg/dL)
+ Enter a valid mg/dL reading
+ Take a blood sugar measurement first, then calibrate
+ Calibrated ✓ (offset %1$s mg/dL)
+ Calibrate
+ Current offset: %1$s mg/dL
+ No calibration set
+ Calibration cleared
+ Reset
+ Goals
+ Daily and weekly targets behind the activity rings.
+ Saved
+ Save goals
+ mg/dL
+ mmol/L
+ bpm
+ Measurement Frequency
+ Measurement
+ How often the ring measures in the background. Shorter heart-rate intervals give finer history at the cost of battery.
+ Pair a ring to configure its all-day measurements.
+ All-day heart rate
+ Every %1$d min
+ Blood oxygen (SpO₂)
+ Same as heart rate, at most every 60 min
+ Measure SpO₂ from the app
+ This ring\'s all-day SpO₂ is estimated from heart rate. When on, PulseLoop starts a real spot measurement on the schedule below, between the ring\'s own readings, about a minute each, which uses more battery. Android may delay or skip runs while the phone is asleep.
+ Every hour
+
+ - Every %1$d hour
+ - Every %1$d hours
+
+ Hide estimated SpO₂
+ Display only real spot measurements on charts and vitals cards, hiding the hourly estimates.
+ Temperature
+ Save measurement settings
+ Sleep trimming
+ A still wrist reads as sleep, so an evening on the sofa can run the night high. Trimmed minutes are never imported — changing these later won\'t bring them back.
+ Track Bedtime / DND mode
+ Keep only sleep inside Android\'s Bedtime or Do Not Disturb.
+ Nights without it use the schedule.
+ Nights without it are kept whole.
+ Sleep quiet hours
+ Daily schedule for nights without Bedtime/DND.
+ Keep only sleep inside a daily schedule. Naps outside it are skipped.
+ From %1$s
+ Until %1$s
+ Permission required
+ To log when Bedtime or Do Not Disturb turns on and off while PulseLoop is in the background, Android requires Notification access. PulseLoop only listens for Mode changes and does not read your notifications.\n\nIf the switch is greyed out, open PulseLoop\'s App info, tap ⋮ → Allow restricted settings, then come back here.
+ Open Settings
+ Quiet from
+ Quiet until
+ Done
+ Not yet
+ Wearable
+ Connected — %1$s · %2$d%%
+ Last seen: %1$s
+ No ring paired
+ Firmware: %1$s
+ Firmware: reading… (connect ring to read)
+ Last synced: %1$s
+ Add a ring
+ Sync now
+ Find ring
+ Disconnect
+ Reconnect last ring
+ Ring management
+ Forget unbinds the ring and removes it from the app so it can be paired elsewhere. The app stays connected automatically the rest of the time.
+ Forget Ring
+ Factory reset erases all data stored on the ring itself and resets it to factory state. Your synced data in the app is kept.
+ Resetting…
+ Factory Reset Ring
+ Factory reset ring?
+ This erases all data stored on the ring and resets it to factory state. We\'ll sync its latest data into the app first, but this can\'t be undone. The ring will need to be re-paired afterward.
+ Syncing latest data…
+ Reset ring
+ Critical
+ Low
+ Good
+ Battery critically low
+ Battery low
+ Battery healthy
+ Unpair ring?
+ Reset app data?
+ Unpair ring & reset app data?
+ Unpair your ring? The ring will forget this phone; your data stays.
+ This permanently erases all your data — metrics, sleep, activity, coach history, settings, and saved API keys — and can\'t be undone.
+ This unpairs your ring, then permanently erases all your data — metrics, sleep, activity, coach history, settings, and saved API keys — and can\'t be undone.
+ Unpair ring
+ Reset app data
+ Unpair & reset
+ Privacy & Data
+ Data Backup
+ Export all your data to a single JSON file for backup, device migration, or external analysis. Import restores everything — replacing all current data.
+ Export PulseLoop Data
+ Export failed
+ Exporting…
+ Export All Data
+ Importing…
+ Import Data
+ App Data
+ Destructive actions: unpair the ring, factory-reset app data, or both.
+ Demo Data
+ Explore the app without a ring. Seeds activity, HR, SpO2, sleep, and a coach conversation.
+ Reseed Demo Data
+ Clear Demo Data
+ Diagnostics
+ Export app, device, and wearable logs as JSON for bug reports.
+ Anonymize export
+ Removes health values, ring serial & MAC addresses. Keeps models, opcodes & errors.
+ OFF — includes full unmasked BLE frames and health values (for protocol debugging only).
+ Export Diagnostics
+ Export Full (Unmasked)
+ Error
+ OK
+ Import Complete
+ Your data has been restored from the backup.
+ Replace all data?
+ This permanently deletes everything currently in the app and replaces it with the contents of this file. This can\'t be undone.
+ Import failed — the file may be corrupt or from a newer version.
+ Delete old data & import
+ Reseed Demo Data?
+ This will replace all existing demo data. Your synced ring data — including sleep history — will not be affected.
+ Reseed
+ Clear Demo Data?
+ Removes all demo measurements, activity, sleep, and the demo device. Synced ring data is not affected.
+ Clear
+ Developer options are already enabled.
+ You are now a developer!
+
+ - You\'re %1$d step away from Developer options.
+ - You\'re %1$d steps away from Developer options.
+
+ About
+ Version
+ An LLM-native health app that turns a cheap Bluetooth smart ring into a real, conversational health tracker. It talks to the ring directly over Bluetooth — no vendor cloud, no account — and layers an AI coach on top of your own data.
+ Source on GitHub
+ License
+ Open-source health tracker. Ported from iOS.\nCC BY 4.0 · Free to share and adapt, including commercially, with appropriate credit.
+ Nutrition
+ Enable Nutrition Tracking
+ Log meals and track calories & macros
+ Daily Goals
+ Calories (kcal)
+ Protein (g)
+ Carbs (g)
+ Fat (g)
+ Balance Macros (30/40/30)
+ Quick Access
+ Open Nutrition Log
+ Strava Not Configured
+ Add stravaClientId and stravaClientSecret to local.properties to enable Strava integration.
+ Strava Integration
+ Connected as %1$s. Workouts sync automatically when finished.
+ Connect your Strava account to automatically upload workouts with GPS routes and heart rate data.
+ Nothing new to upload
+
+ - Uploaded %1$d workout
+ - Uploaded %1$d workouts
+
+ Upload failed: %1$s
+ unknown error
+ Syncing…
+ Disconnected from Strava
+ Authorize in your browser — you\'ll return to PulseLoop automatically.
+ Could not open browser
+ Connect Strava
+ Auto Upload
+ Finished workouts are automatically uploaded to Strava. GPS routes, heart rate data, and sport type are included.
+ No Health Connect permissions granted — nothing to export.
+ Connected. %1$d of %2$d permission types granted.
+ Export ring data to Health Connect so other apps and dashboards can show it. Write-only: PulseLoop never reads data back.
+ Health Connect isn\'t available on this device. Install the Health Connect app to use this feature.
+ Install Health Connect
+ The Health Connect app on this device needs an update before it can be used.
+ Update Health Connect
+ Export PulseLoop data
+ Connected
+ Not connected
+ Open Health Connect
+ Manage or re-grant permissions, and review or delete PulseLoop\'s data, in the Health Connect app.
+ Data Types
+ Exported only when switched on. A row stays dim until its permission is granted.
+ Oxygen saturation (SpO₂)
+ Heart rate variability (HRV)
+ Body temperature
+ Sleep
+ Steps & activity
+ Workouts
+ Blood glucose
+ Respiratory rate
+ VO₂ max
+ Resting heart rate
+ Derived from heart rate by current ring — export disabled
+ Awaiting permission
+ HRV is exported as RMSSD — Health Connect has no SDNN type, and the rings\' metric is vendor-undocumented.
+ Last sync %1$s — %2$s
+ unknown
+ No export has run yet. With the master switch on and a backfill choice made, PulseLoop exports automatically.
+ Remove exported data
+ Delete every record PulseLoop wrote to Health Connect and reset the export to start fresh. Your ring data in PulseLoop is untouched.
+ Deleting needs write permission, and PulseLoop has none right now — re-grant above, or delete the data in the Health Connect app.
+ Removing…
+ Remove PulseLoop data
+ Dismiss
+ How much history should we export?
+ Exporting all history can take a while on the first run.
+ Sync all history
+ Only new data from now on
+ Health Connect permissions revoked
+ PulseLoop no longer has any Health Connect permissions. Reset the export so a later re-grant re-exports your history?
+ Export reset — re-grant permissions to sync again.
+ Reset export
+ Remove PulseLoop data?
+ This deletes every record PulseLoop wrote to Health Connect and resets the export. It cannot be undone, and your ring data in PulseLoop is not affected.
+ Not enough of a trend to estimate runtime yet — it appears after a few hours of discharge.
+ About %1$s left
+ Estimated from the current discharge at %1$s %%/h.
+ Battery history
+ Not enough data yet — battery history builds up as the ring reports its level.
+ Off
+ On
+ Offline
+ Local
+ Backend proxy
+ Settings
+ General
+ Metrics
+ Resources
+ Developer
+ About PulseLoop
+ Want a recap?
+ Want a summary from the latest ring context? Tap to open the coach.
+ STEPS
+ CAL
+ Estimated from heart rate
+ No reading
+ SYS
+ DIA
+ Waiting for first sync
+ Sync your ring to start collecting movement, heart rate, blood oxygen, and recovery context.
+ Baseline pending
+ HR pending
+ HR collected
+ Sleep pending
+ Sleep synced
+ Building momentum
+ Take it easy
+ Steady build
+ %1$d bpm
+
+ - You\'re at %1$,d step. Sync after waking to add recovery context.
+ - You\'re at %1$,d steps. Sync after waking to add recovery context.
+
+
+ - You\'re at %1$,d step, %2$dh %3$02dm of sleep, and your latest reading is %4$s.
+ - You\'re at %1$,d steps, %2$dh %3$02dm of sleep, and your latest reading is %4$s.
+
+ Steps %1$s%%
+ Steps collected
+ Stages
+ Sleep architecture
+ No sleep recorded
+ Wear your ring overnight to see your hypnogram here.
+ Sleep insights
+ Last Sleep
+ %1$s to %2$s
+ %1$d of %2$d · %3$s–%4$s
+
+ - Tracked %1$d night this year
+ - Tracked %1$d nights this year
+
+ %1$d of %2$d nights tracked
+ Duration
+ Monthly average
+ Nightly sleep
+ Day
+ Year
+ Deep
+ Light
+ REM
+ Awake
+ Added by you
+ Added by you · asleep, no stage measured
+ Avg Deep
+ Avg Light
+ Avg Awake
+ No nights tracked in this range yet.
+ Previous day
+ Next day
+ Yesterday
+ Excellent
+ Good
+ Fair
+ Needs work
+ Records
+ The ring recorded this as one record
+
+ - The ring recorded this night in %1$d part
+ - The ring recorded this night in %1$d parts
+
+ Asleep %1$s
+ Includes %1$s added by you, not staged or scored
+ Edit this record\'s times
+ Delete this record
+ Awake %1$s between
+ Couldn\'t update this record
+ Delete this record?
+ %1$s – %2$s leaves tonight\'s totals and the hypnogram, and it won\'t come back on re-sync.
+ Couldn\'t delete this record
+ Keep
+ Edit sleep record
+ Trim this record, or extend it over time the ring missed. Added time counts as asleep but has no stage, so it stays out of the stage breakdown and score.
+ Start: %1$s
+ End: %1$s
+ Start time must be before end time.
+ Adjust start time
+ Adjust end time
+ The previous record ends at %1$s.
+ The next record starts at %1$s.
+
+ - A record can be extended by up to %1$d hour, so it can start at %2$s at the earliest.
+ - A record can be extended by up to %1$d hours, so it can start at %2$s at the earliest.
+
+
+ - A record can be extended by up to %1$d hour, so it can end at %2$s at the latest.
+ - A record can be extended by up to %1$d hours, so it can end at %2$s at the latest.
+
+ Starting past %1$s would move it into another night.
+ Ending past %1$s would move it into another night.
+ Keep at least a minute of what the ring recorded (%1$s – %2$s).
+ %1$dm
+ %1$dh %2$02dm
+ Weekly Sleep
+ Monthly Sleep
+ Yearly Sleep
+ + Record Activity
+ Workout history
+ Log Past Activity
+ Add a workout you forgot to record
+ TODAY
+ YESTERDAY
+ No workouts recorded today
+ Start one manually when your ring misses an activity.
+ Steps
+ Distance
+ Calories
+ cal
+ %1$d bpm avg
+ MIN
+ WEEKLY GOAL
+ %1$d of 7 active days
+ TAP TO EDIT GOALS
+ Record activity
+ Track GPS route
+ Start
+ No workouts yet — recorded workouts will appear here.
+ Edit goals
+ Active minutes
+ %1$d min
+ %1$s h
+ Workouts / week
+ RECORDS
+ Hide activity records
+ Show activity records
+ Loading…
+ No activity records synced for %1$s yet.
+
+ - %1$s step
+ - %1$s steps
+
+ Delete this activity record
+ Delete this activity record?
+ %1$s at %2$s.\n\nThe day\'s total drops by that much. This can\'t be undone, and the record stays deleted the next time this day syncs.
+ Step %1$d of %2$d
+ Skip
+ No subscription
+ Own your ring data
+ Privacy first
+ Data stays on device
+ AI health coach
+ Learns your baseline
+ See your vitals
+ HR, SpO₂, HRV & stress
+ Sleep tracking
+ Stages and trends
+ Activity recording
+ Live workout tracking
+ Get started
+ Explore without ring
+ Set up PulseLoop
+ Your health, on your terms — no subscription, no cloud.
+ Continue
+ Profile
+ Used to tune calories, activity goals, and summaries.
+ Daily goals
+ Start with recommended targets. You can change these anytime.
+ Activity and live vitals, right away
+ First sync
+ Sleep stages and nightly trends
+ Days 3–7
+ Your personalized baseline unlocks
+ Start using PulseLoop
+ You\'re all set
+ Wear your ring today. Your baseline builds from here.
+ PulseLoop learns your baseline over time
+ Wear your ring during the day and sync after sleep. Trends become more personal after a few days.
+ Setup complete
+ Measurement units
+ Metric
+ Imperial
+ Identity
+ Name
+ Optional
+ Sex
+ Female
+ Male
+ Other
+ Body metrics
+ Age
+
+ - %1$d year
+ - %1$d years
+
+ Height
+ Weight
+ %1$d cm
+ kg
+ lb
+ Enter your weight in %1$s
+ You can use either a comma or a period as the decimal separator.
+ Enter a weight between %1$d and %2$d %3$s.
+ km
+ mi
+ Daily targets
+ %1$d cal
+ Weekly target
+ %1$d / week
+ All
+ Add your ring
+ Swipe to find your model, then tap to connect.\nYou can also explore first and pair later.
+ Hide connection details
+ Show connection details
+ Waiting for BLE connection events…
+ Connect ring
+ Skip for now
+ You can pair a ring later from Settings.
+ Connecting to %1$s…
+ Scanning for %1$s…
+ No rings found yet
+ Wake the ring by tapping or moving it, and keep it close.
+ Stop scanning
+ Connected to %1$s
+ Bluetooth is off
+ Turn on Bluetooth to find and connect your ring.
+ Delete workout?
+ This removes the session and its recorded route. This can\'t be undone.
+ End time can\'t be in the future.
+ The window must be longer than the %1$d min of pauses in this workout.
+ End must be after the start.
+ Edit workout
+ Activity
+ Starts
+ Ends
+ Distance, calories, and heart-rate stats are recalculated for the new window.
+ Save changes
+ Time
+ PACE %1$s
+ SPEED
+ CALORIES
+ DURATION
+ ACTIVE MIN
+ Avg HR
+ Max HR
+ Min HR
+ SPLITS
+ Workout not found
+ This workout is no longer in local storage. It may have been deleted or replaced.
+ AI meal log
+ Remove photo
+ Camera
+ Library
+ OR DESCRIBE IT
+ ADD DETAIL (OPTIONAL)
+ e.g. two eggs, toast with butter, black coffee
+ Analyze
+ Sent to your configured AI provider only when you tap Analyze. Estimates are labeled and editable.
+ Estimating nutrition…
+ AI estimate
+ Low confidence
+ Medium confidence
+ Review & adjust
+ Log meal
+ Re-analyze
+ Try again
+ Breakfast
+ Lunch
+ Dinner
+ Snack
+ AI analysis needs the coach enabled with a configured provider (Settings → AI Coach). You can still search the database or enter the meal manually.
+ Couldn\'t process that photo. Try again or describe the meal.
+ The AI didn\'t return a usable estimate. Try again or enter the meal manually.
+ Analysis failed: %1$s
+ %1$d kcal
+ of %1$d
+ Protein
+ Carbs
+ Fat
+ %1$d kcal · P%2$d C%3$d F%4$d
+ Photo
+ Describe
+ Log Meal
+ %1$dg
+ Product not found for that barcode. Enter it manually instead.
+ Couldn\'t look up that barcode. Check your connection or enter the meal manually.
+ Scan barcode
+ kcal
+ P(g)
+ C(g)
+ F(g)
+ Coach is thinking…
+ Error: %1$s
+ Using your latest ring sync
+ Usage & cost
+ Past conversations
+ New chat
+ Attached photo
+ How am I doing today?
+ Explain my heart rate trend
+ Summarize my week
+ How can I sleep better?
+ Staged photo
+ Attach photo
+ Ask the coach...
+ Send
+ No conversations yet. Ask the coach something and it will show up here.
+ Swipe a conversation to delete it.
+ Delete all conversations
+ Delete this conversation?
+ “%1$s” and its replies will be deleted. This can\'t be undone.
+ Delete all conversations?
+
+ - All %1$d conversation and its replies will be deleted. This can\'t be undone.
+ - All %1$d conversations and their replies will be deleted. This can\'t be undone.
+
+ Delete all
+ Untitled conversation
+
+ - %1$d message
+ - %1$d messages
+
+ open now
+ Today %1$s
+ Yesterday %1$s
+ Activity
+ Coach
+ Workout
+ PULSELOOP
+ Connected · %1$d%%
+ Connecting…
+ Reconnecting…
+ Sync failed
+ Disconnected
+ Good morning
+ Good afternoon
+ Good evening
+ Good night
+ Walking
+ Running
+ Cycling
+ Gym
+ Squash
+ Sport
+ Yoga
+ Dance
+ Hiking
+ Casual or brisk walking
+ Outdoor or treadmill runs
+ Road, trail, or stationary
+ Strength or circuit training
+ Court sessions
+ Team or racket sports
+ Flow, stretch, or breathwork
+ Studio, cardio, or freestyle
+ Trails and elevation
+ Anything else
+ /mi
+ /km
+ MPH
+ KM/H
+ Connect
+ Set up a ring
+ No ring connected
+ Searching…
+ Connection failed
+ Synced %1$s
+ just now
+ %1$dm ago
+ %1$dh ago
+ %1$dd ago
+ Glucose
+ Hide %1$s
+ Move %1$s up
+ Move %1$s down
+ HIDDEN
+ Show %1$s
+ Customize
+ Reorder or hide cards
+ %1$d%% above baseline
+ %1$d%% below baseline
+ Athletic
+ Low (medication)
+ Low
+ Normal
+ Elevated
+ High
+ Very low
+ Slightly low
+ Building baseline
+ Below baseline
+ Slightly below
+ Near baseline
+ Above baseline
+ Calm
+ Fresh
+ Mild
+ Tired
+ High fatigue
+ Stage 1
+ Stage 2
+ Severe
+ Typical
+ Very high
+ Cool
+ Warm
+ Estimated · calibrate with a cuff
+ Estimated — not for dosing or diagnosis
+ At baseline
+ A low resting heart rate is common with high fitness.
+ Beta-blockers lower heart rate; this is expected on that medication.
+ Below the typical resting range. Often fine, but worth noting if you feel faint.
+ Athletic resting range.
+ A typical resting heart rate for adults.
+ Above the typical resting range. Activity, caffeine, or stress can raise it.
+ A high resting heart rate. Talk to a clinician if it persists at rest.
+ Expected values are lower at altitude.
+ An urgently low oxygen reading. Seek care if you also feel unwell.
+ Low blood oxygen. Re-measure when still; talk to a clinician if persistent.
+ Slightly below the typical range.
+ A normal blood-oxygen level is 95–100%.
+ HRV is personal. Wear your ring for about a week to learn your baseline.
+ Notably below your typical HRV — often linked to stress, poor sleep, or strain.
+ A little below your usual range.
+ Around your personal baseline.
+ Above your typical HRV — often a sign of good recovery.
+ Low stress score — relaxed.
+ A typical daytime stress score.
+ Elevated stress — consider a short break.
+ High stress score. Wellness estimate, not a diagnosis.
+ Low fatigue — well recovered.
+ Mild fatigue.
+ Tired — consider lighter activity and good sleep.
+ High fatigue score. Wellness estimate from the ring.
+ Low systolic pressure (below 90).
+ Normal blood pressure is below 120/80.
+ Elevated systolic (120–129).
+ Stage 1 hypertension range (systolic 130–139).
+ Stage 2 hypertension range (systolic ≥140).
+ Severe range (systolic >180). Seek care if confirmed.
+ Low diastolic pressure (below 60).
+ Normal diastolic is below 80.
+ Stage 1 hypertension range (diastolic 80–89).
+ Stage 2 hypertension range (diastolic ≥90).
+ Severe range (diastolic >120). Seek care if confirmed.
+ Below 70 mg/dL is low.
+ Fasting normal is up to 99 mg/dL.
+ Fasting 100–125 is above the typical range.
+ Fasting ≥126. Talk to a clinician if confirmed by a meter.
+ Two-hour post-meal normal is up to 140 mg/dL.
+ Two-hour 140–199 is above the typical range.
+ Two-hour ≥200. Confirm with a meter and a clinician.
+ Within a typical range for a non-fasting reading.
+ Above the typical range. Context (meals) affects this.
+ A high reading regardless of context. Confirm with a meter.
+ Cooler than typical skin temperature.
+ A typical skin-temperature range from the ring.
+ Warmer than typical. Trends matter more than a single reading.
+ ms
+ vs baseline
+ vs earlier
+ vs previous
+ Stable %1$s
+ Resting %1$d
+ Resting calibrating
+ Peak %1$d
+ Peak —
+ bpm range
+ Lowest %1$d · %2$s
+
+ - %1$d reading
+ - %1$d readings
+
+ % avg
+ Baseline %1$d ms
+ Lower is calmer
+ Ring model estimate
+ No data
+ No estimate
+ Estimated wellness metric
+ Updated just now
+ Updated %1$s
+ What did you do?
+ Choose an activity, when it started, and how long it lasted.
+ Activity type
+ When
+ Started
+ The workout must finish before now.
+ Log Activity
+ %1$d hr
+ %1$d hr %2$d min
+ Speed
+ Pace
+ PAUSED
+ -- bpm
+ %1$s m
+ Resume
+ Pause
+ Finish
+ Measurement
+ Keep your hand still and rest your wrist on a flat surface.
+ Breathe normally. Keep the sensor pressed firmly to your skin.
+ Stay still during the measurement.
+ MEASURING
+ Couldn\'t get a reading. Make sure the ring is snug and worn on your finger, then try again.
+ Close
+ READY
+ Measuring SpO₂… keep your hand still.
+ Measuring… stay still.
+ Reading saved.
+ Recommended
+ All models from %1$s (%2$d)
+ Filter, e.g. claude
+ retiring %1$s
+ %1$d more — type to narrow
+ Save your key to see every model %1$s offers.
+ Loading models from %1$s…
+ %1$d models available from %2$s
+ Retry
+ Refresh
+ %1$s doesn\'t list “%2$s” any more — it may have been retired. Pick another model.
+ %1$s is retiring this model on %2$s.
+ Models
+ Input tokens
+ Output tokens
+ Estimated cost
+ Cost estimates aren\'t available for on-device or custom models.
+ Per-message breakdown
+ Show
+ %1$d in · %2$d out
+ (no text)
+ Scanning unavailable
+ Barcode scanning needs a device camera and camera access. Search by name instead.
+ lbs
+ %1$s cm
+ No data yet today
+ Open PulseLoop to sync
+ SCORE
+ Choose Metrics
+ Choose Metric
+ Pick the left and right PulseLoop metrics.
+ Pick which PulseLoop metric this widget shows.
+ LEFT METRIC
+ RIGHT METRIC
+ Add Widget
+ Ring Battery
+ Alerts when your ring\'s battery runs low
+ Ring battery low
+ Your ring is at %1$d%%. Charge it soon so tracking doesn\'t stop.
+ Ring battery critically low
+ Your ring is at %1$d%% and will shut down soon. Charge it now.
+ Coach Check-ins
+ Daily AI-generated health insights based on your ring data
+ Reset zoom
+ No route yet
+ Move outdoors to start tracking your route.
+ ±%1$dm · %2$d pts
+ %1$d pts
+ Opens ring settings
+ Hi! I\'m your PulseLoop coach. I can answer questions about your sleep, heart rate, activity, and recovery. What would you like to know?
+ Sorry, something went wrong: %1$s
+ Update available — %1$s
+ Downloading… %1$d%%
+ Download failed. Please try again.
+ Downloading…
+ Update
+ Later
+ Self-update is available in the release build only (current: %1$s / %2$s).
+ Couldn\'t check for updates (%1$s). Please try again.
+ You\'re on the latest version (%1$s).
+ Checking…
+ Check for updates
+ Good duration
+ Deep sleep balanced
+ Deep sleep strong
+ Awake time low
+ Looks like a strong night after a more active day. Your duration was solid and deep sleep made up a healthy part of the night, which kept the score high.
+ Your sleep duration and stage balance were strong. Deep sleep looked supportive, which helped keep the overall score high.
+ Strong recovery signal
+ Good sleep, with some restlessness
+ You slept long enough, but awake time was a bit elevated. If this repeats, look at late caffeine, alcohol, temperature, or stress near bedtime.
+ Awake time elevated
+ Duration held the score back
+ The stage mix was useful, but total sleep time was short for a full recovery window. A slightly earlier wind-down would likely improve tomorrow\'s score.
+ Short duration
+ Solid night overall
+ Your sleep was in a workable range, with the score shaped mostly by duration and stage balance. Deep and light sleep were readable enough to give a useful recovery snapshot.
+ No sleep tracked last night
+ 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.
+ Not enough week data yet
+ Not enough month data yet
+ Not enough year data yet
+
+ - I only have %1$d tracked night for this week. Wear the ring overnight for a few more nights and I\'ll build a reliable weekly picture.
+ - I only have %1$d tracked nights for this week. Wear the ring overnight for a few more nights and I\'ll build a reliable weekly picture.
+
+
+ - I only have %1$d tracked night for this month. Wear the ring overnight for a few more nights and I\'ll build a reliable monthly picture.
+ - I only have %1$d tracked nights for this month. Wear the ring overnight for a few more nights and I\'ll build a reliable monthly picture.
+
+
+ - I only have %1$d tracked night for this year. Wear the ring overnight for a few more nights and I\'ll build a reliable yearly picture.
+ - I only have %1$d tracked nights for this year. Wear the ring overnight for a few more nights and I\'ll build a reliable yearly picture.
+
+
+ - You averaged %1$s across %2$d tracked night this week. That\'s a useful read, but %3$s mean the trend is still incomplete.
+ - You averaged %1$s across %2$d tracked nights this week. That\'s a useful read, but %3$s mean the trend is still incomplete.
+
+
+ - %1$d missing night
+ - %1$d missing nights
+
+ You averaged %1$s across the full week. Your nights were tracked consistently, so this is a dependable picture of where your sleep sits right now.
+ Your week at a glance
+ Your monthly average is %1$s, but coverage is low (%2$s), so I\'d treat that number cautiously. More nights tracked will sharpen the trend.
+ Your monthly average is %1$s across %2$s. The biggest lever is consistency — a few short nights move this number more than any single great one.
+ Your month in sleep
+ Your long-term sleep trend
+
+ - Across the year your tracked average is %1$s over %2$d night. The long-term trend is still forming — as more months fill in, I\'ll be able to compare seasonal changes and consistency.
+ - Across the year your tracked average is %1$s over %2$d nights. The long-term trend is still forming — as more months fill in, I\'ll be able to compare seasonal changes and consistency.
+
+ %1$d of %2$d tracked
+ On target
+ Below goal
+ Above goal
+ Consistent
+ Variable nights
+ No sleep captured last night
+ Wear your ring overnight so PulseLoop can track your next night.
+ Not enough weekly data
+ Wear your ring overnight for a few nights to build a weekly view.
+ Not enough monthly data
+ Track more nights this month to see a monthly average.
+ Not enough yearly data
+ Long-term insights appear as more nights are tracked.
+ Coach error · %1$s\n%2$s
+ No API key
+ No API key is configured for the selected provider. Add one in Settings → AI Coach.
+ Network
+ Response error
+ No output
+ The model returned an empty response. Try again, or pick a different model.
+ Something went wrong.
+ Couldn\'t look up %1$s. Your device can\'t resolve it right now — check your connection, and whether a VPN or a Private DNS setting is blocking it. (%2$s)
+ the provider
+ The provider took too long to answer. Check your connection and try again — a VPN or a weak signal will do this. (%1$s)
+ The secure connection to the provider failed. This is usually a VPN, a proxy, or a network that intercepts traffic. (%1$s)
+ Couldn\'t connect to the provider. (%1$s)
+ The network request failed.
+ The provider returned HTTP %1$d with no details.
+ I had trouble with that
+ I checked your data but couldn\'t finish preparing the answer. Try asking again, or narrow the question.
+ No changes were made.
+ What data is missing?
+ Steps today: %1$d
+
+ - 7-day average: %1$d step/day
+ - 7-day average: %1$d steps/day
+
+ No activity synced yet
+ I don\'t have today\'s activity from the ring yet. Sync the ring or take a measurement and I\'ll summarize what comes in. (The AI coach is off — add an OpenAI key in Settings to enable full coaching.)
+ Is my ring connected?
+ Here\'s where you are today
+
+ - You\'re at %1$d step so far today. The AI coach is off — add an OpenAI key in Settings for trends and tailored guidance.
+ - You\'re at %1$d steps so far today. The AI coach is off — add an OpenAI key in Settings for trends and tailored guidance.
+
+ How does today compare to yesterday?
+ What\'s my heart rate trend?
+ Parse Error
+ I had trouble formatting my response. Please try again.
+ Summarize my day
+ What\'s new?
+ paused
+ recording
+ %1$s complete
+ Workout Live
+ Live workout tracking
+ Could not reach Health Connect. Try again.
+ Removed PulseLoop data, but %1$d type(s) could not be deleted — try again.
+ Nothing to remove: PulseLoop has no write permissions left, so it can\'t delete what it wrote. Delete it in the Health Connect app, or re-grant and try again.
+ Removed PulseLoop data from Health Connect.
+ Could not remove PulseLoop data. Try again.
+ Resetting ring…
+ Bluetooth is not powered on
+ Ring no longer available; scan again.
+ Ring not found in scans. It may be held by a stale Bluetooth connection — try toggling Bluetooth off and on.
+ Scan failed: %1$d
+ Good morning! Sync your ring and check your vitals to start the day.
+ Good morning%1$s
+ You logged %1$dh %2$dm of sleep. Here\'s to a strong day — get moving when you can.
+ Ready to start the day? Take a measurement and I\'ll help you plan it.
+
+ - You hit your %1$d step goal — nice work.
+ - You hit your %1$d step goal — nice work.
+
+
+ - %1$d step to your goal.
+ - %1$d steps to your goal.
+
+ Evening check-in
+
+ - %1$d step today. %2$s Time to start winding down.
+ - %1$d steps today. %2$s Time to start winding down.
+
+ How did today feel? Sync your ring and I\'ll recap your day.
+ Enter your server\'s address, e.g. http://192.168.1.50:11434
+ That doesn\'t look like a URL — use host:port or http://host:port
+ Only http:// and https:// are supported.
+ Plain http:// is only allowed for a server on this device or your local network (an IP address, a plain hostname, or a .local / .lan / .ts.net name). Use https:// to reach one over the internet.
+ Not connected to Strava.
+ Strava rate limit reached. Try again later.
+ Already on Strava.
+ Strava upload failed (HTTP %1$d): %2$s
+ Unexpected response from Strava.
+ Timed out waiting for Strava to process the upload.
+ Strava could not process the upload: %1$s
+ Strava rejected the activity (HTTP %1$d): %2$s
+ exported %1$s
+ skipped: %1$s
+ nothing new to export
+ Ring
+ Today recap
+ Sleep recap
+ Sleep trend
+ That workout no longer exists.
+ Deleted the %1$s session.
+ Updated the %1$s session.
+ That meal no longer exists.
+ Deleted “%1$s”.
+ Updated “%1$s”.
+ Bad response
+
+ - The model didn\'t return a valid structured answer after %1$d attempt.
+ - The model didn\'t return a valid structured answer after %1$d attempts.
+
+ It replied: “%1$s…”
+
+ Analyzing your trends
+ Checking ring connection
+ Checking the food database
+ Checking what data exists
+ Checking your goals
+ Checking your profile and ring status
+ Comparing two time periods
+ Computing correlation
+ Detecting outliers
+ Fetching your ring data for that range
+ Fetching your trend data
+ Logging your activity
+ Logging your meal
+ Logging your session
+ Looking at your sleep
+ Looking up your workouts
+ Noting that down
+ Preparing a chart
+ Reading that day\'s ring data
+ Reading your food log
+ Removing that meal
+ Removing that workout
+ Reviewing your sleep
+ Saving this for later
+ Scanning for anything unusual
+ Setting your goal
+ Summarizing distribution
+ Summarizing that workout
+ Taking a live reading
+ Updating that meal
+ Updating that workout
+ Health Connect isn\'t available right now. Try again.
+ Today\'s snapshot
+
+ - %1$d step so far today. Your ring is tracking — sync for the latest readings.
+ - %1$d steps so far today. Your ring is tracking — sync for the latest readings.
+
+ I don\'t have today\'s activity yet. Wear your ring and sync for a daily recap.
+ Step Source
+ Data Source
+ Phone
+ Ring
+ Health Connect needs an update before phone steps can be used.
+ Health Connect isn\'t available on this device.
+ Update your %1$s session from %2$s?
+ Delete your %1$s session from %2$s? This can\'t be undone.
+ Update “%1$s” from %2$s?
+ Delete “%1$s” (%2$d kcal) from %3$s?
+ Strava authorization was declined.
+ Strava denied authorization: %1$s
+ Strava authorization could not be verified. Please try connecting again.
+ Strava did not grant upload permission. Reconnect and keep \"Upload your activities\" checked.
+ Strava returned an unexpected authorization response.
+ Could not complete the Strava sign-in: %1$s
+ unknown error
+
+ HR
+ bpm
+ SpO2
+ sleep
+ step
+ %1$s vs %2$s
+ No data to plot for this range.
+ Bluetooth off
+ Phone Bluetooth is off
+ Phone Bluetooth is off — turn it on to reconnect
+ BLE permissions not granted
+ GATT connect failed: %1$d
+ Ring command write failed (GATT %1$d)
+ Ring disconnected (GATT %1$d)
+ Your ring\'s clock seems to have stopped
+ It still connects, but it isn\'t recording heart rate or sleep on its own. Restarting the ring fixes this, and nothing stored on it is lost.
+ It still connects, but it isn\'t recording heart rate or sleep on its own. Turn it off and on again from the ring\'s own app or its charger.
+ Restart ring
+ Restart your ring
+ PulseLoop will turn your ring off. You\'ll then put it on its charger to turn it back on, and PulseLoop will reconnect and set its time.
+ Turn off ring
+ Put your ring on its charger
+ Your ring is turning off. Put it on its charger to turn it back on — it stays off until you do.\n\nOnce it\'s back on, PulseLoop reconnects and sets the time by itself. If the clock still doesn\'t run, this warning will come back.
+ Ring not connected
+ PulseLoop needs to be connected to your ring to turn it off. Wait for it to connect and try again.
+ Can\'t turn this ring off
+ This ring can\'t be turned off from PulseLoop. Restart it from its own app or its charger.
diff --git a/app/src/main/res/xml/locales_config.xml b/app/src/main/res/xml/locales_config.xml
new file mode 100644
index 00000000..96eacbc6
--- /dev/null
+++ b/app/src/main/res/xml/locales_config.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/app/src/test/java/com/pulseloop/coach/CoachSleepSyncGateTest.kt b/app/src/test/java/com/pulseloop/coach/CoachSleepSyncGateTest.kt
index 21533492..9b93b576 100644
--- a/app/src/test/java/com/pulseloop/coach/CoachSleepSyncGateTest.kt
+++ b/app/src/test/java/com/pulseloop/coach/CoachSleepSyncGateTest.kt
@@ -78,4 +78,58 @@ class CoachSleepSyncGateTest {
val fullSync = end + 5 * 60_000L
assertFalse(CoachSleepSyncGate.sleepDaySafeToSummarize(end, fullSync, now = end + 10 * 60_000L))
}
+
+ // ── #140: partial-night cards ───────────────────────────────────────────
+
+ /** Nov 9: first record ended 00:07, sync at 02:04 — Bedtime still on, so no card yet. */
+ @Test
+ fun testOpenBedtimeWindowDefersCard() {
+ val end = 10 * hour
+ val fullSync = end + 2 * hour
+ assertFalse(CoachSleepSyncGate.sleepDaySafeToSummarize(end, fullSync, end + 2 * hour, nightInProgress = true))
+ assertTrue(CoachSleepSyncGate.sleepDaySafeToSummarize(end, fullSync, end + 2 * hour, nightInProgress = false))
+ }
+
+ @Test
+ fun testOpenBedtimeWindowDefersAtMostTheCap() {
+ val end = 10 * hour
+ val now = end + CoachSleepSyncGate.NIGHT_IN_PROGRESS_CAP_MS
+ assertTrue(CoachSleepSyncGate.sleepDaySafeToSummarize(end, now, now, nightInProgress = true))
+ }
+
+ @Test
+ fun testGrownNightRewritesInsideFloor() {
+ val floor = 2 * hour
+ // 63 asleep minutes at 02:04, 530 after the morning sync 30 min later.
+ assertTrue(CoachSleepSyncGate.sleepCardRewriteDue("63|10|50|3|40", 0L, "530|90|380|12|75", 30 * 60_000L, floor))
+ }
+
+ @Test
+ fun testShrunkOrSameLengthNightWaitsForFloor() {
+ val floor = 2 * hour
+ assertFalse(CoachSleepSyncGate.sleepCardRewriteDue("530|90|380|12|75", 0L, "520|90|370|12|75", hour, floor))
+ assertFalse(CoachSleepSyncGate.sleepCardRewriteDue("530|90|380|12|75", 0L, "530|95|375|12|75", hour, floor))
+ assertTrue(CoachSleepSyncGate.sleepCardRewriteDue("530|90|380|12|75", 0L, "520|90|370|12|75", floor, floor))
+ }
+
+ @Test
+ fun testUnchangedSignatureNeverRewrites() {
+ assertFalse(CoachSleepSyncGate.sleepCardRewriteDue("530|1", 0L, "530|1", 10 * hour, 2 * hour))
+ }
+
+ @Test
+ fun testSmallGrowthWaitsForFloor() {
+ val floor = 2 * hour
+ // A re-sync rounding difference or one more 15-minute packet doesn't skip the floor.
+ assertFalse(CoachSleepSyncGate.sleepCardRewriteDue("530|1", 0L, "531|1", hour, floor))
+ assertFalse(CoachSleepSyncGate.sleepCardRewriteDue("530|1", 0L, "544|1", hour, floor))
+ assertTrue(CoachSleepSyncGate.sleepCardRewriteDue("530|1", 0L, "545|1", hour, floor))
+ }
+
+ @Test
+ fun testLanguageChangeRewritesInsideFloor() {
+ val floor = 2 * hour
+ assertTrue(CoachSleepSyncGate.sleepCardRewriteDue("420|82", 0L, "420|82|lang=Russian", 60_000L, floor))
+ assertTrue(CoachSleepSyncGate.sleepCardRewriteDue("420|82|lang=Russian", 0L, "420|82", 60_000L, floor))
+ }
}
diff --git a/app/src/test/java/com/pulseloop/coach/schema/CoachChartColorTest.kt b/app/src/test/java/com/pulseloop/coach/schema/CoachChartColorTest.kt
new file mode 100644
index 00000000..80ad9c4c
--- /dev/null
+++ b/app/src/test/java/com/pulseloop/coach/schema/CoachChartColorTest.kt
@@ -0,0 +1,37 @@
+package com.pulseloop.coach.schema
+
+import androidx.compose.ui.graphics.Color
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+class CoachChartColorTest {
+ private val russian = arrayOf("пульс,ЧСС,сердц", "уд/мин", "кислород,сатурац", "сон,сна,сну,сном", "шаг")
+
+ private fun color(title: String, y: String = "", words: Array = emptyArray()): Color? {
+ val chart = CoachChart(title = title, yLabel = y)
+ return if (words.isEmpty()) chartColor(chart)
+ else chartColor(chart, words[0], words[1], words[2], words[3], words[4])
+ }
+
+ @Test fun englishKeywordsKeepTheirColours() {
+ assertEquals(Color(0xFFE53935), color("Resting HR"))
+ assertEquals(Color(0xFFE53935), color("Week", y = "bpm"))
+ assertEquals(Color(0xFF1E88E5), color("SpO2 trend"))
+ assertEquals(Color(0xFF7E57C2), color("Sleep this week"))
+ assertEquals(Color(0xFF4CAF50), color("Daily steps"))
+ assertNull(color("Calories"))
+ }
+
+ @Test fun translatedTitlesAreMatchedThroughTheResourceWords() {
+ assertEquals(Color(0xFFE53935), color("Пульс в покое", words = russian))
+ assertEquals(Color(0xFFE53935), color("Неделя", y = "уд/мин", words = russian))
+ assertEquals(Color(0xFF7E57C2), color("Длительность сна", words = russian))
+ assertEquals(Color(0xFF4CAF50), color("Шаги за неделю", words = russian))
+ assertNull(color("Калории", words = russian))
+ }
+
+ @Test fun englishWordsStillMatchUnderATranslation() {
+ assertEquals(Color(0xFFE53935), color("HR за неделю", words = russian))
+ }
+}
diff --git a/app/src/test/java/com/pulseloop/coach/summaries/SummaryLanguageSignatureTest.kt b/app/src/test/java/com/pulseloop/coach/summaries/SummaryLanguageSignatureTest.kt
new file mode 100644
index 00000000..db455ebc
--- /dev/null
+++ b/app/src/test/java/com/pulseloop/coach/summaries/SummaryLanguageSignatureTest.kt
@@ -0,0 +1,21 @@
+package com.pulseloop.coach.summaries
+
+import com.pulseloop.coach.context.CoachLanguage
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+class SummaryLanguageSignatureTest {
+ @Test fun englishAddsNothingToTheSignature() {
+ // JVM tests resolve the default (English) strings.xml.
+ assertNull(CoachLanguage.languageName())
+ assertEquals("", CoachLanguage.directive())
+ assertEquals("", CoachSummaryContextBuilder.languageSuffix(null))
+ }
+
+ @Test fun languageRoundTripsThroughTheSignature() {
+ val sig = "1200|·|30" + CoachSummaryContextBuilder.languageSuffix("Russian")
+ assertEquals("Russian", CoachSummaryContextBuilder.languageOf(sig))
+ assertEquals("", CoachSummaryContextBuilder.languageOf("1200|·|30"))
+ }
+}
diff --git a/app/src/test/java/com/pulseloop/service/RingClockStallTest.kt b/app/src/test/java/com/pulseloop/service/RingClockStallTest.kt
new file mode 100644
index 00000000..a6266beb
--- /dev/null
+++ b/app/src/test/java/com/pulseloop/service/RingClockStallTest.kt
@@ -0,0 +1,121 @@
+package com.pulseloop.service
+
+import com.pulseloop.ring.YCBTEncoder
+import org.junit.Assert.assertArrayEquals
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNotNull
+import org.junit.Assert.assertNull
+import org.junit.Test
+import java.time.LocalDateTime
+import java.time.ZoneOffset
+
+/** Issue #142: spotting a stopped ring clock from where the ring stamps its own copy of a reading. */
+class RingClockStallTest {
+ private fun at(h: Int, m: Int, s: Int): Long =
+ LocalDateTime.of(2026, 11, 10, h, m, s).toInstant(ZoneOffset.UTC).toEpochMilli()
+
+ /** Reporter, after the freeze: connection 00:38:21–00:39:48, ring's copy stamped 00:38:25. */
+ private val frozenOurs = at(0, 39, 44)
+ private val frozenRing = at(0, 38, 25)
+
+ /** Reporter, before the freeze: connection 08:43:21–08:44:48, copy stamped 08:44:44. */
+ private val healthyOurs = at(8, 44, 45)
+ private val healthyRing = at(8, 44, 44)
+
+ @Test
+ fun `one frozen stamp is evidence but not yet a warning`() {
+ val s = RingClockStall.onCopyPaired(RingClockStall.State(), frozenOurs, frozenRing, frozenOurs)
+ assertEquals(1, s.evidence.size)
+ assertNull(s.suspectedAt)
+ }
+
+ @Test
+ fun `two frozen stamps raise the warning`() {
+ var s = RingClockStall.onCopyPaired(RingClockStall.State(), frozenOurs, frozenRing, frozenOurs)
+ val next = frozenOurs + 30 * 60_000L
+ s = RingClockStall.onCopyPaired(s, next, frozenRing + 30 * 60_000L, next)
+ assertEquals(next, s.suspectedAt)
+ }
+
+ @Test
+ fun `a healthy stamp clears the warning`() {
+ val raised = RingClockStall.State(evidence = listOf(1L, 2L), suspectedAt = 2L)
+ val s = RingClockStall.onCopyPaired(raised, healthyOurs, healthyRing, healthyOurs)
+ assertNull(s.suspectedAt)
+ assertEquals(emptyList(), s.evidence)
+ }
+
+ @Test
+ fun `the same reading is judged once`() {
+ var s = RingClockStall.onCopyPaired(RingClockStall.State(), frozenOurs, frozenRing, frozenOurs)
+ s = RingClockStall.onCopyPaired(s, frozenOurs, frozenRing, frozenOurs + 1)
+ assertEquals(1, s.evidence.size)
+ assertNull(s.suspectedAt)
+ }
+
+ @Test
+ fun `a minute-aligned stamp a minute early is not evidence`() {
+ // A ring stamping whole minutes can read up to 60 s before our settled time.
+ val ours = at(9, 0, 58)
+ val s = RingClockStall.onCopyPaired(RingClockStall.State(), ours, at(9, 0, 0), ours)
+ assertEquals(0, s.evidence.size)
+ }
+
+ @Test
+ fun `readings with no copy after a sync are evidence, once each`() {
+ val now = at(12, 0, 0)
+ val unmatched = listOf(at(10, 0, 0), at(11, 0, 0), at(11, 55, 0))
+ val s = RingClockStall.onSyncFinished(RingClockStall.State(), unmatched, now)
+ // The 11:55 reading is too recent to judge.
+ assertEquals(2, s.evidence.size)
+ assertNotNull(s.suspectedAt)
+ val again = RingClockStall.onSyncFinished(s, unmatched, now + 60_000L)
+ assertEquals(2, again.evidence.size)
+ }
+
+ @Test
+ fun `old evidence ages out of the window`() {
+ val first = RingClockStall.onCopyPaired(RingClockStall.State(), frozenOurs, frozenRing, frozenOurs)
+ val dayLater = frozenOurs + RingClockStall.EVIDENCE_WINDOW_MS + 60_000L
+ val s = RingClockStall.onCopyPaired(first, dayLater, dayLater - 80_000L, dayLater)
+ assertEquals(1, s.evidence.size)
+ assertNull(s.suspectedAt)
+ }
+
+ @Test
+ fun `a sleep-only pass says nothing about a reading with no copy`() {
+ val pass = RingClockStall.Pass(90_000L)
+ val now = at(12, 0, 0)
+ // No heart-rate or SpO2 history was delivered (opening the Sleep screen).
+ assertNull(pass.finish(RingClockStall.State(), listOf(at(10, 0, 0), at(11, 0, 0)), now))
+ }
+
+ @Test
+ fun `an automatic sample landing first does not stand in for the ring's copy`() {
+ val pass = RingClockStall.Pass(90_000L)
+ val ours = at(10, 31, 30)
+ // The ring's own all-day sample at 10:30:40 (50 s early) claims our reading first…
+ pass.onHistory("HEART_RATE", at(10, 30, 40), adopted = listOf(ours))
+ // …then the real copy, stamped when the measurement ended, arrives.
+ pass.onHistory("HEART_RATE", at(10, 31, 29), adopted = emptyList())
+ val raised = RingClockStall.State(evidence = listOf(1L, 2L), suspectedAt = 2L)
+ val s = pass.finish(raised, unmatched = emptyList(), now = ours + 60_000L)!!
+ assertNull(s.suspectedAt)
+ assertEquals(0, s.evidence.size)
+ }
+
+ @Test
+ fun `a frozen copy found in the pass is evidence`() {
+ val pass = RingClockStall.Pass(90_000L)
+ pass.onHistory("SPO2", frozenRing, adopted = listOf(frozenOurs))
+ val s = pass.finish(RingClockStall.State(), unmatched = emptyList(), now = frozenOurs + 60_000L)!!
+ assertEquals(1, s.evidence.size)
+ // The pass is spent once judged.
+ assertNull(pass.finish(s, emptyList(), frozenOurs + 120_000L))
+ }
+
+ @Test
+ fun `shut down is 03 16 01 like the vendor's appShutDown(1)`() {
+ assertArrayEquals(byteArrayOf(0x03, 0x16, 0x01), YCBTEncoder().shutDown())
+ }
+}
diff --git a/app/src/test/java/com/pulseloop/service/ScheduledSpo2SlotsTest.kt b/app/src/test/java/com/pulseloop/service/ScheduledSpo2SlotsTest.kt
index 9dcfb7a5..4a4b1e09 100644
--- a/app/src/test/java/com/pulseloop/service/ScheduledSpo2SlotsTest.kt
+++ b/app/src/test/java/com/pulseloop/service/ScheduledSpo2SlotsTest.kt
@@ -60,9 +60,16 @@ class ScheduledSpo2SlotsTest {
fun `a late run near the top of the hour is not clear`() {
assertTrue(ScheduledSpo2Slots.isClear(at(10, 30), 60))
assertFalse(ScheduledSpo2Slots.isClear(at(10, 2), 60))
- // Starting at 10:57 would still be measuring at 10:58:15 — too close to 11:00.
- assertFalse(ScheduledSpo2Slots.isClear(at(10, 57), 60))
- assertTrue(ScheduledSpo2Slots.isClear(at(10, 53), 60))
+ // 3 min before 11:00 gives 180 s >= 105 s for connect + sync + 75 s measurement.
+ assertTrue(ScheduledSpo2Slots.isClear(at(10, 57), 60))
+ // 2 min before 11:00 gives 120 s >= 105 s.
+ assertTrue(ScheduledSpo2Slots.isClear(at(10, 58), 60))
+ // Exact 105 s boundary.
+ assertTrue(ScheduledSpo2Slots.isClear(at(10, 58, 15), 60))
+ // 104 s < 105 s.
+ assertFalse(ScheduledSpo2Slots.isClear(at(10, 58, 16), 60))
+ // 60 s < 105 s.
+ assertFalse(ScheduledSpo2Slots.isClear(at(10, 59), 60))
}
@Test
@@ -122,8 +129,8 @@ class ScheduledSpo2SlotsTest {
assertTrue(ScheduledSpo2Slots.isClear(at(11, 0), 120))
// Late run at 22:25 (delayed from 22:00) is clear of 00:00 ring reading
assertTrue(ScheduledSpo2Slots.isClear(at(22, 25), 120))
- // 23:58 is 2 min before midnight reading => not clear
- assertFalse(ScheduledSpo2Slots.isClear(at(23, 58), 120))
+ // 23:59 is 1 min before midnight reading => not clear
+ assertFalse(ScheduledSpo2Slots.isClear(at(23, 59), 120))
}
@Test
@@ -143,4 +150,64 @@ class ScheduledSpo2SlotsTest {
assertTrue("180m app slot $t on 120m ring grid", ScheduledSpo2Slots.isClear(t, 120))
}
}
+
+ @Test
+ fun `isClearToMeasure only needs the 75 s measurement window before a reading`() {
+ // 75 s before 11:00 — exactly the measurement duration.
+ assertTrue(ScheduledSpo2Slots.isClearToMeasure(at(10, 58, 45), 60))
+ // 74 s before 11:00 — the measurement would still be running at the reading.
+ assertFalse(ScheduledSpo2Slots.isClearToMeasure(at(10, 58, 46), 60))
+ assertFalse(ScheduledSpo2Slots.isClearToMeasure(at(10, 59), 60))
+ // 90 s before 11:00: too late to start connect + sync, but fine to still be measuring.
+ assertTrue(ScheduledSpo2Slots.isClearToMeasure(at(10, 58, 30), 60))
+ assertFalse(ScheduledSpo2Slots.isClear(at(10, 58, 30), 60))
+ // Still inside the ring's own post-reading window.
+ assertFalse(ScheduledSpo2Slots.isClearToMeasure(at(10, 2), 60))
+ }
+
+ @Test
+ fun `nextClear just before the hour on a 60 min grid`() {
+ assertEquals(at(1, 5), ScheduledSpo2Slots.nextClear(at(0, 59), 60))
+ assertEquals(at(7, 5), ScheduledSpo2Slots.nextClear(at(6, 59), 60))
+ assertEquals(at(11, 5), ScheduledSpo2Slots.nextClear(at(10, 58, 30), 60))
+ }
+
+ @Test
+ fun `nextClear just after the hour on a 60 min grid`() {
+ assertEquals(at(1, 5), ScheduledSpo2Slots.nextClear(at(1, 2), 60))
+ }
+
+ @Test
+ fun `nextClear just before midnight rolls over to the next day`() {
+ assertEquals(at(0, 5, day = 22), ScheduledSpo2Slots.nextClear(at(23, 59), 60))
+ // 35 min grid: 23:55 + 5 min lands on midnight's own grid reset, so it slides to 00:05.
+ assertEquals(at(0, 5, day = 22), ScheduledSpo2Slots.nextClear(at(23, 54), 35))
+ assertEquals(at(0, 5, day = 22), ScheduledSpo2Slots.nextClear(at(23, 57), 35))
+ }
+
+ @Test
+ fun `nextClear always lands strictly after now on a clear moment`() {
+ for (interval in listOf(15, 20, 30, 35, 45, 60, 120)) {
+ for (minuteOfDay in 0 until 24 * 60) {
+ val t = at(minuteOfDay / 60, minuteOfDay % 60)
+ if (!ScheduledSpo2Slots.isClear(t, interval)) {
+ val retry = ScheduledSpo2Slots.nextClear(t, interval)
+ assertTrue(
+ "interval $interval retry $retry is not after $t",
+ retry.isAfter(t)
+ )
+ assertTrue(
+ "interval $interval retry $retry is not clear",
+ ScheduledSpo2Slots.isClear(retry, interval)
+ )
+ }
+ }
+ }
+ }
+
+ @Test
+ fun `a nextClear retry recovers onto the regular slot grid`() {
+ // A retry at 07:05 finishes measuring at 07:06:30; the next regular slot is 08:30.
+ assertEquals(at(8, 30), ScheduledSpo2Slots.nextSlot(at(7, 6, 30), 120, 60))
+ }
}
diff --git a/app/src/test/java/com/pulseloop/service/SleepGapsTest.kt b/app/src/test/java/com/pulseloop/service/SleepGapsTest.kt
index 09454f42..5ae8902e 100644
--- a/app/src/test/java/com/pulseloop/service/SleepGapsTest.kt
+++ b/app/src/test/java/com/pulseloop/service/SleepGapsTest.kt
@@ -134,6 +134,30 @@ class SleepGapsTest {
assertEquals(1, gap.single().durationMinutes)
}
+ /**
+ * #140: a record opened mid-minute (23:04:40) runs 63 minutes and the next opens at 00:08:01,
+ * so both sides round onto minute 63 and the sub-minute gap leaves no hole on the grid.
+ */
+ @Test
+ fun `the hypnogram draws a sub-minute gap the cards count`() {
+ val firstStart = at(23, 4, 40, dayOffset = -1)
+ val secondStart = at(0, 8, 1)
+ val blocks = listOf(
+ block(firstStart, 63, firstStart, firstStart),
+ block(secondStart, 30, secondStart, firstStart),
+ )
+ // Both sides land on minute 63 of the session.
+ assertEquals(63, blocks[1].startMinute)
+ val gap = hypnogramBlocks(blocks) - blocks.toSet()
+ assertEquals(1, gap.single().durationMinutes)
+ assertEquals(63, gap.single().startMinute)
+ assertEquals(SleepStage.AWAKE.name, gap.single().stageRaw)
+ assertEquals(1, awakeMinutes(blocks))
+ // Drawn before the later record's first block, which starts on the same minute.
+ val drawn = hypnogramBlocks(blocks).sortedBy { it.startMinute }
+ assertTrue(drawn.indexOf(gap.single()) < drawn.indexOf(blocks[1]))
+ }
+
// ── #105: a gap inside the Bedtime window keeps the night whole ──────────
/** The reporter's night: records 00:51–05:44 and 06:56–08:07, Bedtime 00:25–08:06. */
diff --git a/app/src/test/java/com/pulseloop/service/WorkoutServiceTypesTest.kt b/app/src/test/java/com/pulseloop/service/WorkoutServiceTypesTest.kt
new file mode 100644
index 00000000..79467fe3
--- /dev/null
+++ b/app/src/test/java/com/pulseloop/service/WorkoutServiceTypesTest.kt
@@ -0,0 +1,38 @@
+package com.pulseloop.service
+
+import android.content.pm.ServiceInfo
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+/** #139: a GPS workout's foreground service must carry the location type. */
+class WorkoutServiceTypesTest {
+ private val health = ServiceInfo.FOREGROUND_SERVICE_TYPE_HEALTH
+ private val location = ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION
+
+ @Test
+ fun gpsWorkoutOnAndroid14GetsHealthAndLocation() {
+ assertEquals(health or location, WorkoutForegroundService.serviceTypes(34, useGps = true, hasLocationPermission = true))
+ }
+
+ @Test
+ fun indoorWorkoutOnAndroid14IsHealthOnly() {
+ assertEquals(health, WorkoutForegroundService.serviceTypes(34, useGps = false, hasLocationPermission = true))
+ }
+
+ @Test
+ fun withoutLocationPermissionNoLocationTypeIsClaimed() {
+ assertEquals(health, WorkoutForegroundService.serviceTypes(35, useGps = true, hasLocationPermission = false))
+ }
+
+ @Test
+ fun gpsWorkoutOnAndroid10To13GetsLocation() {
+ assertEquals(location, WorkoutForegroundService.serviceTypes(29, useGps = true, hasLocationPermission = true))
+ assertNull(WorkoutForegroundService.serviceTypes(33, useGps = false, hasLocationPermission = true))
+ }
+
+ @Test
+ fun preAndroid10UsesPlainStart() {
+ assertNull(WorkoutForegroundService.serviceTypes(28, useGps = true, hasLocationPermission = true))
+ }
+}
diff --git a/app/src/test/java/com/pulseloop/settings/QuietHoursPrefsTest.kt b/app/src/test/java/com/pulseloop/settings/QuietHoursPrefsTest.kt
index 1d0d9a0d..3317e8a2 100644
--- a/app/src/test/java/com/pulseloop/settings/QuietHoursPrefsTest.kt
+++ b/app/src/test/java/com/pulseloop/settings/QuietHoursPrefsTest.kt
@@ -250,4 +250,25 @@ class QuietHoursPrefsTest {
assertFalse(QuietHoursPrefs.migratedGateByZenMode(scheduleEnabled = true, gateByZenMode = false))
assertFalse(QuietHoursPrefs.migratedGateByZenMode(scheduleEnabled = false, gateByZenMode = false))
}
+
+ /** #140: the clock window is "open" only inside a real window, never for start == end. */
+ @Test
+ fun scheduleOpenForNightInProgress() {
+ val start = 22 * 60; val end = 7 * 60
+ org.junit.Assert.assertTrue(QuietHoursPrefs.scheduleOpen(start, end, 2 * 60 + 4))
+ org.junit.Assert.assertFalse(QuietHoursPrefs.scheduleOpen(start, end, 8 * 60 + 30))
+ org.junit.Assert.assertFalse(QuietHoursPrefs.scheduleOpen(600, 600, 2 * 60))
+ }
+
+ /** #140: Bedtime opened before the night's end keeps it open; an afternoon DND doesn't. */
+ @Test
+ fun nightOpenFollowsTheNightsOwnBedtimeWindow() {
+ val h = 3600_000L
+ val end = 7 * h
+ assertTrue(QuietHoursPrefs.nightOpen(true, end - 8 * h, end, false, 0, 0, 0))
+ assertFalse(QuietHoursPrefs.nightOpen(true, end + 7 * h, end, false, 0, 0, 0))
+ assertTrue(QuietHoursPrefs.nightOpen(true, null, end, false, 0, 0, 0))
+ assertFalse(QuietHoursPrefs.nightOpen(false, null, end, false, 22 * 60, 7 * 60, 2 * 60))
+ assertTrue(QuietHoursPrefs.nightOpen(false, null, end, true, 22 * 60, 7 * 60, 2 * 60))
+ }
}
diff --git a/app/src/test/java/com/pulseloop/ui/components/DeviceHeroStatusTest.kt b/app/src/test/java/com/pulseloop/ui/components/DeviceHeroStatusTest.kt
index 235c498f..7f7451d9 100644
--- a/app/src/test/java/com/pulseloop/ui/components/DeviceHeroStatusTest.kt
+++ b/app/src/test/java/com/pulseloop/ui/components/DeviceHeroStatusTest.kt
@@ -112,4 +112,29 @@ class DeviceHeroStatusTest {
assertEquals("Disconnect", status.actionTitle)
assertEquals(true, status.actionEnabled)
}
+
+ @Test
+ fun `bluetooth off explains a disconnected paired ring`() {
+ val s = DeviceHeroStatus.make(
+ state = RingConnectionState.DISCONNECTED, connectedName = null,
+ knownName = "Ale-Hop2211", batteryPercent = 61, lastSyncAt = null, now = now,
+ bluetoothOff = true,
+ )
+ assertEquals("Phone Bluetooth is off", s.statusLine)
+ assertEquals(DeviceHeroStatus.Action.CONNECT, s.action)
+ }
+
+ @Test
+ fun `bluetooth off does not override connected or unpaired`() {
+ val connected = DeviceHeroStatus.make(
+ state = RingConnectionState.CONNECTED, connectedName = "R11",
+ knownName = "R11", batteryPercent = 50, lastSyncAt = null, now = now, bluetoothOff = true,
+ )
+ assertEquals("Connected", connected.statusLine)
+ val unpaired = DeviceHeroStatus.make(
+ state = RingConnectionState.IDLE, connectedName = null,
+ knownName = null, batteryPercent = null, lastSyncAt = null, now = now, bluetoothOff = true,
+ )
+ assertEquals("No ring paired", unpaired.statusLine)
+ }
}