mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
Adds foreground auto-detection of finished workouts on Android via Google Health Connect — the single aggregator every Android health source funnels into (Samsung Health/Galaxy Watch, Google Fit, Fitbit, Garmin, Strava), the same Android path RUNSTR uses. On opening the Workouts screen, Amethyst scans Health Connect for sessions the user hasn't handled and surfaces a banner that opens the existing workout composer pre-filled, ready to publish as a NIP-101e WorkoutRecordEvent (kind 1301). - HealthConnectManager reads ExerciseSessionRecord + aggregated distance, calories, heart rate, steps and elevation, mapping each to DetectedWorkout. - ExerciseTypeMapper maps Health Connect activity types to NIP-101e verbs. - HealthConnectStore remembers handled sessions per account so each is offered once; 7-day foreground lookback, no background service. - WorkoutSuggestions banner: connect prompt (on-demand permission request, never on cold start) or detected-workout rows on the Workouts screen. - Route.NewWorkout carries optional pre-fill; NewWorkoutViewModel publishes the richer metrics (heart rate, steps, elevation, start time) with source=health_connect (new SourceTag constant in quartz). - androidx.health.connect:connect-client (Apache-2.0) + read-only health permissions and the required privacy-rationale manifest entries. Design notes in amethyst/plans/2026-06-16-health-connect-workout-detection.md; background ~15-min polling + notification left as a documented future seam. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015qgqQKHSewRHVM8vSCLt9P