Skip to content

Add habit achievement sharing feature#31

Open
AlexGladkov wants to merge 4 commits into
mainfrom
feature/share-screen-f24a074c
Open

Add habit achievement sharing feature#31
AlexGladkov wants to merge 4 commits into
mainfrom
feature/share-screen-f24a074c

Conversation

@AlexGladkov

Copy link
Copy Markdown
Owner

Summary

  • Implemented a new share screen feature that allows users to share their habit achievements
  • Users can select top habits based on completion percentage, current streak, or total completions
  • Share functionality generates a visual card with habit statistics
  • Platform-specific implementations for Android, iOS, and Desktop (JVM)

Key Changes

  • Share Screen UI: New SharePreviewScreen with habit selection and preview card
  • Share Module: Complete DI module with use cases for calculating streaks and selecting top habits
  • Platform Services: ShareService implementations for all platforms (Android uses FileProvider, iOS uses UIActivityViewController)
  • Statistics Integration: Added share button to StatisticsScreen
  • Comprehensive Specs: Full feature specification with fallback documentation

Technical Details

  • Android: Uses FileProvider to share bitmap images
  • iOS: Uses UIActivityViewController for native sharing
  • Desktop: Placeholder implementation for future development
  • ViewModels follow MVVM pattern with proper state management
  • Use cases handle business logic for streak calculation and habit ranking

🤖 Generated with Claude Code

claude and others added 4 commits January 29, 2026 19:31
Defines requirements for sharing habit achievements as a visual image card
from the Statistics screen on Android and iOS platforms.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add complete share functionality allowing users to share their top 5 habit
achievements as a visual branded card on Android and iOS platforms.

Key components:
- Domain layer: CalculateStreaksUseCase computes consecutive completion days,
  GetTopHabitsForSharingUseCase selects top 5 habits by streak
- Presentation layer: ShareViewModel manages state and preview lifecycle
- UI layer: ShareCardContent renders branded card, SharePreviewScreen provides
  preview dialog before sharing
- Platform layer: expect/actual ShareService for Android (bitmap + Intent),
  iOS (placeholder for UIImage), and JVM (no-op)
- Statistics screen enhanced with floating share button (mobile only)
- FileProvider configured in AndroidManifest for secure image sharing

The share card displays habit title, current streak, and completion rate in a
fixed dark-themed design with JetHabit branding, independent of app theme.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fix incorrect dayOfWeek mapping comments (0=Monday, not Sunday)
- Fix resource leak in Android ShareService using .use {} for FileOutputStream

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