Implement Activity Feed with Habit Streak Tracking#37
Open
AlexGladkov wants to merge 4 commits into
Open
Conversation
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>
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
Key Features
Test Plan
🤖 Generated with Claude Code