Skip to content

Epic: Notification Management System - #71

Merged
javikin merged 20 commits into
mainfrom
epic/notification-management
Jan 8, 2026
Merged

Epic: Notification Management System#71
javikin merged 20 commits into
mainfrom
epic/notification-management

Conversation

@javikin

@javikin javikin commented Jan 8, 2026

Copy link
Copy Markdown
Owner

Summary

Implementa un sistema completo de gestión de notificaciones que intercepta, almacena y resume las notificaciones de apps bloqueadas durante sesiones de enfoque activas.

Features Principales

  • Interceptación de Notificaciones: UmbralNotificationService captura notificaciones de apps bloqueadas
  • Whitelist Inteligente: Permite llamadas, SMS, alarmas, apps bancarias y 2FA
  • Persistencia: Room Database para notificaciones bloqueadas con relación a sesiones
  • UI Completa:
    • SessionSummaryDialog al terminar sesión
    • NotificationHistoryScreen con filtros y swipe-to-delete
  • Gamificación:
    • +1 energía por cada 5 notificaciones bloqueadas
    • 3 nuevos logros: Escudo Mental (100), Fortaleza (500), Inmune (1000)
    • Stats de notificaciones en pantalla de estadísticas

Issues Resueltos

Arquitectura

notifications/
├── data/
│   ├── local/
│   │   ├── BlockedNotificationDao.kt
│   │   └── BlockedNotificationEntity.kt
│   ├── preferences/
│   │   └── NotificationPreferences.kt
│   └── repository/
│       └── NotificationRepositoryImpl.kt
├── domain/
│   ├── model/
│   │   ├── BlockedNotification.kt
│   │   ├── NotificationSummary.kt
│   │   └── NotificationStats.kt
│   ├── repository/
│   │   └── NotificationRepository.kt
│   └── usecase/
│       ├── SaveBlockedNotificationUseCase.kt
│       ├── GetNotificationSummaryUseCase.kt
│       ├── GetNotificationHistoryUseCase.kt
│       ├── ClearOldNotificationsUseCase.kt
│       └── GrantNotificationRewardsUseCase.kt
├── presentation/
│   ├── history/
│   │   ├── NotificationHistoryScreen.kt
│   │   ├── NotificationHistoryViewModel.kt
│   │   └── components/
│   └── summary/
│       ├── SessionSummaryDialog.kt
│       └── SessionSummaryViewModel.kt
└── service/
    └── UmbralNotificationService.kt

Test plan

  • Verificar que el servicio de notificaciones se puede habilitar en Settings
  • Iniciar sesión de bloqueo con apps que envían notificaciones
  • Verificar que notificaciones de apps bloqueadas se interceptan
  • Verificar que whitelist permite llamadas y SMS
  • Terminar sesión y verificar SessionSummaryDialog
  • Verificar historial de notificaciones con filtros
  • Verificar stats de notificaciones en StatsScreen
  • Verificar que achievements se desbloquean correctamente

javikin added 20 commits January 6, 2026 13:11
Issues completados: #48, #49, #50, #51 (Epic #47)

Cambios principales:
- Fix FAB duplicado en TagsScreen (#48)
  Solo mostrar FAB cuando hay tags existentes

- Stats Card con datos reales (#49)
  Conectar StatsPreviewCard a StatsRepository
  Agregar empty state cuando no hay datos

- Simplificar onboarding (#50)
  Remover paso de selección de apps (redundante)
  Ajustar SuccessScreen con nuevo mensaje
  Agregar completeOnboardingSimple() al ViewModel

- FirstProfilePromptCard en HomeScreen (#51)
  Mostrar card prominente para crear primer perfil
  Agregar hasProfiles al HomeUiState
  Navegar a crear perfil desde el card

También:
- Archivar epic advanced-features completado
- Agregar PRD y Epic para ux-polish-v1
- PRD con scope MVP+ (4-5 semanas)
- Epic con 9 tasks (#53-#61)
- Sistema de Compañeros (8 tipos, 3 estados evolución)
- Mapa con Canvas (1 bioma, 15 locaciones)
- 30 logros en 3 categorías
- Integración con BlockingManager existente
- Created 5 Room entities with @ColumnInfo annotations
- Created 5 DAOs with CRUD and specific queries
- Implemented ExpeditionRepository with all operations
- Added business logic for progress, companions, locations, achievements
- All queries use snake_case column names
- Repository includes duplicate prevention and validation logic
…ration

- Created package structure for expedition module
- Added 5 entity classes (Companion, Location, Progress, Achievement, Decoration)
- Created DAO interfaces for all entities
- Implemented Migration_3_4 with 5 new tables
- Updated UmbralDatabase to version 4 with new entities and DAOs
- Added Lottie Compose dependency for animations
- Created ExpeditionModule for Hilt DI configuration
- Updated ExpeditionRepository interface to return Int from unlockAchievement
- Modified ExpeditionRepositoryImpl to return stars earned
- Fixes compilation error in CheckAchievementsUseCase
- Create ForestBiomeData with 15 locations and map positions
- Implement ExpeditionMapViewModel with discovery flow
- Add BiomeMapCanvas with pan/zoom gestures and fog of war
- Create LocationDetailSheet for discovery UI
- Add EnergyChip component for energy display
- Implement ExpeditionMapScreen with full integration
- All UI text in Spanish per project requirements
- Created CompanionAnimationState enum (IDLE, HAPPY, EVOLVING)
- Implemented LottieAnimations registry for animation paths
- Created CompanionAnimation composable with Lottie integration
- Added EvolutionDialog with confirmation and animation views
- Added CaptureSuccessDialog with celebration animation
- Updated CompanionDetailScreen with Lottie animations
- Updated CompanionListScreen to show capture dialog
- Created placeholder Lottie JSON files for all 8 companions
- All UI text in Spanish, code in English
- Smooth transitions between animation states
- Fallback to static icons if Lottie fails
- Add Coil image loading library
- Create ExpeditionAssets helper for centralized asset management
- Create CompanionImage.kt with AsyncImage support
- Create LocationImage.kt with fog overlay support
- Add placeholder vector drawables for companions and locations
- Fix LottieAnimations to use correct CompanionType enums
- Add expedition-related strings to strings.xml
- Replace all hardcoded Spanish strings with string resources
- All UI components now use MaterialTheme consistently
- Add ExpeditionMapScreen, CompanionListScreen, CompanionDetailScreen to navigation
- Add AchievementsScreen to navigation
- Wire up onNavigateToExpedition callback from HomeScreen
- Add navigation routes for all expedition screens
- Complete end-to-end navigation flow
- Add missing imports for translate/scale in BiomeMapCanvas
- Fix navigation parameter names for expedition screens
- Add missing preview parameters in HomeScreen
- Created BlockedNotificationEntity with all required fields
- Created BlockedNotificationDao with CRUD operations
- Added Migration_4_5 to create blocked_notifications table
- Updated UmbralDatabase to version 5
- Added BlockedNotificationDao provider in AppModule
- Added indices for efficient queries on session_id, package_name, and timestamp
- Created UmbralNotificationService extending NotificationListenerService
- Implemented onNotificationPosted() and onNotificationRemoved() callbacks
- Added basic logging for intercepted notifications
- Created NotificationPermissionManager utility for permission checks
- Added NotificationsModule for Hilt dependency injection
- Registered service in AndroidManifest.xml with proper permissions
- Added Spanish strings for notification access permission UI
- Service compiles and builds successfully
- Created domain models: BlockedNotification and NotificationSummary
- Created NotificationMapper for Entity<->Domain conversion
- Implemented NotificationRepository interface and implementation
- Created UseCases: Save, GetSummary, GetHistory, ClearOld
- Updated NotificationsModule to bind repository via Hilt
- All domain models use Instant for type-safe timestamps
- Created SystemWhitelist with hardcoded system apps (calls, SMS, alarms)
- Created NotificationPreferences for user-configurable whitelist via DataStore
- Implemented NotificationWhitelistChecker with priority-based filtering
- Updated UmbralNotificationService to use whitelist checker
- Support for critical notifications: battery low, system alerts
- Multilingual keyword detection for battery notifications
- Created SessionSummaryDialog.kt with Material Design 3 dialog
- Shows notification summary, top 5 apps, and bonus energy
- Animated entrance with staggered animations
- Created SessionSummaryViewModel with Hilt integration
- Loads data using GetNotificationSummaryUseCase
- Calculates bonus energy (+1 per 5 notifications)
- Created SessionSummaryState for UI state management
- Added 3 preview composables for different scenarios
- All UI text in Spanish as per project guidelines
- Follows existing patterns from SessionRewardDialog
…to-delete

- Add NotificationHistoryState with filter options
- Add NotificationHistoryViewModel with filtering logic
- Add InstantExtensions for time formatting
- Add FilterChips component for app/period filtering
- Add SessionHeader component for grouping
- Add NotificationItem with swipe-to-delete and context menu
- Add NotificationHistoryScreen with loading/empty states
- Include comprehensive Preview composables for all components
- All UI text in Spanish as per project requirements
- Add SessionEndedEvent to BlockingManager for session tracking
- Add sessionId to BlockingState for notification correlation
- BlockingManagerImpl emits sessionEndedEvent when sessions end
- UmbralNotificationService observes blockingManager.blockingState
- Service caches current sessionId and blockedApps
- Notifications only blocked during active sessions
- Blocked notifications saved with correct sessionId
- Remove duplicate BlockedNotificationDao provider from NotificationsModule
- Add 3 new notification achievements to AchievementDefinitions:
  - shield_mind (100 notifications) -> 50 stars
  - fortress (500 notifications) -> 100 stars
  - immune (1000 notifications) -> 200 stars
- Add NOTIFICATIONS category to achievements enum
- Add gamification queries to BlockedNotificationDao:
  - getTotalCountFlow, getCountSince, getTopBlockedApps
  - getTopBlockedAppsSince, getDailyBlockedCounts
- Add NotificationStats and AppNotificationStats domain models
- Extend NotificationRepository with gamification methods:
  - getTotalBlockedCountFlow, getCountForSession
  - getTopBlockedApps, getNotificationStats, getCountForLastDays
- Create GrantNotificationRewardsUseCase:
  - Grants +1 energy per 5 notifications blocked in session
  - Updates notification achievement progress
- Update StatsScreen with NotificationStatsCard:
  - Shows total blocked, last 7 days, top apps
- Update StatsViewModel to load notification stats in parallel
- Add Spanish UI strings for notification stats
@javikin
javikin merged commit 6646161 into main Jan 8, 2026
1 of 4 checks passed
@javikin
javikin deleted the epic/notification-management branch January 8, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant