android-file-save #173

Open
anomalist wants to merge 3 commits from android-file-save into master
anomalist commented 2 days ago
Owner

Overview

This PR enhances the data export functionality by adding dual export options (share vs. save to device) and improves Android file handling capabilities. It also includes configuration improvements for console statement whitelisting.

Key Changes

�� New Features

  • Dual Export Options: Users can now choose between sharing contacts (system share dialog) or saving directly to device storage
  • Android File Handling: Enhanced platform service with saveToDevice() and saveAs() methods for better Android compatibility
  • Improved UX: Clear instructions for different export methods with platform-specific guidance

🔧 Platform Service Enhancements

  • Added saveToDevice() method for direct device storage (Downloads folder on Android, Documents on iOS)
  • Added saveAs() method for user-chosen file locations using Storage Access Framework
  • Enhanced error handling and user feedback for export operations

⚙️ Configuration Improvements

  • Console Statement Whitelisting: Added comprehensive whitelist configuration for intentional console statements
  • Debug Checker Enhancement: Updated pre-commit hook to respect whitelisted files for console pattern checks
  • Platform-Specific Logging: Whitelisted platform services and utilities for proper debugging

�� UI/UX Improvements

  • Visual Distinction: Different button colors for share (green) vs. save (purple) actions
  • Clear Instructions: Platform-specific guidance for each export method
  • Better Feedback: Enhanced success/error messages with actionable information

Technical Details

File Whitelist Configuration

# Files whitelisted for console statements
WHITELIST_FILES=(
    "src/services/platforms/WebPlatformService.ts"      # Worker context logging
    "src/services/platforms/CapacitorPlatformService.ts" # Platform-specific logging
    "src/services/platforms/ElectronPlatformService.ts"  # Electron-specific logging
    "src/services/QRScanner/.*"                         # QR Scanner services
    "src/utils/logger.ts"                               # Logger utility itself
    "src/utils/LogCollector.ts"                         # Log collection utilities
    "scripts/.*"                                        # Build and utility scripts
    "test-.*/.*"                                        # Test directories
    ".*\.test\..*"                                      # Test files
    ".*\.spec\..*"                                      # Spec files
)

Platform Service Interface

interface PlatformService {
  // Existing methods...
  saveToDevice(fileName: string, content: string): Promise<void>;
  saveAs(fileName: string, content: string): Promise<void>;
}

Testing

  • Export functionality works on all platforms (Web, Capacitor, Electron)
  • Console statement whitelisting properly excludes whitelisted files from debug checks
  • Platform-specific export methods function correctly
  • Error handling provides clear user feedback
  • UI updates display correctly with proper styling

Breaking Changes

None - all changes are additive and backward compatible.

Security Considerations

  • File content validation before saving
  • MIME type verification for file operations
  • Proper permission handling for storage access
  • Error logging without sensitive data exposure

Documentation

  • Added comprehensive Android File Saver Plugin implementation guide
  • Updated git hooks documentation for whitelist configuration
  • Enhanced component documentation with new methods
  • Improves Android file handling capabilities
  • Resolves console statement linting issues for platform services
  • Enhances user experience for data export operations
## Overview This PR enhances the data export functionality by adding dual export options (share vs. save to device) and improves Android file handling capabilities. It also includes configuration improvements for console statement whitelisting. ## Key Changes ### �� New Features - **Dual Export Options**: Users can now choose between sharing contacts (system share dialog) or saving directly to device storage - **Android File Handling**: Enhanced platform service with `saveToDevice()` and `saveAs()` methods for better Android compatibility - **Improved UX**: Clear instructions for different export methods with platform-specific guidance ### 🔧 Platform Service Enhancements - Added `saveToDevice()` method for direct device storage (Downloads folder on Android, Documents on iOS) - Added `saveAs()` method for user-chosen file locations using Storage Access Framework - Enhanced error handling and user feedback for export operations ### ⚙️ Configuration Improvements - **Console Statement Whitelisting**: Added comprehensive whitelist configuration for intentional console statements - **Debug Checker Enhancement**: Updated pre-commit hook to respect whitelisted files for console pattern checks - **Platform-Specific Logging**: Whitelisted platform services and utilities for proper debugging ### �� UI/UX Improvements - **Visual Distinction**: Different button colors for share (green) vs. save (purple) actions - **Clear Instructions**: Platform-specific guidance for each export method - **Better Feedback**: Enhanced success/error messages with actionable information ## Technical Details ### File Whitelist Configuration ```bash # Files whitelisted for console statements WHITELIST_FILES=( "src/services/platforms/WebPlatformService.ts" # Worker context logging "src/services/platforms/CapacitorPlatformService.ts" # Platform-specific logging "src/services/platforms/ElectronPlatformService.ts" # Electron-specific logging "src/services/QRScanner/.*" # QR Scanner services "src/utils/logger.ts" # Logger utility itself "src/utils/LogCollector.ts" # Log collection utilities "scripts/.*" # Build and utility scripts "test-.*/.*" # Test directories ".*\.test\..*" # Test files ".*\.spec\..*" # Spec files ) ``` ### Platform Service Interface ```typescript interface PlatformService { // Existing methods... saveToDevice(fileName: string, content: string): Promise<void>; saveAs(fileName: string, content: string): Promise<void>; } ``` ## Testing - [x] Export functionality works on all platforms (Web, Capacitor, Electron) - [x] Console statement whitelisting properly excludes whitelisted files from debug checks - [x] Platform-specific export methods function correctly - [x] Error handling provides clear user feedback - [x] UI updates display correctly with proper styling ## Breaking Changes None - all changes are additive and backward compatible. ## Security Considerations - File content validation before saving - MIME type verification for file operations - Proper permission handling for storage access - Error logging without sensitive data exposure ## Documentation - Added comprehensive Android File Saver Plugin implementation guide - Updated git hooks documentation for whitelist configuration - Enhanced component documentation with new methods ## Related Issues - Improves Android file handling capabilities - Resolves console statement linting issues for platform services - Enhances user experience for data export operations
anomalist added 2 commits 2 days ago
b735aac1fc feat(platform): implement dual-flow file sharing with Save to Device option
6b1937e37b feat(git-hooks): enhance pre-commit hook with whitelist support for console statements
anomalist added 1 commit 2 days ago
a9b3f6dfab feat(export): implement unique filename generation with device identification
This pull request has changes conflicting with the target branch.
scripts/git-hooks/debug-checker.config
scripts/git-hooks/pre-commit
src/views/AccountViewView.vue
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.