Add bedtime Live Activity - #37
Draft
gsbernstein wants to merge 7 commits into
Draft
Conversation
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
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
Live Activity presentation
The countdown uses
SystemFormatStyle.DateReference, which phrases the remaining time in natural language:Bedtime in 8 hours,Bedtime in 20 minutes,Bedtime now. It supplies its own "in …", so the heading holds only the subject.allowedFieldsis limited to hours and minutes so the style never reaches for "tomorrow", andthresholdFieldis.hourso only a gap wider than a day would fall back to an absolute date, which cannot happen for the next bedtime. The relative form always shows a single rounded unit, so this trades the minute precision ofDateOffsetfor a calmer line.Only system-rendered text keeps updating once the app is suspended, so the countdown cannot use
TimeFormatter. The sleep-goal target beside it is app-formatted and does follow the decimal-durations setting, which is whyDurationDisplayStyletravels in the activity's content state andTimeFormatteris shared by both targets.Legibility: the card no longer tints its own background or draws indigo text over that tint. It uses the system Live Activity background with primary and secondary label colors, leaving indigo for the icon, progress bar, and keyline.
The card covers two phases.
staleDateis set to bedtime, so the system re-renders into the sleeping phase at bedtime without the app running: the heading becomesWake in …and the progress bar switches from wind-down progress to progress through the night. The bar never represented sleep data — it is purely clock progress, and its numeric label (previously a stray0:00before bedtime) is now hidden.CI status
The build compiles with no errors and no new warnings. Archive export still fails for every distribution method, which is automatic signing being unable to provision the new
com.burnsides.bedtime.liveactivityidentifier. Apple documents the workaround in the Xcode Cloud release notes: archive and export once locally from Xcode, or register the identifier manually in Certificates, Identifiers & Profiles. Two earlier repository-side defects were fixed along the way: the extension target deviated from Apple's generated widget template (hand-writtenInfo.plist, mismatched deployment target,CodeSignOnCopyon the embedded.appex), and the shared attributes type carried a main-actor isolatedActivityAttributesconformance that is an error in the Swift 6 language mode.Testing