Skip to content

feat(settings): add a milestones card (streak and threshold milestones) - #2822

Open
LeonardSEO wants to merge 1 commit into
ryanbr:mainfrom
LeonardSEO:feat/milestones
Open

LeonardSEO wants to merge 1 commit into
ryanbr:mainfrom
LeonardSEO:feat/milestones

Conversation

@LeonardSEO

Copy link
Copy Markdown

What this PR does

Adds a Milestones card under the streak card in Settings on Android and macOS/iOS: eight milestones unlocked on the first day the user's own stored metrics reach them, with the unlock date and a NEW tag for the last 7 days.

  • First scored day, 7-day streak, 30-day streak, 100 scored days (a scored day has a Charge value)
  • Charge 90 %+, 8 hours asleep, Effort 18+, 10,000 steps

Streaks are consecutive civil days with a score; same-day duplicates count once. Values outside each metric's plausible range never unlock anything.

Pure math in Achievements (StrandAnalytics) with a Kotlin twin and mirrored fixtures. Display-only. No celebration screen.

The official app's achievements are server-driven; this is a local equivalent.

Type of change

  • New feature

How it was tested

  • AchievementsTests / AchievementsTest (same fixtures: streak unlock day, gaps reset the run, same-day duplicates count once, threshold milestones, implausible rows ignored, NEW window).
  • swift test in Packages/StrandAnalytics: 2145 tests pass.
  • ./gradlew testFullDebugUnitTest: 6690 tests, all pass apart from the 2 RecoveryDriversTest half-tie cases that fail the same way on unmodified main.
  • Tools/i18n_audit.py --ci, Tools/doc_comment_lint.py, docs/protocol-examples checks and Tools/parity_ledger.py --refresh-derived (derived snapshots included): pass.
  • Tools unit tests, the parity acceptance suite and the R-R contract: pass apart from the 4 test_check_source_references cases (/var vs /private/var temp path on macOS) that fail the same way on unmodified main.
  • Apple: the macOS app (Strand) builds with this change on my development branch; StrandTests and the iOS target were not run locally for this branch. app-build.yml covers both.

Checklist

  • Swift package tests pass for any package I touched
  • Android unit tests pass if I touched android/ (apart from the 2 RecoveryDriversTest half-tie cases that fail the same way on unmodified main)
  • No new build warnings introduced (Android: none; Apple warnings not checked per branch)
  • UI changes use only StrandDesign / Palette / Metrics tokens
  • No hardcoded hex frame bytes; protocol facts live in the schema / decoders
  • Follows the conventions in docs/CONTRIBUTING.md
  • I did not commit generated output (Strand.xcodeproj/) or any secrets/keystores

Related issues

Builds on the streak card (#569).

🤖 Generated with Claude Code

…s own history

Pure math in StrandAnalytics Achievements with a Kotlin twin and mirrored fixtures. Settings card on Android and Apple. Display-only.
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