Robs#19
Open
rohabs wants to merge 193 commits into
Open
Conversation
…n pinning, and initial dependencies.
Firebase set up
Adding Calebs branch to dev (adding flutter and firebase setup to dev)
merged summary + Defines clear mapping from question IDs (q1–q9) to human-readable preference keys in a constant or comment
Changes to the BPM calculation logic (scan does scanning now)
new error message for poor finger placement - used to say that it was a camera issue
changed error image to a fingerprint
Changed “quality” to “signal quality” so its less confusing signal quality gives an accurate message based on the quality of the ppg signal
signal quality now gets written to metrics daily
user_service.dart
submitQuestionnaire now saves to two subcollections under users/{uid} — questionnaire_responses and preferences/onboarding — instead of a top-level collection
Added _derivePreferences() method that maps q1–q9 answers to human-readable keys and derives a stressRiskTier
Added onboardingCompleted: true and onboardingCompletedAt written to the user doc using SetOptions(merge: true) so existing fields are never overwritten
Wrapped Firestore writes in try/catch with rethrow so errors surface to the user as a snackbar
dashboard_screen.dart
Added onScanTap callback to DashboardScreen class
Added _buildEmptyState() method showing a helpful card with "Take a Scan" and "Connect Health" buttons when there is no data
Changed summary row condition from anyConsented to anyConsented || stressVals.isNotEmpty || hrvVals.isNotEmpty || sleepVals.isNotEmpty so manual data users see summary cards
Changed _maybeChart() to hide charts with less than 2 data points
Added single data point dot rendering in _AreaChartPainter
main_navigation.dart
Passed onScanTap callback to DashboardScreen so "Take a Scan" button switches to the scan tab correctly
profile_screen.dart
Wrapped _buildCard() in a Material widget to fix SwitchListTile ink splash visibility assertion error
home_screen.dart
Wrapped mood options Row in SingleChildScrollView with horizontal scroll direction
Wrapped bottom sheet Column in SingleChildScrollView to fix overflow
Added isScrollControlled: true to showModalBottomSheet to fix the 310px height constraint
Firestore Security Rules
Added subcollection rules for questionnaire_responses and preferences nested inside match /users/{uid} so writes to those subcollections are permitted
Summary row — change the anyConsented condition to anyConsented || hasManualData where hasManualData is true if any stress, mood, or wellness documents exist in the date range. Stress and mood are always available without HealthKit.
1. Stress fallback fixed Changed Stream<double> to Stream<double?> Replaced hardcoded 30.0 default with null Stress card shows -- instead of fake score when no data exists 2. Stress context label "No data yet" shows with grey dot when stress is null Coloured label (Very Low / Low / Moderate / High) shows with coloured dot when data exists /100 hides when stress is null -- font size reduced to 28sp to sit naturally beside /100 CrossAxisAlignment.center applied so -- and /100 are vertically centered 3. Heart Rate tile Added comment in _hrStream setup explaining scan results go to heart_rate_scans not metrics_daily Fixed in scan_screen.dart — scan results now write to BOTH heart_rate_scans AND metrics_daily so the HR tile updates after a scan HR tile correctly shows -- when no data exists HR tile does not show "Connect Health →" since HR can come from a scan 4. Sleep and Steps empty state "Connect Health →" hint added to Sleep, Steps tiles when showing -- Tapping navigates to Profile/HealthKit section Heart Rate excluded from this hint via showConnectHint: false 5. Tile loading state Grey shimmer placeholder shown on stress card while loading Loading state passed through stressLoading bool 6. Extra metrics added Mood tile added to the metrics row showing today's logged mood Wellness stream added and wired to _wellnessStream Both moodVal and wellnessVal passed through the StreamBuilder chain to _buildScaffold 7. Scan writes to metrics_daily _saveToFirestore in scan_screen.dart now writes to both collections Uses SetOptions(merge: true) so multiple scans in one day update rather than duplicate
This writes the scan result to both collections — heart_rate_scans for history and metrics_daily for the home screen tile. The merge: true means if you scan multiple times in a day it updates the existing doc rather than creating duplicates.You said: The home screen has four metric tiles in a row: Stress, Sleep, Steps, and Heart Rate.
checks if the user device has a flash and handles accordingly
Onboarding & User Data
Questionnaire responses now save to subcollections under users/{uid} instead of a top-level collection
User preferences derived from questionnaire answers are merged into the user doc
onboardingCompleted is correctly set to true after questionnaire submission
Errors during submission surface to the user as a snackbar instead of failing silently
Home Screen
Stress tile no longer shows a fake 30 for new users — shows -- and "No data yet"
Stress tile shows a coloured context label (Very Low / Low / Moderate / High)
Added Mood tile to the metrics row
Sleep and Steps tiles show "Connect Health →" when no HealthKit data exists
All tiles show a grey loading placeholder while streams are loading
Mood check-in bottom sheet fixed for smaller screens
Dashboard / Metrics Screen
Empty state card shown when user has no data instead of a blank screen
Summary cards appear for users with only manual data (no HealthKit)
Added Wellness Score card with colour-coded label (Good / Fair / Needs attention) and trend arrow
Trend arrows now correctly reflect direction and colour for each metric
Empty charts hidden — only charts with at least 2 data points render
Single data points render as a dot instead of an empty chart
"Take a Scan" button correctly switches to scan tab
Date range selector visually highlights the active selection
Scans & Health Data
Scan results now write to both heart_rate_scans and metrics_daily so the HR tile updates after a scan
Wellness score is computed and written during every real HealthKit sync, not only demo seeding
Profile Screen
Profile photo handles invalid URLs gracefully
Added "Load Demo Data" button under Developer Tools
Fixed SwitchListTile ink splash visibility error
Firestore & Security
Subcollection rules added for questionnaire_responses and preferences under users/{uid}
removed some hardcoded stuff like the amount of sleep.
added a check to see if its the user's first time using the scan feature
isFirstScan checks if the user has done a scan before, if not then a tutorial slide will show up to guide the user there is also a button at the top right if the user needs to see the tutorial again
added the scannerTutorialSeen flag to preferences in firebase
fixed overflow error for calendar
added pop up for calendar events
Scan wont start until tutorial is completed
Ready for testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
more changes to scan tutorial