forked from jsnbuchanan/crowd-funder-for-time-pwa
refactor(cursor-rules): restructure rules architecture with meta-rule system
- Reorganize cursor rules into logical domain-based directories - Implement meta-rule system for workflow-specific rule bundling - Move core rules to dedicated /core directory - Consolidate development rules under /development namespace - Add architectural patterns and implementation examples - Create workflow-specific meta-rules for common development tasks - Remove deprecated standalone rule files - Update package dependencies for new rule structure BREAKING CHANGE: Cursor rules file structure has been reorganized Files moved from root rules directory to domain-specific subdirectories
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
---
|
||||
description: when dealing with cameras in the application
|
||||
alwaysApply: false
|
||||
---
|
||||
# Camera Implementation Documentation
|
||||
|
||||
## Overview
|
||||
@@ -10,6 +6,7 @@ This document describes how camera functionality is implemented across the
|
||||
TimeSafari application. The application uses cameras for two main purposes:
|
||||
|
||||
1. QR Code scanning
|
||||
|
||||
2. Photo capture
|
||||
|
||||
## Components
|
||||
@@ -21,17 +18,25 @@ Primary component for QR code scanning in web browsers.
|
||||
**Key Features:**
|
||||
|
||||
- Uses `qrcode-stream` for web-based QR scanning
|
||||
|
||||
- Supports both front and back cameras
|
||||
|
||||
- Provides real-time camera status feedback
|
||||
|
||||
- Implements error handling with user-friendly messages
|
||||
|
||||
- Includes camera switching functionality
|
||||
|
||||
**Camera Access Flow:**
|
||||
|
||||
1. Checks for camera API availability
|
||||
|
||||
2. Enumerates available video devices
|
||||
|
||||
3. Requests camera permissions
|
||||
|
||||
4. Initializes camera stream with preferred settings
|
||||
|
||||
5. Handles various error conditions with specific messages
|
||||
|
||||
### PhotoDialog.vue
|
||||
@@ -41,8 +46,11 @@ Component for photo capture and selection.
|
||||
**Key Features:**
|
||||
|
||||
- Cross-platform photo capture interface
|
||||
|
||||
- Image cropping capabilities
|
||||
|
||||
- File selection fallback
|
||||
|
||||
- Unified interface for different platforms
|
||||
|
||||
## Services
|
||||
@@ -56,8 +64,11 @@ Web-based implementation of QR scanning.
|
||||
**Key Methods:**
|
||||
|
||||
- `checkPermissions()`: Verifies camera permission status
|
||||
|
||||
- `requestPermissions()`: Requests camera access
|
||||
|
||||
- `isSupported()`: Checks for camera API support
|
||||
|
||||
- Handles various error conditions with specific messages
|
||||
|
||||
#### CapacitorQRScanner
|
||||
@@ -67,8 +78,11 @@ Native implementation using Capacitor's MLKit.
|
||||
**Key Features:**
|
||||
|
||||
- Uses `@capacitor-mlkit/barcode-scanning`
|
||||
|
||||
- Supports both front and back cameras
|
||||
|
||||
- Implements permission management
|
||||
|
||||
- Provides continuous scanning capability
|
||||
|
||||
### Platform Services
|
||||
@@ -80,7 +94,9 @@ Web-specific implementation of platform features.
|
||||
**Camera Capabilities:**
|
||||
|
||||
- Uses HTML5 file input with capture attribute
|
||||
|
||||
- Falls back to file selection if camera unavailable
|
||||
|
||||
- Processes captured images for consistent format
|
||||
|
||||
#### CapacitorPlatformService
|
||||
@@ -90,133 +106,58 @@ Native implementation using Capacitor.
|
||||
**Camera Features:**
|
||||
|
||||
- Uses `Camera.getPhoto()` for native camera access
|
||||
|
||||
- Supports image editing
|
||||
|
||||
- Configures high-quality image capture
|
||||
|
||||
- Handles base64 image processing
|
||||
|
||||
#### ElectronPlatformService
|
||||
|
||||
Desktop implementation (currently unimplemented).
|
||||
|
||||
**Status:**
|
||||
---
|
||||
|
||||
- Camera functionality not yet implemented
|
||||
- Planned to use Electron's media APIs
|
||||
**See also**:
|
||||
|
||||
## Platform-Specific Considerations
|
||||
- `.cursor/rules/features/camera_technical.mdc` for
|
||||
|
||||
### iOS
|
||||
detailed technical implementation
|
||||
|
||||
- Requires `NSCameraUsageDescription` in Info.plist
|
||||
- Supports both front and back cameras
|
||||
- Implements proper permission handling
|
||||
- `.cursor/rules/features/camera_platforms.mdc` for platform-specific details
|
||||
|
||||
### Android
|
||||
**Status**: Active camera implementation overview
|
||||
**Priority**: Medium
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: None
|
||||
**Stakeholders**: Development team, Camera feature team
|
||||
|
||||
- Requires camera permissions in manifest
|
||||
- Supports both front and back cameras
|
||||
- Handles permission requests through Capacitor
|
||||
|
||||
### Web
|
||||
|
||||
- Requires HTTPS for camera access
|
||||
- Implements fallback mechanisms
|
||||
- Handles browser compatibility issues
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Common Error Scenarios
|
||||
|
||||
1. No camera found
|
||||
2. Permission denied
|
||||
3. Camera in use by another application
|
||||
4. HTTPS required
|
||||
5. Browser compatibility issues
|
||||
|
||||
### Error Response
|
||||
|
||||
- User-friendly error messages
|
||||
- Troubleshooting tips
|
||||
- Clear instructions for resolution
|
||||
- Platform-specific guidance
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### Permission Management
|
||||
|
||||
- Explicit permission requests
|
||||
- Permission state tracking
|
||||
- Graceful handling of denied permissions
|
||||
|
||||
### Data Handling
|
||||
|
||||
- Secure image processing
|
||||
- Proper cleanup of camera resources
|
||||
- No persistent storage of camera data
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Camera Access
|
||||
|
||||
1. Always check for camera availability
|
||||
2. Request permissions explicitly
|
||||
3. Handle all error conditions
|
||||
4. Provide clear user feedback
|
||||
5. Implement proper cleanup
|
||||
|
||||
### Performance
|
||||
|
||||
1. Optimize camera resolution
|
||||
2. Implement proper resource cleanup
|
||||
3. Handle camera switching efficiently
|
||||
4. Manage memory usage
|
||||
|
||||
### User Experience
|
||||
|
||||
1. Clear status indicators
|
||||
2. Intuitive camera controls
|
||||
3. Helpful error messages
|
||||
4. Smooth camera switching
|
||||
5. Responsive UI feedback
|
||||
|
||||
## Future Improvements
|
||||
|
||||
### Planned Enhancements
|
||||
|
||||
1. Implement Electron camera support
|
||||
2. Add advanced camera features
|
||||
3. Improve error handling
|
||||
4. Enhance user feedback
|
||||
5. Optimize performance
|
||||
|
||||
### Known Issues
|
||||
|
||||
1. Electron camera implementation pending
|
||||
2. Some browser compatibility limitations
|
||||
3. Platform-specific quirks to address
|
||||
|
||||
## Dependencies
|
||||
|
||||
### Key Packages
|
||||
|
||||
- `@capacitor-mlkit/barcode-scanning`
|
||||
- `qrcode-stream`
|
||||
- `vue-picture-cropper`
|
||||
- Platform-specific camera APIs
|
||||
|
||||
## Testing
|
||||
|
||||
### Test Scenarios
|
||||
|
||||
1. Permission handling
|
||||
2. Camera switching
|
||||
3. Error conditions
|
||||
4. Platform compatibility
|
||||
5. Performance metrics
|
||||
|
||||
### Test Environment
|
||||
|
||||
- Multiple browsers
|
||||
- iOS and Android devices
|
||||
|
||||
- Desktop platforms
|
||||
|
||||
- Various network conditions
|
||||
|
||||
## Model Implementation Checklist
|
||||
|
||||
### Before Camera Implementation
|
||||
|
||||
- [ ] **Platform Analysis**: Understand camera requirements across all platforms
|
||||
- [ ] **Feature Planning**: Plan QR scanning and photo capture features
|
||||
- [ ] **Service Planning**: Plan camera service architecture
|
||||
- [ ] **Testing Strategy**: Plan testing across web, mobile, and desktop
|
||||
|
||||
### During Camera Implementation
|
||||
|
||||
- [ ] **Component Development**: Implement QRScannerDialog and PhotoDialog
|
||||
- [ ] **Service Implementation**: Implement platform-specific camera services
|
||||
- [ ] **Permission Handling**: Implement proper camera permission management
|
||||
- [ ] **Error Handling**: Implement graceful error handling for camera failures
|
||||
|
||||
### After Camera Implementation
|
||||
|
||||
- [ ] **Cross-Platform Testing**: Test camera functionality across all platforms
|
||||
- [ ] **Feature Validation**: Verify QR scanning and photo capture work correctly
|
||||
- [ ] **Performance Testing**: Ensure camera performance meets requirements
|
||||
- [ ] **Documentation Update**: Update camera implementation documentation
|
||||
|
||||
225
.cursor/rules/features/camera_platforms.mdc
Normal file
225
.cursor/rules/features/camera_platforms.mdc
Normal file
@@ -0,0 +1,225 @@
|
||||
# Camera Platform-Specific Implementation
|
||||
|
||||
> **Agent role**:
|
||||
Reference this file for platform-specific camera implementation details.
|
||||
|
||||
## Web Platform
|
||||
|
||||
### Implementation Details
|
||||
|
||||
- Uses `getUserMedia` API for camera access
|
||||
|
||||
- Implements fallback to file input if camera unavailable
|
||||
|
||||
- Handles browser compatibility issues
|
||||
|
||||
- Requires HTTPS for camera access
|
||||
|
||||
### Browser Support
|
||||
|
||||
- Chrome: Full support
|
||||
|
||||
- Firefox: Full support
|
||||
|
||||
- Safari: Limited support
|
||||
|
||||
- Edge: Full support
|
||||
|
||||
### Fallback Mechanisms
|
||||
|
||||
1. Camera access via getUserMedia
|
||||
|
||||
2. File input for image upload
|
||||
|
||||
3. Drag and drop support
|
||||
|
||||
4. Clipboard paste support
|
||||
|
||||
## Mobile Platform (Capacitor)
|
||||
|
||||
### iOS Implementation
|
||||
|
||||
- Uses `@capacitor-mlkit/barcode-scanning`
|
||||
|
||||
- Implements proper permission handling
|
||||
|
||||
- Supports both front and back cameras
|
||||
|
||||
- Handles camera switching
|
||||
|
||||
### Android Implementation
|
||||
|
||||
- Uses `@capacitor-mlkit/barcode-scanning`
|
||||
|
||||
- Implements proper permission handling
|
||||
|
||||
- Supports both front and back cameras
|
||||
|
||||
- Handles camera switching
|
||||
|
||||
### Permission Handling
|
||||
|
||||
- Camera permissions requested at runtime
|
||||
|
||||
- Permission state tracked and cached
|
||||
|
||||
- Graceful handling of denied permissions
|
||||
|
||||
- Clear user guidance for enabling permissions
|
||||
|
||||
## Desktop Platform (Electron)
|
||||
|
||||
### Current Status
|
||||
|
||||
- Camera implementation pending
|
||||
|
||||
- Will use platform-specific APIs
|
||||
|
||||
- Requires proper permission handling
|
||||
|
||||
- Will support both built-in and external cameras
|
||||
|
||||
### Planned Implementation
|
||||
|
||||
- Native camera access via Electron
|
||||
|
||||
- Platform-specific camera APIs
|
||||
|
||||
- Proper permission handling
|
||||
|
||||
- Camera switching support
|
||||
|
||||
## Platform Detection
|
||||
|
||||
### Implementation
|
||||
|
||||
- Uses `PlatformServiceFactory` for platform detection
|
||||
|
||||
- Implements platform-specific camera services
|
||||
|
||||
- Handles platform-specific error conditions
|
||||
|
||||
- Provides platform-specific user guidance
|
||||
|
||||
### Service Selection
|
||||
|
||||
- Web: `WebPlatformService`
|
||||
|
||||
- Mobile: `CapacitorPlatformService`
|
||||
|
||||
- Desktop: `ElectronPlatformService`
|
||||
|
||||
## Cross-Platform Compatibility
|
||||
|
||||
### Common Interface
|
||||
|
||||
- Unified camera service interface
|
||||
|
||||
- Platform-specific implementations
|
||||
|
||||
- Consistent error handling
|
||||
|
||||
- Unified user experience
|
||||
|
||||
### Feature Parity
|
||||
|
||||
- Core camera functionality across platforms
|
||||
|
||||
- Platform-specific optimizations
|
||||
|
||||
- Consistent user interface
|
||||
|
||||
- Unified error messages
|
||||
|
||||
## Platform-Specific Features
|
||||
|
||||
### Web
|
||||
|
||||
- Browser-based camera access
|
||||
|
||||
- File upload fallback
|
||||
|
||||
- Drag and drop support
|
||||
|
||||
- Clipboard paste support
|
||||
|
||||
### Mobile
|
||||
|
||||
- Native camera access
|
||||
|
||||
- Barcode scanning
|
||||
|
||||
- Photo capture
|
||||
|
||||
- Camera switching
|
||||
|
||||
### Desktop
|
||||
|
||||
- Native camera access (planned)
|
||||
|
||||
- External camera support (planned)
|
||||
|
||||
- Advanced camera controls (planned)
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Platform Coverage
|
||||
|
||||
- Web: Multiple browsers
|
||||
|
||||
- Mobile: iOS and Android devices
|
||||
|
||||
- Desktop: Windows, macOS, Linux
|
||||
|
||||
### Test Scenarios
|
||||
|
||||
- Permission handling
|
||||
|
||||
- Camera access
|
||||
|
||||
- Error conditions
|
||||
|
||||
- Platform compatibility
|
||||
|
||||
- Performance metrics
|
||||
|
||||
---
|
||||
|
||||
**See also**:
|
||||
|
||||
- `.cursor/rules/features/camera-implementation.mdc` for
|
||||
|
||||
core implementation overview
|
||||
|
||||
- `.cursor/rules/features/camera_technical.mdc` for
|
||||
|
||||
technical implementation details
|
||||
|
||||
**Status**: Active platform-specific implementation guide
|
||||
**Priority**: Medium
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: camera-implementation.mdc
|
||||
**Stakeholders**: Development team, Platform team
|
||||
|
||||
## Model Implementation Checklist
|
||||
|
||||
### Before Camera Platform Implementation
|
||||
|
||||
- [ ] **Platform Analysis**: Identify target platforms and their camera capabilities
|
||||
- [ ] **Feature Planning**: Plan platform-specific camera features
|
||||
- [ ] **Integration Planning**: Plan integration with existing camera systems
|
||||
- [ ] **Testing Strategy**: Plan testing across all target platforms
|
||||
|
||||
### During Camera Platform Implementation
|
||||
|
||||
- [ ] **Platform Services**: Implement platform-specific camera functionality
|
||||
- [ ] **Feature Development**: Implement planned camera features for each platform
|
||||
- [ ] **Integration**: Integrate with existing camera infrastructure
|
||||
- [ ] **Performance Optimization**: Optimize camera performance for each platform
|
||||
|
||||
### After Camera Platform Implementation
|
||||
|
||||
- [ ] **Cross-Platform Testing**: Test camera functionality across all platforms
|
||||
- [ ] **Feature Validation**: Verify all planned features work correctly
|
||||
- [ ] **Performance Testing**: Ensure camera performance meets requirements
|
||||
- [ ] **Documentation Update**: Update platform-specific camera documentation
|
||||
203
.cursor/rules/features/camera_technical.mdc
Normal file
203
.cursor/rules/features/camera_technical.mdc
Normal file
@@ -0,0 +1,203 @@
|
||||
# Camera Technical Implementation — Details and Best Practices
|
||||
|
||||
> **Agent role**: Reference this file for
|
||||
detailed technical implementation when working with camera features.
|
||||
|
||||
## Platform-Specific Considerations
|
||||
|
||||
### iOS
|
||||
|
||||
- Requires `NSCameraUsageDescription` in Info.plist
|
||||
|
||||
- Supports both front and back cameras
|
||||
|
||||
- Implements proper permission handling
|
||||
|
||||
### Android
|
||||
|
||||
- Requires camera permissions in manifest
|
||||
|
||||
- Supports both front and back cameras
|
||||
|
||||
- Handles permission requests through Capacitor
|
||||
|
||||
### Web
|
||||
|
||||
- Requires HTTPS for camera access
|
||||
|
||||
- Implements fallback mechanisms
|
||||
|
||||
- Handles browser compatibility issues
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Common Error Scenarios
|
||||
|
||||
1. No camera found
|
||||
|
||||
2. Permission denied
|
||||
|
||||
3. Camera in use by another application
|
||||
|
||||
4. HTTPS required
|
||||
|
||||
5. Browser compatibility issues
|
||||
|
||||
### Error Response
|
||||
|
||||
- User-friendly error messages
|
||||
|
||||
- Troubleshooting tips
|
||||
|
||||
- Clear instructions for resolution
|
||||
|
||||
- Platform-specific guidance
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### Permission Management
|
||||
|
||||
- Explicit permission requests
|
||||
|
||||
- Permission state tracking
|
||||
|
||||
- Graceful handling of denied permissions
|
||||
|
||||
### Data Handling
|
||||
|
||||
- Secure image processing
|
||||
|
||||
- Proper cleanup of camera resources
|
||||
|
||||
- No persistent storage of camera data
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Camera Access
|
||||
|
||||
1. Always check for camera availability
|
||||
|
||||
2. Request permissions explicitly
|
||||
|
||||
3. Handle all error conditions
|
||||
|
||||
4. Provide clear user feedback
|
||||
|
||||
5. Implement proper cleanup
|
||||
|
||||
### Performance
|
||||
|
||||
1. Optimize camera resolution
|
||||
|
||||
2. Implement proper resource cleanup
|
||||
|
||||
3. Handle camera switching efficiently
|
||||
|
||||
4. Manage memory usage
|
||||
|
||||
### User Experience
|
||||
|
||||
1. Clear status indicators
|
||||
|
||||
2. Intuitive camera controls
|
||||
|
||||
3. Helpful error messages
|
||||
|
||||
4. Smooth camera switching
|
||||
|
||||
5. Responsive UI feedback
|
||||
|
||||
## Future Improvements
|
||||
|
||||
### Planned Enhancements
|
||||
|
||||
1. Implement Electron camera support
|
||||
|
||||
2. Add advanced camera features
|
||||
|
||||
3. Improve error handling
|
||||
|
||||
4. Enhance user feedback
|
||||
|
||||
5. Optimize performance
|
||||
|
||||
### Known Issues
|
||||
|
||||
1. Electron camera implementation pending
|
||||
|
||||
2. Some browser compatibility limitations
|
||||
|
||||
3. Platform-specific quirks to address
|
||||
|
||||
## Dependencies
|
||||
|
||||
### Key Packages
|
||||
|
||||
- `@capacitor-mlkit/barcode-scanning`
|
||||
|
||||
- `qrcode-stream`
|
||||
|
||||
- `vue-picture-cropper`
|
||||
|
||||
- Platform-specific camera APIs
|
||||
|
||||
## Testing
|
||||
|
||||
### Test Scenarios
|
||||
|
||||
1. Permission handling
|
||||
|
||||
2. Camera switching
|
||||
|
||||
3. Error conditions
|
||||
|
||||
4. Platform compatibility
|
||||
|
||||
5. Performance metrics
|
||||
|
||||
### Test Environment
|
||||
|
||||
- Multiple browsers
|
||||
|
||||
- iOS and Android devices
|
||||
|
||||
- Desktop platforms
|
||||
|
||||
---
|
||||
|
||||
**See also**:
|
||||
|
||||
- `.cursor/rules/features/camera-implementation.mdc` for
|
||||
|
||||
core implementation overview
|
||||
|
||||
- `.cursor/rules/features/camera_platforms.mdc` for platform-specific details
|
||||
|
||||
**Status**: Active technical implementation guide
|
||||
**Priority**: Medium
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: camera-implementation.mdc
|
||||
**Stakeholders**: Development team, Camera feature team
|
||||
|
||||
## Model Implementation Checklist
|
||||
|
||||
### Before Camera Implementation
|
||||
|
||||
- [ ] **Platform Analysis**: Identify target platforms and camera capabilities
|
||||
- [ ] **Permission Planning**: Plan permission handling for camera access
|
||||
- [ ] **Dependency Review**: Review required camera packages and APIs
|
||||
- [ ] **Testing Strategy**: Plan testing across multiple platforms
|
||||
|
||||
### During Camera Implementation
|
||||
|
||||
- [ ] **Platform Services**: Implement platform-specific camera services
|
||||
- [ ] **Permission Handling**: Implement proper camera permission handling
|
||||
- [ ] **Error Handling**: Implement graceful error handling for camera failures
|
||||
- [ ] **Performance Optimization**: Optimize camera performance and responsiveness
|
||||
|
||||
### After Camera Implementation
|
||||
|
||||
- [ ] **Cross-Platform Testing**: Test camera functionality across all platforms
|
||||
- [ ] **Permission Testing**: Test permission handling and user feedback
|
||||
- [ ] **Performance Validation**: Verify camera performance meets requirements
|
||||
- [ ] **Documentation Update**: Update camera technical documentation
|
||||
Reference in New Issue
Block a user