Add share habit streak feature#38
Open
AlexGladkov wants to merge 4 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the ability for users to share their current habit streak as a styled image card via the OS share sheet. This implementation includes: Domain & State: - Add currentStreak field to HabitStatistics model - Implement strict streak calculation (counting backward from today) - Create StreakData model for share card data UI Components: - Add ShareStreakCard composable (1080x566px, theme-aware design) - Add ShareStreakDialog preview dialog with Share/Cancel actions - Update StatisticsItem to show streak count and share button - Wire share flow in StatisticsScreen with bitmap rendering Platform Integration: - Create expect/actual ShareImage interface for platform-specific sharing - Android: FileProvider-based sharing with Intent.ACTION_SEND - iOS: UIActivityViewController integration (stub) - macOS: NSSharingServicePicker integration (stub) - Desktop JVM: File save dialog implementation Configuration: - Add FileProvider to Android manifest - Create file_paths.xml for cache directory sharing The share button is only visible when currentStreak > 0. Tapping it shows a preview dialog, and confirming renders the card to bitmap and opens the native share sheet. Note: Composable-to-bitmap rendering is platform-specific and may need further refinement for iOS/macOS/JVM platforms. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fix tracker habit completion rate calculation (use actual tracked days count instead of hardcoded 30) - Add cache cleanup for old streak images in Android to prevent storage bloat - Fix ShareStreakCard layout to properly use weighted spacers - Replace Surface with Scaffold in StatisticsScreen to enable snackbar display - Add TODO comments in iOS implementation noting incomplete bitmap conversion 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 Changes
Test Plan
🤖 Generated with Claude Code