Repository navigation
Add a circadian rhythm tile to the Sleep page - #144
Open
saksham2001 wants to merge 3 commits into
Open
saksham2001 wants to merge 3 commits into
saksham2001 wants to merge 3 commits into
Conversation
This branch has not been deployed
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.
Summary
Adds a circadian rhythm tile to the top of the Sleep page, above the Last Sleep card. It shows when you usually wake, eat, train and go to bed, and how far the day or period you're viewing drifted from that.
The tile (
9cc2a3d)+32m,−1h 4m).gym/strength). There is no drift bar. Smart shows workouts only when you train regularly; Always shows every one.Expanded view. Tapping the tile opens a sheet with:
Coach hand-off. Tapping a prompt closes the sheet and opens a new coach chat with that question already sent.
CoachNavigation.ask(_:context:)andCoachView.askPendingPrompt()carry the question across.hiddenContextparameter onCoachViewModel.send. The chat bubble shows only the question, because no existing coach tool returns bedtimes or wake times.Settings › Circadian Rhythm (in the Metrics section)
NutritionSettingsView's rule against inserting glass groups.Demo data and launch args
-openCircadian YESand-openCircadianSettings YESopen the expanded sheet and the settings page.Lint (
9a9b11e): fixes alarge_tupleerror and long lines introduced in the first commit.Related issues
Related to #118. This adds the learned usual wake and bedtime it needs (naps excluded, averaged correctly across midnight), but not the caffeine, light or wind-down windows.
Type of change
How was this tested?
PulseLoopTests)CircadianRhythmTests(40 cases):⌘Uin Xcode): 1286 tests, 0 failures-seedDemo YES, no hardware)Not checked yet:
Known limit: on the semicircle one hour is about 14 pt wide, so a workout right before a meal sits partly under that meal's icon. The full dial in the expanded view separates them.
Privacy & data
The dial's times (wake, meals, workouts, bed) are only sent when the user taps a coach prompt. That requires the AI Coach to be on and goes to whichever provider it uses, the same as typing the question. The tile itself works entirely on device.
Screenshots / recordings
Demo data (
-seedDemo YES -enableNutrition YES) on iPhone 17, iOS 26.5.Across devices. Left to right: iPhone 17e, 17, Air and 17 Pro Max (iOS 26.5), then 16e and 16 Plus (iOS 18.6).
Checklist
function_body_lengthonCircadianEngine.snapshotandCircadianDialLayout.init, andfunction_parameter_countonCircadianEngine.snapshotand the sheet'seventRow.