Skip to content

Implement Activity Feed with Habit Streak Tracking#37

Open
AlexGladkov wants to merge 4 commits into
mainfrom
feature/activity-feed-3114dd8c
Open

Implement Activity Feed with Habit Streak Tracking#37
AlexGladkov wants to merge 4 commits into
mainfrom
feature/activity-feed-3114dd8c

Conversation

@AlexGladkov

Copy link
Copy Markdown
Owner

Summary

  • Implemented Activity Feed feature that displays user's recent habit activities
  • Added streak tracking functionality that calculates and displays current streaks for each habit
  • Created comprehensive specification document for the Activity Feed feature
  • Fixed code quality issues including proper null safety and error handling

Key Features

  • Activity list showing recent habit completions with timestamps
  • Streak counter display for each habit
  • Proper state management with Kotlin Flow
  • Error handling and loading states
  • Follows existing project architecture patterns

Test Plan

  • Code compiles without errors
  • All code quality checks pass
  • Follows project architecture patterns
  • Manual testing of Activity Feed UI
  • Testing streak calculation logic
  • Testing with different habit completion scenarios

🤖 Generated with Claude Code

claude and others added 4 commits January 31, 2026 15:03
Defines requirements for habit streak tracking in a new Activity Feed tab,
including streak calculation logic, data model, and integration points.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit implements the Activity Feed feature as specified in
SPEC_activity_feed.md. The feature displays habit streak milestones
and streak-broken notifications in a dedicated bottom navigation tab.

## Data Layer
- Created ActivityFeedEntity with streak tracking fields
- Created ActivityFeedDao for database operations
- Added ActivityFeedType enum (STREAK_INCREMENT, STREAK_BROKEN)
- Implemented database migration from v8 to v9
- Updated AppDatabase and platform-specific builders

## Domain Layer
- CalculateStreakUseCase: Calculates streaks by counting consecutive
  scheduled days
- GetActivityFeedUseCase: Retrieves feed entries with pagination
- DetectBrokenStreaksUseCase: Detects and records broken streaks
- RecordStreakEventUseCase: Records streak events on habit completion

## Presentation Layer
- ActivityFeedViewModel with state/event/action pattern
- ActivityFeedViewState with loading and empty states
- Reactive feed updates using Flow

## UI Layer
- ActivityFeedScreen with LazyColumn for feed items
- ActivityFeedItemView with visual distinction for streak types
- Proper theming consistent with app design

## Integration
- Created FeedModule for dependency injection
- Hooked RecordStreakEventUseCase into SwitchHabitUseCase
- Hooked RecordStreakEventUseCase into UpdateTrackerValueUseCase
- Added Activity Feed tab to bottom navigation
- Updated navigation graph with ActivityFeedScreen route

The feature supports both REGULAR and TRACKER habit types, correctly
calculates streaks based on scheduled days only, and persists all
feed entries in the database.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Replace manual service location with proper dependency injection
  Use constructor injection for RecordStreakEventUseCase in
  SwitchHabitUseCase and UpdateTrackerValueUseCase instead of
  calling Inject.instance<>() directly

- Replace hardcoded string with string resource
  Use stringResource(Res.string.title_activity_feed) instead of
  hardcoded "Activity Feed" text in ActivityFeedScreen

- Remove redundant feed loading
  Remove LaunchedEffect that dispatches LoadFeed event, as the
  ViewModel already loads the feed in init block via
  detectBrokenStreaksAndLoadFeed() and observeFeedUpdates()

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.

2 participants