Commit Graph

31 Commits

Author SHA1 Message Date
Matthew Raymer
333c435b89 fix(android): resolve prefetch scheduling and permission callback issues
- Add null safety check to permission callback to prevent NPE
- Fix fetch time calculation bug that caused double subtraction
  - scheduleFetch() now accepts pre-calculated fetchTime directly
  - Calculate scheduledTime back from fetchTime for worker data
- Add structured logging (DN|FETCH_SCHEDULING) for better traceability

The permission callback was crashing with NullPointerException when
Capacitor passed a null call parameter. The prefetch scheduling had a
logic error where fetchTime was calculated twice - once in the plugin
and once in the fetcher, causing 10-minute delays instead of 5-minute.

Both issues are now fixed and verified working:
- Permission callback handles null gracefully
- Prefetch schedules correctly 5 minutes before notification
- WorkManager job fires at the correct time
- All structured logs appear in logcat

Closes prefetch scheduling investigation.
2025-10-28 09:35:33 +00:00
Matthew Raymer
b724eb716f fix(test-app): add ESLint suppressions for console statements
- Add eslint-disable-next-line no-console comments for development console statements
- Resolve all linting warnings in test-user-zero.ts and router/index.ts
- Maintain clean code quality while allowing debugging output
2025-10-27 11:34:26 +00:00
Matthew Raymer
66987093f7 feat(android): add fetch scheduling debug logs and triggerImmediateFetch API
- Add DN|SCHEDULE_CALLBACK logs to diagnose fetch scheduling
- Add DN|SCHEDULE_FETCH_* structured logs for traceability
- Add triggerImmediateFetch() public API for standalone fetches
- Update fetch timing from 1 hour to 5 minutes before notification
- Fix TypeScript lint errors: add return types, replace any types
- Fix ESLint warnings: add console suppression comments
- Fix capacitor.settings.gradle plugin path reference
- Update android-app-improvement-plan.md with current state

Changes:
- DailyNotificationPlugin: Added scheduled callback logging and fetch method
- DailyNotificationFetcher: Changed lead time from 1 hour to 5 minutes
- EnhancedDailyNotificationFetcher: Added ENH|* structured event IDs
- TypeScript services: Fixed lint errors and added proper types
- Test app: Fixed capacitor settings path and TypeScript warnings
2025-10-27 10:14:00 +00:00
Matthew Raymer
14287824dc feat(test-app): implement User Zero stars querying with 5-minute fetch timing
- Add comprehensive User Zero configuration based on TimeSafari crowd-master
- Implement stars querying API client with JWT authentication
- Create UserZeroView testing interface with mock mode toggle
- Add 5-minute fetch timing configuration for notification scheduling
- Include comprehensive documentation and TypeScript type safety
- Fix readonly array and property access issues
- Add proper ESLint suppressions for console statements

Files added:
- docs/user-zero-stars-implementation.md: Complete technical documentation
- src/config/test-user-zero.ts: User Zero configuration and API client
- src/views/UserZeroView.vue: Testing interface for stars querying

Files modified:
- capacitor.config.ts: Added TimeSafari integration configuration
- src/components/layout/AppHeader.vue: Added User Zero navigation tab
- src/router/index.ts: Added User Zero route
- src/lib/error-handling.ts: Updated type safety

Features:
- Stars querying with TimeSafari API integration
- JWT-based authentication matching crowd-master patterns
- Mock testing system for offline development
- 5-minute fetch timing before notification delivery
- Comprehensive testing interface with results display
- Type-safe implementation with proper error handling
2025-10-24 13:01:50 +00:00
Matthew Raymer
be632b2f0e fix: resolve TypeScript and ESLint errors, fix Android build
TypeScript Import Fixes:
- Use type-only imports for interfaces in all lib files
- Fix import statements in schema-validation.ts, error-handling.ts, typed-plugin.ts, diagnostics-export.ts, StatusView.vue

ESLint Error Fixes:
- Replace all 'any' types with proper type annotations
- Use 'unknown' for unvalidated inputs with proper type guards
- Use Record<string, unknown> for object properties
- Add proper type casting for Performance API and Navigator properties
- Fix deprecated Vue filter by replacing type assertion with function

StatusCard Component Fixes:
- Fix prop type mismatch by changing template structure
- Add getStatusType() function for type-safe status conversion
- Add getStatusDescription() function for descriptive text
- Update HomeView.vue to use multiple StatusCard components in grid

Android Build Fix:
- Fix capacitor.settings.gradle plugin path from 'android' to 'android/plugin'
- Resolve Gradle dependency resolution issue
- Enable successful Android APK generation

Key improvements:
- Full type safety with proper TypeScript interfaces
- ESLint compliance with no remaining errors
- Successful web and Android builds
- Better error handling with typed error objects
- Improved developer experience with IntelliSense support
2025-10-24 12:11:13 +00:00
Matthew Raymer
32e84c421f feat: implement comprehensive diagnostics export system
Diagnostics Export Utility (diagnostics-export.ts):
- ComprehensiveDiagnostics interface with detailed system information
- System info: screen resolution, color depth, pixel ratio, viewport size
- Network info: connection type, effective type, downlink, RTT
- Storage info: localStorage, sessionStorage, IndexedDB, WebSQL availability
- Performance metrics: load time, memory usage, connection type
- Browser/WebView info: user agent, language, platform, hardware concurrency
- Error context: error state, messages, timestamps
- Plugin availability and status information

DiagnosticsExporter class:
- collectDiagnostics(): comprehensive data collection
- exportAsJSON(): formatted JSON export
- exportAsCSV(): CSV format for spreadsheet analysis
- copyToClipboard(): clipboard integration with format selection
- Performance timing and memory usage collection
- Storage availability testing
- Network connection detection

StatusView Integration:
- Updated to use comprehensive diagnostics collector
- Enhanced diagnostics display with system information
- Improved error handling and user feedback
- Maintains existing functionality with added depth

Key features:
- Real-time system information collection
- Multiple export formats (JSON, CSV)
- Clipboard integration with user feedback
- Performance metrics and timing
- Comprehensive error context
- Storage and network capability detection

This completes the comprehensive diagnostics export from the implementation plan.
2025-10-24 11:33:32 +00:00
Matthew Raymer
1d8683b39f feat: add comprehensive ProGuard/R8 rules for Capacitor plugins
ProGuard Rules (both android/app and test-app):
- Capacitor Plugin Protection: Keep Capacitor annotations and plugin methods
- DailyNotification Plugin Classes: Protect all plugin classes and methods
- Manager Classes: Keep all *Manager, *Storage, *Receiver classes
- Database Protection: Room database classes, entities, DAOs, migrations
- Error Handling: Keep error and exception classes
- Performance Classes: Keep optimization and performance monitoring classes
- System Classes: Protect Android system classes used by plugin
- Security Classes: Keep network and security-related classes
- Debugging: Preserve debug information and annotations

Key protections:
- @CapacitorPlugin and @PluginMethod annotations
- All com.timesafari.dailynotification.** classes
- Room database classes and migrations
- Android system classes (AlarmManager, NotificationManager, etc.)
- Network and security classes
- Debug attributes and signatures

This ensures the plugin remains functional after minification and prevents
critical classes from being stripped during release builds.
2025-10-24 11:32:26 +00:00
Matthew Raymer
0e8986d3cc feat: implement TypeScript bridge contract and schema validation
Bridge Contract (bridge.ts):
- Complete TypeScript interface definitions for DailyNotification plugin
- Request/Response schemas with proper typing
- Canonical error codes and error info interfaces
- Utility types for status, priority, and permission types

Schema Validation (schema-validation.ts):
- Input validation for schedule requests (time format, length limits)
- Response validation for all plugin methods
- Single joined error messages for UI display
- Canonical error response creation

Error Handling (error-handling.ts):
- Native error mapping to canonical errors
- User-friendly error message creation
- Contextual error logging
- Plugin method error handling

Typed Plugin Wrapper (typed-plugin.ts):
- Type-safe wrapper around native plugin
- Schema validation at JavaScript boundary
- Error handling with proper error mapping
- Response validation and type safety

StatusView Integration:
- Updated to use typed plugin wrapper
- Type-safe status collection
- Proper error handling with user feedback
- Maintains existing functionality with added safety

This completes the TypeScript bridge contract and schema validation from the implementation plan.
2025-10-24 11:29:19 +00:00
Matthew Raymer
0dc68c3fdc feat: implement comprehensive Status Matrix Module
StatusView.vue:
- Complete status matrix with 5 core capabilities (postNotifications, exactAlarm, channelEnabled, batteryOptimizations, canScheduleNow)
- Real-time status collection from plugin methods
- Actionable buttons for fixing issues (Request Permission, Open Settings, etc.)
- Comprehensive diagnostics export with JSON copy-to-clipboard
- Error handling and user feedback
- Responsive design with modern UI

StatusCard.vue:
- Redesigned as individual status item cards
- Color-coded status indicators (success/warning/error/info)
- Action buttons for each status item
- Hover effects and smooth transitions
- Mobile-responsive layout

Features implemented:
- Dynamic plugin import and status collection
- Parallel status checking (notificationStatus, permissions, exactAlarmStatus)
- Action handling for permission requests and settings navigation
- Diagnostics export with app version, platform, timezone, capabilities
- Error display and recovery
- Modern glassmorphism UI design

This completes the Status Matrix Module from the implementation plan.
2025-10-24 11:26:43 +00:00
Matthew Raymer
4a8573ec87 fix(test-app): implement Schedule Notification button functionality
- Replace empty TODO with actual plugin integration
- Add dynamic import of DailyNotification plugin
- Implement proper error handling with try/catch
- Add user feedback via alert dialogs
- Add comprehensive logging for debugging
- Fix TypeScript priority type with 'high' as const
- Successfully schedules notifications with AlarmManager
- Verified alarm appears in dumpsys alarm output

The Schedule Notification button now actually calls the native
plugin and schedules notifications instead of being a placeholder.
2025-10-23 12:51:15 +00:00
Matthew Raymer
6aaeaf7808 fix(android): resolve permission request and status display issues
- Add requestPermissions method alias to fix Vue app compatibility
- Fix permission response format to include both string and boolean values
- Add comprehensive debugging for permission request flow
- Implement permission request throttling to prevent app crashes
- Fix capacitor.settings.gradle plugin path configuration
- Enhance Vue app logging for permission status debugging

Resolves permission dialog not appearing and UI showing incorrect status.
All permission functionality now works end-to-end with proper status updates.
2025-10-23 11:47:55 +00:00
Matthew Raymer
7185c87e93 docs: add comprehensive AAR integration troubleshooting guide
- Add AAR Duplicate Class Issues section to BUILDING.md with step-by-step solutions
- Create dedicated docs/aar-integration-troubleshooting.md with complete troubleshooting guide
- Document project reference approach (recommended) vs AAR-only approach
- Add verification steps, prevention strategies, and best practices
- Update README.md with links to new documentation
- Resolve duplicate class issues through proper project reference configuration

Fixes AAR integration issues that caused build failures due to plugin being
included both as project reference and AAR file simultaneously.
2025-10-23 10:29:32 +00:00
Matthew Raymer
150d297926 fix(capacitor): getting capacitor to build 2025-10-23 09:20:18 +00:00
Matthew Raymer
5abeb0f799 feat(plugin): implement critical notification stack improvements
Critical Priority Improvements (Completed):
- Enhanced exact-time reliability for Doze & Android 12+ with setExactAndAllowWhileIdle
- Implemented DST-safe time calculation using Java 8 Time API to prevent notification drift
- Added comprehensive schema validation with Zod for all notification inputs
- Created Android 13+ permission UX with graceful fallbacks and education dialogs

High Priority Improvements (Completed):
- Implemented work deduplication and idempotence in DailyNotificationWorker
- Added atomic locks and completion tracking to prevent race conditions
- Enhanced error handling and logging throughout the notification pipeline

New Services Added:
- NotificationValidationService: Runtime schema validation with detailed error messages
- NotificationPermissionManager: Comprehensive permission handling with user education

Documentation Added:
- NOTIFICATION_STACK_IMPROVEMENT_PLAN.md: Complete implementation roadmap with checkboxes
- VUE3_NOTIFICATION_IMPLEMENTATION_GUIDE.md: Vue3 integration guide with code examples

This implementation addresses the most critical reliability and user experience issues
identified in the notification stack analysis, providing a solid foundation for
production-ready notification delivery.
2025-10-20 09:08:26 +00:00
Matthew Raymer
3512c58c2f fix(test-app): resolve StatusCard reactivity and improve plugin status detection
- Fix StatusCard component to properly react to prop changes by using computed() instead of ref()
- Improve plugin detection in HomeView using proper ES6 import instead of window object access
- Add comprehensive status mapping from plugin response to app store format
- Add detailed logging for plugin status, permissions, and exact alarm status
- Add separate Permissions status line in system status display
- Enhance error handling and debugging information for plugin operations

This resolves the issue where StatusCard was not updating when plugin status changed,
and improves the overall reliability of plugin detection and status reporting.
2025-10-18 12:33:09 +00:00
Matthew Raymer
982138ee1c fix(test-app): add missing plugin imports for proper registration
- Import @capacitor/core for Capacitor platform detection
- Import @timesafari/daily-notification-plugin for plugin availability
- Resolves "Plugin: Not Available" issue in test app

Plugin now properly registers and becomes available at runtime.
2025-10-17 13:14:53 +00:00
Matthew Raymer
698fc688a0 feat(android): add plugin registration and test app integration
- Add capacitor.plugins.json for main plugin registration
- Add plugin dependency to test app build configuration
- Add local plugin dependency to test app package.json
- Update package-lock.json with plugin dependency resolution

Enables proper plugin discovery and integration in test environment.
2025-10-17 12:58:38 +00:00
Matthew Raymer
1f1153b5fe fix(android): resolve build failures and duplicate plugin dependencies
- Fix plugin path in capacitor.settings.gradle to point to correct npm package location
- Remove duplicate local dailynotification module causing class conflicts
- Remove duplicate plugin dependency from app build.gradle
- Resolves Android SDK configuration and build system issues

Build now succeeds with proper plugin integration from npm package.
2025-10-17 12:57:10 +00:00
Matthew Raymer
9b86a50c38 docs(test-app): add comprehensive plugin detection and build documentation
- Add PLUGIN_DETECTION_GUIDE.md with complete troubleshooting guide
- Add BUILD_QUICK_REFERENCE.md for streamlined build process
- Document critical fix-capacitor-plugins.js requirement after npx cap sync
- Include verification checklists and common issue solutions
- Provide automated build script and debugging tools
- Cover Vue 3 compatibility issues and click event troubleshooting

These docs ensure reliable plugin detection and prevent the common
issue where npx cap sync overwrites capacitor.plugins.json.
2025-10-17 10:20:55 +00:00
Matthew Raymer
200f85a1fb fix(test-app): resolve plugin detection and remove unused HomeViewSimple
- Fix System Status card to show correct plugin availability
- Add automatic status check on component mount
- Remove HomeViewSimple.vue (no longer needed)
- Fix Vue 3 compatibility issues (@click.native removal)
- Add comprehensive plugin diagnostics with all available plugins
- Implement post-sync script to maintain capacitor.plugins.json
- Add annotation processor for automatic plugin discovery

The DailyNotification plugin now loads correctly and both System Status
and Plugin Diagnostics show consistent, accurate information.
2025-10-17 10:13:50 +00:00
Matthew Raymer
64b65f8a94 fix(android): resolve DailyNotification plugin registration issue
- Move plugin registration before super.onCreate() in MainActivity
- Create dedicated dailynotification module for proper plugin structure
- Add comprehensive logging for plugin registration debugging
- Update Vue components with enhanced plugin detection and logging
- Fix TypeScript errors in HomeView.vue for proper build

The plugin was not being loaded because registration happened after
BridgeActivity initialization. Moving registerPlugin() before super.onCreate()
ensures the plugin is available when Capacitor loads plugins.

Resolves simplified status dialog issue by ensuring native plugin
is properly registered and accessible to JavaScript layer.
2025-10-17 08:06:53 +00:00
Matthew Raymer
80a268ffdc feat(test-app): add debug component and optimize build configuration
- Add HomeViewSimple.vue for debugging performance issues
- Configure Vite with decorator support and optimization settings
- Add babelParserPlugins for legacy decorator support
- Optimize dependencies for vue-facing-decorator compatibility

Enables debugging of performance issues and optimizes build process.
2025-10-16 13:07:01 +00:00
Matthew Raymer
29fba0310d refactor(test-app): convert secondary view components to Class API
- Convert HistoryView, NotFoundView, NotificationsView to Class API
- Convert SettingsView and StatusView to Class API
- Add proper @Component decorators and toNative exports
- Simplify all views for consistent Class API usage

Completes view component conversion to vue-facing-decorator pattern.
2025-10-16 13:06:44 +00:00
Matthew Raymer
22a52cc5f0 refactor(test-app): convert main view components to Class API
- Convert HomeView to Class API with simplified navigation methods
- Convert LogsView to Class API with clipboard functionality and proper types
- Convert ScheduleView to Class API with notification scheduling logic
- Add proper TypeScript types for all view data and methods
- Simplify complex logic for better testing and maintainability

Establishes consistent Class API pattern for main application views.
2025-10-16 13:06:33 +00:00
Matthew Raymer
6c21a67088 refactor(test-app): convert dialog and overlay components to Class API
- Convert ErrorDialog to Class API with proper event handling
- Convert LoadingOverlay to Class API with visibility prop
- Add proper @Prop decorators and event emission methods
- Simplify component logic for better maintainability

Completes UI component conversion to vue-facing-decorator pattern.
2025-10-16 13:06:23 +00:00
Matthew Raymer
8c3825363e refactor(test-app): convert UI components to vue-facing-decorator Class API
- Convert ActionCard to Class API with proper @Prop decorators
- Convert StatusCard to Class API with simplified status management
- Convert AppHeader to Class API with navigation item types
- Convert AppFooter to Class API with platform info display
- Add proper TypeScript types for all component props and data

Ensures consistent Class API usage across all UI components.
2025-10-16 13:06:13 +00:00
Matthew Raymer
eb0ca324d7 refactor(test-app): convert core app structure to vue-facing-decorator
- Add reflect-metadata import to main.ts for decorator support
- Convert App.vue to Class API with proper error handling properties
- Simplify router configuration for debugging performance issues
- Remove complex plugin initialization logic for cleaner testing

Establishes foundation for consistent Class API usage across the app.
2025-10-16 13:06:00 +00:00
Matthew Raymer
7805aef198 feat(test-app): configure TypeScript for vue-facing-decorator compatibility
- Add experimentalDecorators and emitDecoratorMetadata to tsconfig.app.json
- Configure useDefineForClassFields: false for proper class field handling
- Add comprehensive type declarations for vue-facing-decorator@3.0.4
- Create global type declarations for Capacitor and DailyNotification plugin
- Add reflect-metadata support for decorator functionality

Enables proper TypeScript support for Class API components.
2025-10-16 13:05:45 +00:00
Matthew Raymer
791a0635ba fix(plugin): resolve package.json export warnings and dependency conflicts
- Reorder exports to put 'types' first for proper TypeScript resolution
- Update @types/node to ^20.19.0 to resolve Vite compatibility
- Align Capacitor dependencies to ^6.2.1 for consistency
- Fix npm install conflicts in test app

Resolves build warnings about unreachable 'types' conditions in exports.
2025-10-16 13:05:34 +00:00
Matthew Raymer
9328bffa68 feat(android): implement plugin diagnostics and fix Vue 3 compatibility
- Add runPluginDiagnostics and openConsole methods to HomeView.vue
- Convert ActionCard.vue from vue-facing-decorator to Composition API
- Enhance App.vue with improved plugin detection and error handling
- Add simplified DailyNotificationPlugin.java with basic methods
- Fix plugin registration in capacitor.plugins.json
- Remove error dialogs, rely on console logging for diagnostics

The Plugin Diagnostics button now provides detailed platform and plugin status information.
2025-10-16 10:33:49 +00:00
Matthew Raymer
1e6c4bf7fc chore: initial commit 2025-10-15 10:46:50 +00:00