Files
amethyst/commons
Vitor PamplonaandClaude Opus 5 0debf8a023 fix: don't offer to re-share a workout shared from Health Connect
The previous commit gated the share button on WorkoutOrigin, which closes
only half the case. When a user shares a workout their watch recorded,
TrainingLog.merge keeps the Health Connect copy and drops the published
one, so the survivor is still WorkoutOrigin.HEALTH_CONNECT even though a
kind 1301 for it is already out there — and the dashboard went on
offering to share it. That is the likelier route to a duplicate, since
sharing from Health Connect is the feature's main flow.

Origin answers "where did this data come from", which is the wrong
question. DetectedWorkout now also carries alreadyPublished, the merge
hands it to the surviving copy, and the published-event mapper sets it
too, so the dashboard has one field to read.

Confirmed on device: a Health Connect ride shared from My Fitness keeps
its metrics, does not duplicate, and loses its share button, while the
six unshared sessions keep theirs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 10:48:07 -04:00
..