This commit updates the Electron preload script and type definitions to improve
SQLite integration and IPC communication. The changes include:
- Enhanced preload script (electron/src/preload.ts):
* Added detailed logging for SQLite operations and IPC communication
* Implemented retry logic for SQLite operations (3 attempts, 1s delay)
* Added proper type definitions for SQLite connection options
* Defined strict channel validation for IPC communication
* Improved error handling and logging throughout
- Updated type definitions (src/types/electron.d.ts):
* Aligned ElectronAPI interface with actual implementation
* Added proper typing for all SQLite operations
* Added environment variables (platform, isDev)
* Structured IPC renderer interface with proper method signatures
Current Status:
- Preload script initializes successfully
- SQLite availability check works (returns true)
- SQLite ready signal is properly received
- Database operations are failing with two types of errors:
1. "CapacitorSQLite not available" during initialization
2. "Cannot read properties of undefined" for SQLite methods
Next Steps:
- Verify context bridge exposure in renderer process
- Check main process SQLite handlers
- Debug database initialization
- Address Content Security Policy warning
Affected Files:
- Modified: electron/src/preload.ts
- Modified: src/types/electron.d.ts
Note: This is a transitional commit. While the preload script and type
definitions are now properly structured, database operations are not yet
functional. Further debugging and fixes are required to resolve the
SQLite integration issues.
- Add camera state tracking and listener management
- Implement addCameraStateListener and removeCameraStateListener methods
- Add state transitions during scanning operations
- Improve error handling with state updates
- Add proper type imports for CameraState and CameraStateListener
This change ensures CapacitorQRScanner fully implements the QRScannerService
interface and provides proper camera state feedback to consumers. Camera state
is now tracked through the entire lifecycle of scanning operations, with
appropriate state transitions for initialization, active scanning, errors,
and cleanup.
- Enhance electron build configuration with proper asset handling
- Add comprehensive logging and error tracking
- Implement CSP headers for security
- Fix module exports for logger compatibility
- Update TypeScript and Vite configs for better build support
- Improve development workflow with better dev tools integration