Skip to content

feat: dev tool cleanup, HealthKit fixes, onboarding UX, symptom tracker light mode#17

Merged
chehanw merged 10 commits intomainfrom
Chehan-branch
Mar 10, 2026
Merged

feat: dev tool cleanup, HealthKit fixes, onboarding UX, symptom tracker light mode#17
chehanw merged 10 commits intomainfrom
Chehan-branch

Conversation

@chehanw
Copy link
Collaborator

@chehanw chehanw commented Mar 10, 2026

Summary

  • Remove dev infrastructure: Deleted health-data-test, fhir-parser-test screens and DevToolBar component from all onboarding screens and Profile tab. Kept surgery date trigger, reset onboarding, and skip-auth dev tools.
  • Fix onboarding navigation: permissions.tsx now routes to medical-history after the health-data-test screen was removed.
  • Consent name autofill: Patient's typed consent signature is automatically prefilled into the medical history "Full Name" field to avoid duplicate entry.
  • Fix "You're All Set" screen: Feature row text was invisible due to alignItems: center collapsing the Animated.View width — fixed with alignSelf: stretch.
  • Fix HealthKit UTC/local timezone bug: use-health-summary.ts was using toISOString().split('T')[0] (UTC date) while HealthKit data is bucketed by local timezone — after ~5 PM in US timezones today's activity/vitals would not be found. Fixed by using formatDateKey(new Date()).
  • HealthKit query error isolation: Added per-query .catch(() => []) in getDailyActivity and getVitals so Watch-only type failures (exerciseTime, moveTime, standTime) don't block step count and energy data from the iPhone.
  • Symptom tracker light mode: Migrated tracker.tsx from the legacy Colors system (which lacked a text field) to useAppTheme() for full light/dark mode support.

Test plan

  • Run through full onboarding flow — no references to removed dev screens
  • Verify typed consent name appears prefilled in medical history
  • Verify "You're All Set" screen shows all feature text next to icons
  • Open app after 5 PM — confirm activity/vitals show today's data (not yesterday's)
  • Test on device without Apple Watch — confirm step count still shows (no all-or-nothing failure)
  • Switch device to light mode — confirm symptom tracker renders correctly with dark text on light background
  • Verify remaining dev tools still work: surgery date animation trigger, reset onboarding, skip auth

🤖 Generated with Claude Code

chehanw and others added 10 commits March 4, 2026 13:10
HRV (Heart Rate Variability SDNN):
- Added heartRateVariabilitySDNN to METRIC_CONFIG with unit "ms"
- Reuses the existing quantity sample pipeline with no additional code

Sleep:
- New syncSleep() using queryCategorySamples on
  HKCategoryTypeIdentifierSleepAnalysis
- Firestore path: users/{uid}/healthkit/sleepAnalysis/samples/{uuid}
- Sync state at: users/{uid}/healthkitSync/sleepAnalysis
- Each doc stores: value (raw enum), stage (readable string e.g.
  "asleepCore", "asleepDeep", "asleepREM"), startDate, endDate,
  durationMinutes, sourceName?, deviceName?
- Incremental sync with same 30-day lookback / overlap strategy
  as quantity metrics

Both pipelines run in parallel in bootstrapHealthKitSync().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oard

- Throne Science module: metric toggles (Avg Flow/Volume/Duration/Max Flow),
  7-day bar chart via bucketSeries, real synced data from fetchSessions+fetchMetricsBatch
- Apple HealthKit module: three concentric activity rings (Move/Exercise/Steps),
  sleep quality, heart rate, SpO2, respiratory rate via useHealthSummary()
- Preserved all existing functionality (surgery date, study timeline, watch
  reminder, dev tools modal, SurgeryCompleteModal, pull-to-refresh)
- Fixed data fetch to match voiding.tsx pattern (no userId filter, no status filter)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Escape apostrophe in JSX text (react/no-unescaped-entities)
- Remove unused imports: useAuth, computeSummaryStats
- Remove unused variables: isDark, user, outerCenter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…estore

- HomeFlow.entitlements: restore aps-environment (production) and
  com.apple.developer.applesignin — both were accidentally removed;
  Apple Sign In is used on the login screen and push notifications
  are required for the 48h data sync reminder flow
- healthkitSync.ts: add incremental sleep analysis sync pipeline
  (HKCategoryTypeIdentifierSleepAnalysis → Firestore, idempotent via
  HK UUID, batched writes, separate sync cursor per night)
- use-health-summary.ts: fix sleep selection to use most-recent night
  (sleepData[length-1]) instead of first element
- project.pbxproj: update DEVELOPMENT_TEAM to DR492LE84K
…ng date picker

Typography:
- Add lib/theme/typography.ts with shared FontSize/FontWeight constants
- Replace all hardcoded fontSize/fontWeight literals across every screen and
  component with constants (16 sizes → 11-step scale, 5 weights → 4 values)
- Normalize outliers: 24→22 (titleMedium), 32→34 (display), 16/14→15 (subhead),
  18→17 (headline), 10→9 (chartAxis)

Home screen:
- Move surgery date and study timeline cards above Throne/Apple Health modules
- Replace Blood Oxygen and Respiratory Rate vitals (commonly empty, Watch-only)
  with Resting Heart Rate and HRV — both reliably collected from Apple Watch
- Fix latent SpO2 double-multiplication display bug

Onboarding date picker (chat.tsx):
- Fix broken require: .DateTimePicker → .default (package uses default export)
- Fix Dayjs→Date conversion in onChange handler (library returns Dayjs, not Date)
- Replace all dead v2 style props with v3 styles object (selectedItemColor etc.
  were silently ignored); add cardinal circle for selected day, theme-aware text
- Persist surgery date in OnboardingData.eligibility.surgeryDate (YYYY-MM-DD)

Firestore:
- Tighten security rules: scoped per-user reads for sessions/metrics/sync
- Add use-throne-user-id hook
Kept the more complete HEAD implementation of syncSleep():
- dryRun support for testing without Firestore writes
- FirestoreSleepSampleData typed interface
- buildSleepSampleId() with SHA-1 fallback for stable doc IDs
- mapCategorySampleToSleepSample / getSleepNightDate mappers
- Incremental sync via shared getLastSync/setSyncState helpers
…om tracker

- Remove all dev-only screens (health-data-test, fhir-parser-test) and DevToolBar
  component from all onboarding screens and profile tab; keep surgery date trigger,
  reset onboarding, and skip-auth dev tools
- Fix navigation in permissions.tsx to route to medical-history after DevToolBar removal
- Autofill patient name from typed consent signature into medical history form
- Fix "You're All Set" screen feature text invisible (alignSelf stretch on Animated.View)
- Fix HealthKit UTC/local timezone mismatch in use-health-summary (use formatDateKey
  instead of toISOString) so today's activity/vitals are found correctly after ~5 PM
- Add per-query .catch guards in getDailyActivity and getVitals so Watch-only type
  failures don't block step count and energy data
- Migrate symptom tracker to useAppTheme for full light/dark mode support
- Remove HEALTH_DATA_TEST case from onboarding router (screen deleted)
- Remove dead handleDevContinue from permissions.tsx (referenced deleted screen)
- Commit SignaturePad.tsx with onDrawingActiveChange prop used by consent screen
- Commit throneFirestore.ts with correct fetchSessions(uid, opts) signature,
  saveMedicalHistory, and saveThroneUserId exports used by screens
- Commit healthkitSync.ts with string-typed metricType so sleepAnalysis key compiles
- Commit package.json and package-lock.json with expo-print dependency
@chehanw chehanw merged commit 6ce9e0f into main Mar 10, 2026
5 checks passed
chehanw added a commit that referenced this pull request Mar 11, 2026
feat: dev tool cleanup, HealthKit fixes, onboarding UX, symptom tracker light mode
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