Skip to content

feat(streak-system): implement multi-type streak tracking system - #118

Open
MF-Rozi wants to merge 14 commits into
masterfrom
feat/streak-system
Open

MF-Rozi wants to merge 14 commits into
masterfrom
feat/streak-system

Conversation

@MF-Rozi

@MF-Rozi MF-Rozi commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Description

What:

  1. Implemented a comprehensive multi-type Streak Tracking System supporting dailyActivity, appOpen, and underBudget streaks.
  2. Created pure domain engine (StreakEngine) and period representations (StreakDay, StreakMonth) with configurable window tolerance, minimum threshold, and cadence spacing.
  3. Added data storage layer for app open history, streak configuration persistence, and budget overrun analysis.
  4. Integrated streak metrics into the user experience:
    • Dedicated Streaks Page (/streaks) with StreakHero, interactive StreakCalendar, MilestoneProgress, and UnderBudgetMonthCard.
    • Dashboard integration featuring StreakBadge in the header and StreakCard above wealth trajectory.
    • Settings developer ritual integration for accessing the interactive StreakConfigSheet tuning sheet.
  5. Added complete test suite covering domain entities, engine rules, repositories, use cases, BLoCs/Cubits, and UI widgets (344 tests passing).

How:

  1. Domain Layer:
    • Defined Streak, StreakPeriod, StreakConfig, StreakStatus, StreakType, and UnderBudgetMonthStatus entities.
    • Built StreakEngine with gap-absorption algorithms, milestone ladder tracking (7, 14, 30, 60, 90, 180, 365), and DST/timezone resilience.
    • Added use cases: GetStreaksUseCase, GetQualifyingPeriodsUseCase, and GetUnderBudgetStatusUseCase.
  2. Data Layer:
    • Added AppOpenLocalDataSource and AppOpenRepositoryImpl for tracking app launch timestamps.
    • Built StreakRepositoryImpl integrating transactions, categories, app opens, and persistent preferences.
    • Implemented CategoryBudgetCalculator for calculating leaf envelope budgets and detecting overrun categories.
    • Extended LocalStorage to persist window, minimum, and cadence settings.
  3. Presentation & Routing:
    • Implemented StreakCubit and StreakConfigCubit for reactive state management.
    • Registered /streaks route in AppRouter.
    • Integrated StreakBadge and StreakCard in HomePage.
    • Added StreakConfigSheet for real-time parameter tuning.
  4. Testing:
    • Added unit tests for entities, period arithmetic, calculators, data sources, and repositories.
    • Added bloc and widget tests for cubits, calendar, cards, badges, sheets, and pages.

Why:

  1. Encourage habit formation and sustained financial tracking engagement by rewarding consistent daily logging, regular app usage, and staying within monthly category budgets.
  2. Provide users with clear visual feedback on streak milestones and monthly consistency without punishing accidental single-day lapses thanks to configurable gap absorption.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Code Checklist

  • Tested: All 344 unit, cubit, and widget tests passing (fvm flutter test).

…atus, and type entities

- Add StreakConfig for configuring streak parameters (window, minimum, cadence).
- Introduce StreakPeriod as an abstract class with StreakDay and StreakMonth implementations for daily and monthly periods.
- Define StreakStatus enum to represent the lifecycle of a streak run.
- Create StreakType enum to categorize different streak types (tracking, no-spend, app-open, under-budget).
- Implement StreakEngine for calculating current and best streaks based on qualifying periods and configuration.
- Add comprehensive tests for StreakPeriod, StreakConfig, StreakStatus, StreakType, and StreakEngine to ensure correct functionality.
…uning sheet

Implement state management and interactive UI for tuning streak parameters:
- Add StreakConfigCubit and StreakConfigState to load, update, and persist streak window, minimum threshold, and cadence settings to LocalStorage with lower-bound clamping.
- Expand StreakConfigSheet with tabbed type navigation, custom steppers, quick cadence presets, and future placeholder cards for no-spend and under-budget streaks.
- Add comprehensive unit and widget test suites for cubit state transitions and bottom sheet interactions.
…bit metrics

- Add GetQualifyingPeriodsUseCase to query qualifying activity periods
- Implement StreakCubit and StreakState to manage monthly streaks, qualifying days, and consistency metrics with reactive transaction watching
- Build StreaksPage with Bento-style StreakHero, StreakCalendar, StreakConsistencyCard, and MilestoneProgress widgets
- Update AppRouter and test suites for streak navigation and UI interactions
- Added UnderBudget streak type handling in StreakRepositoryImpl.
- Implemented tests for UnderBudget streak scenarios, including tracking and status checks.
- Updated StreakCubit to manage UnderBudget status and integrate with the UI.
- Enhanced StreaksPage to display UnderBudget information and overrun flags.
- Added widget tests for UnderBudgetMonthCard and StreakCard to ensure correct rendering of budget-related information.
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