Skip to content

Add automatic streak-saver notification#20

Merged
bootuz merged 5 commits into
mainfrom
feature/streak-saver-notification
Jun 5, 2026
Merged

Add automatic streak-saver notification#20
bootuz merged 5 commits into
mainfrom
feature/streak-saver-notification

Conversation

@bootuz
Copy link
Copy Markdown
Owner

@bootuz bootuz commented Jun 5, 2026

Summary

  • Adds a third reminder — an automatic streak-saver — that fires in the evening (fixed 20:00) only when the streak is at risk: currentStreak > 0 && studiedToday == 0 && freezeTokens == 0.
  • No toggle / no settings / no UI — it's always armed; the OS notification permission (and the "reminders" channel) is the only off switch. Integrates with freezes: it won't nag a streak that a freeze will protect.
  • Reuses the existing self-rescheduling ReminderWorker + "reminders" channel (no new infra).

Implementation

  • ReminderContent.kt: new ReminderType.StreakSaver + STREAK_SAVER_HOUR/MINUTE constants; the pure reminderContent(...) gains currentStreak/freezeTokens params + a StreakSaver branch.
  • ReminderWorker.kt: injects StreakProvider + StreakStateRepository, feeds the live streak + freeze count into the decision; scheduleFor returns always-enabled at the fixed time.
  • AzriApplication.ensureReminders(): arms the streak-saver unconditionally on launch.

Test Plan

  • ./gradlew :app:testDebugUnitTest — green (4 new ReminderContentTest cases: fires at-risk+unprotected; skips when studied-today / no-streak / freeze-protected)
  • ./gradlew :app:assembleDebug — debug APK builds
  • Manual (emulator): streak alive + 0 freezes + not studied today → at ~20:00 a "Keep your streak alive" notification appears; with a freeze available, or after studying today, nothing posts

🤖 Generated with Claude Code

@bootuz bootuz merged commit 54bad96 into main Jun 5, 2026
1 check passed
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