Skip to content

Add State of Mind sync + auto-request new Health permissions - #1

Open
rannyeribatista wants to merge 2 commits into
lenilsonjr:mainfrom
rannyeribatista:state-of-mind-sync
Open

rannyeribatista wants to merge 2 commits into
lenilsonjr:mainfrom
rannyeribatista:state-of-mind-sync

Conversation

@rannyeribatista

Copy link
Copy Markdown

What

  • State of Mind (iOS 18): one registry row + a serializer for HKStateOfMind. Valence rides value under a valence unit; kind, valence classification, labels, and associations ride metadata as comma-joined names (e.g. "happy,grateful"). Unknown future enum cases degrade to label_<n>-style names instead of breaking. Wire schema documented in docs/PROTOCOL.md; type key pinned in the registry test.
  • Auto-request new permissions: when the registry grows a type, statusForAuthorizationRequest flips to shouldRequest, but the ask waited for a tap on the StatusView banner — easy to miss after an update. Now the app asks on scene activation; the banner stays as the manual fallback.

Why

Mood was the missing stream — State of Mind entries never left the phone. On first run after this change, 22 months of history (190 samples) synced retroactively.

Tested

  • Clean xcodebuild against the iOS 18 simulator SDK; registry test updated
  • On device (iPhone 11): full State of Mind history + fresh entries sync end-to-end
  • The auto-prompt fires only when a future type needs asking (the exact scenario it fixes); logic mirrors the existing banner path

🤖 Generated with Claude Code

rannyeribatista and others added 2 commits July 15, 2026 21:37
One registry row + a serializer for HKStateOfMind: valence rides value
under a "valence" unit; kind, valenceClassification, labels, and
associations ride metadata as comma-joined names. Availability-gated to
iOS 18 like breathing disturbances; wire schema documented in
docs/PROTOCOL.md and pinned in the registry test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When the registry grows a type, statusForAuthorizationRequest flips to
shouldRequest but the ask waited for a tap on the StatusView banner —
easy to miss after an update. Ask as soon as the scene activates
instead; the banner stays as the manual fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant