Skip to content

unstrap 3.0.5: state machine fixes and actual vitals - #65

Merged
sayed0am merged 45 commits into
mainfrom
develop
Nov 11, 2026
Merged

sayed0am merged 45 commits into
mainfrom
develop

Conversation

@sayed0am

Copy link
Copy Markdown
Owner

Brings develop to main for the 3.0.5 release.

What's in it

Checked

🤖 Generated with Claude Code

sayed0am and others added 30 commits November 7, 2026 02:41
A wrong or protected key failed the same way on every presence event,
Bluetooth restart and phone alert. ConnectErrors.isFinal now counts it,
so only the user's own connect or opening the app tries again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, deleted workout page

S8: MainActivity reads notification and widget extras in onCreate (fresh launch only) and onNewIntent, not onResume. S16: onResume refreshes phoneAlerts. S23: workout detail is Loading, Found or Missing by key; Missing shows a deleted message.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…uto sync on after first export, one write lock

One Bluetooth answer runs the queued workout and the Strap action. The location follow-up is a saved tag.
Granted for Health Connect writes means the required permissions only. Auto sync turns on only after its first
export succeeds. All Health Connect writes share one Mutex.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
S6: requests go through one channel and worker, a Sync now waits for a session or a firmware update, stale auto and type requests are dropped, only an auto failure triggers an immediate retry, dumpRaw takes its turn and never leaves Running. S19: widget refreshes run one at a time, the snapshot reads sync state once, bump uses update.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Update: failures after process death are shown from the saved tag, the tag is reconciled with installer sessions at start and on resume, Installing times out, one Check type, PendingAction.Install always cleared with feedback when installs are denied. Firmware: stale or illegal events are ignored per step, one AccountMode, token kept out of saved state, fields keyed on the account.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ngs after End

Discard is one DAO transaction. Start rolls back if it fails half way and honours a missing GPS. Readings after the last flush are dropped, the loop flushes under the lock, and a failed restore is retried. Starting a workout no longer overrides Disconnect.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…cap sent flag (S15, S23)

Alarms: write results close the sheet only on success, queued refresh, Loading/Failed/Loaded read state.
Share card: photo state, saveable result. Sleep detail: saveable sheets, Undo only after delete shows.
Backups: one DataJobs lock and a snapshot file per call. Recap marked sent only after it is shown.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…connection facts, find strap start order

Background connects never clear the user's Disconnect and read it on the lane. Live HR follows reasons, the connection and firmwareUpdating in one ordered coroutine. NotPaired follows the paired flow, Forget clears the old strap's facts, and Find strap is set before its start goes out.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two overrides returned Boolean where the interface wants Unit, a connect
test counted log lines after virtual time while the connect reads the
paired strap on a real thread, the share photo test built a Compose
bitmap Robolectric can't, and detekt's new findings (long lines, three
LaunchedEffects that only set state, and two complexity rules).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Develop's Zepp parity work rewrote sync, connect, live heart rate and workout traffic.

- SyncCoordinator: develop's version, which already queues and runs one sync at a time. Group C's SyncPlan and its test are dropped.
- LiveHeartRateStream: keeps the single coroutine that owns the stream, with develop's per-screen consumers in place of the effort watch.
- StrapManager: develop's connect order plus clearing the last connection's battery and firmware. The wear poll is gone as on develop.
- StrapCommands: develop's per-connection alarm caps, still cleared on Forget.
- Chinese strings for the five strings wave 1 added.
- The firmware install state test is ignored while firmware updates are off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reconnect resend acted on every Connected value, and a battery or charging change is a new one, so each sent
the config and state again. Zepp sends it at the workout start (xbc.k) and then only on AUTH_SUCCESS (rbc via
yfk); its battery callback sends nothing. It now follows the change into Connected, which the start still sends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A type whose retries ran out, or that hit the cyclic stop, after some chunks counted as ok, so the sync ended Done
with that type short. Zepp's type result is its last exchange's status (l59.f, ixi.a), so the type fails and the
sync ends with an error. The chunks that came first are still stored and the cursor moves past them, as in Zepp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wn for good, Offer calories again

Location and notifications turned down for good get the Bluetooth dialog with its settings button. A notifications denial is now recorded from the Bluetooth ask and checked at workout start. The Health Connect page offers calories again, asking for just those permissions, only while they are not granted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed per part, start returns a result

A failed End sets Recording.endFailed and the live screen shows Not saved yet with Try again (End again).
saveFailed is now derived from endFailed and a per-part set (Workout, Sets, Rounds, HeartRate), so one
success no longer clears another failure. start() returns Deferred<StartResult>, WorkoutSession and the
layer share inProgress, the tile no longer sends Ready during a summary or reads the sport back from
its subtitle, and a GpsState flow says Off, Searching, Fixed or Unavailable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he picked day is saved

DayViewModel builds one DayScreenState from one flatMapLatest on the shown day, so the
day, Recovery (Loading, Ready or Failed), Healthspan, usual steps and activity carry the
same date and start empty on a switch. The picked day goes in SavedStateHandle. The
per-screen date checks are gone, and Sleep detail no longer shows No night before load.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…fter restore, Ready cleared on start

WorkoutNotifier (app scope) owns Saved and the Keep recording cancel. The notice can no longer be cancelled by the
session's late clear after the service's refusal. Undo only applies to the end it was posted for. End keeps its
confirmation until end() finishes. START_STICKY follows the restored state and drops once nothing is in progress.
Ready and Choose close whenever the session leaves Idle.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…as a state, companion prompt cancel only hides the offer

S5: SyncCoordinator persists the last full sync and the failing-since time. The header, the Strap page and the widgets read that one status. A push sync no longer moves the Synced time, and busy now covers the work after a sync. S12: ConnectionState.BluetoothOff with a Turn on action on the Strap page, the notification and widgets. Companion: Back on Android's prompt hides the offer for now, a real failure falls back to the battery setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sayed0am and others added 15 commits November 10, 2026 11:09
- DayViewModel keeps its profile flow as a property, which the new per-day flows read, and names the 800 ms settle.
- StrapService starts itself with runCatching outside a coroutine, and the sticky check is split for detekt.
- NavRequestsEffect collects with the lifecycle and closes Ready in a SideEffect.
- The two older day tests read the single screen state.
- The sync failure time is left out of backups, as the last sync time is.
- Line length and two suppressions with reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A workout that ended with the app behind left the strap pushing steps, since notify was only set on visibility
changes and connects. Zepp's RealtimeStepService turns it off on a step push (07, its mgk event) when the app is
behind and no phone GPS workout runs, at most once per 1.5 s (yt00.a, yt00.j).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both lived only in memory, so a process death cut a rest short by the +10 s taps and dropped the live kcal, which
never goes down. They are kept in settings for the recording workout, keyed on its start, and read back on restore.
The end question and "in a car" still start afresh, so a restart doesn't ask at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DayViewModel: wave 2's per-day activity flow with main's strip dots. ScoreDetail: main's held day page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aceholder

Main's detail pages kept the last day's page up to 4 s, undimmed, so another day's numbers stood under the new date.
One rule now covers Today and the details: a refresh of the same day keeps its value, another day keeps the last one
dimmed for at most 300 ms, then the placeholder, and a failed day holds nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… blood oxygen reading

Zepp writes breathing rate, blood oxygen and VO2 max to Health Connect one record per strap
sample. unstrap left breathing rate and VO2 max out, and dropped blood oxygen below 80 at sync.

- Breathing rate goes out as one record per stored sample.
- Blood oxygen is kept and exported from 1 to 100, not 80 to 100.
- The strap's own VO2 max goes out per workout. unstrap's estimates are not sent.
- Workouts the strap recorded go out as sessions, except one a phone workout overlaps.
- The two new permissions are optional, as the calorie ones are.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Heart rate's lowest and highest come from the stored minutes, the high from the strap's
  daily maximum when higher, not from the chart's 5-minute averages. The night's lowest too.
- A resting heart rate unstrap estimated says so, and its sheet no longer says the strap
  always works it out.
- HRV is one figure everywhere: the sleep readings from 5 to 200 ms, averaged and rounded.
  Week, Month, Year and the normal use the nights, not the whole day.
- Today's stress card says its number is the latest reading. The body signals row says
  day average.
- Skin temperature leads with its change from your normal on All metrics and its day detail.
- Blood oxygen is a whole percent on the Recovery line.
- A held chart point says it is an average, a moved sleep's score says adjusted, and the
  breathing sheet no longer says one value a night.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ger stack

S11: a STOP or ABANDON the strap never got (out of range, Bluetooth off) left its session running, and its frames then
led the live heart rate. The session keeps the unsent end and sends it once on the next connect with nothing recording;
a new START replaces it. Seen and fixed on the strap (3.27.0.1) 2026-11-11.

S21: two quick taps on You and the strap pill stacked [You, Strap], so Back went to You. The two root pages now replace
each other; pages opened from a row still stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p does

The Zepp-parity job list dropped history type 46, so skin temperature
stopped arriving in 3.0.3. It is asked for again, after everything of
Zepp's. Blood oxygen readings outside 80..100 are dropped before storing
and on export, as Zepp 10.10.5 does.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…what it shows

Blood oxygen and stress show the day's latest reading on Today, Recovery
and their pages, with the time only once it is over an hour old. Blood
oxygen is marked daytime, while asleep or night average, on a fixed 80 to
100 chart with the sleep hours shaded. Stress is judged by the level of
the reading shown (relaxed, normal, medium, high), with a tag and rim only
when high. The latest heart rate has no tag or rim.

Skin temperature leads with the measured value, its change from normal
inside the gauge and under the number. List rows keep their line beside
the tag.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Fix the implicit state machines (S1 to S23, N1 to N11)
Brings in the state machine fixes (#63). Health Connect keeps develop's
rule that only the needed permissions decide, with the optional ones now
calories, breathing rate and VO2 max, offered again from the Health
Connect page. Strap workouts are dropped under the same write lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…long comment

The German-locale run writes 0,7 for 0.7. Detekt's line length caught the
Health Connect actions comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vitals: actual readings on screen and in Health Connect, skin temperature syncs again
/** Where the day's rows are worked into its state, off the main thread (audit C7). */
private val work: CoroutineDispatcher = Dispatchers.Default,
/** Keeps the day picked, so a restore reopens the same day. */
private val saved: SavedStateHandle = SavedStateHandle(),
/** Where the day's rows are worked into its state, off the main thread (audit C7). */
private val work: CoroutineDispatcher = Dispatchers.Default,
/** Keeps the day picked, so a restore reopens the same day. */
private val saved: SavedStateHandle = SavedStateHandle(),
@sayed0am
sayed0am merged commit 4d033d6 into main Nov 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants