chore: linted with auto-fix
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService";
|
||||
import {
|
||||
ImageResult,
|
||||
PlatformService,
|
||||
PlatformCapabilities,
|
||||
} from "../PlatformService";
|
||||
import { Filesystem, Directory } from "@capacitor/filesystem";
|
||||
import { Camera, CameraResultType, CameraSource } from "@capacitor/camera";
|
||||
import { logger } from "../../utils/logger";
|
||||
@@ -22,7 +26,7 @@ export class CapacitorPlatformService implements PlatformService {
|
||||
isMobile: true,
|
||||
isIOS: /iPad|iPhone|iPod/.test(navigator.userAgent),
|
||||
hasFileDownload: false,
|
||||
needsFileHandlingInstructions: true
|
||||
needsFileHandlingInstructions: true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -80,7 +84,9 @@ export class CapacitorPlatformService implements PlatformService {
|
||||
path: directory,
|
||||
directory: Directory.Data,
|
||||
});
|
||||
return result.files.map(file => typeof file === 'string' ? file : file.name);
|
||||
return result.files.map((file) =>
|
||||
typeof file === "string" ? file : file.name,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService";
|
||||
import {
|
||||
ImageResult,
|
||||
PlatformService,
|
||||
PlatformCapabilities,
|
||||
} from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
|
||||
/**
|
||||
* Platform service implementation for Electron (desktop) platform.
|
||||
* Note: This is a placeholder implementation with most methods currently unimplemented.
|
||||
* Implements the PlatformService interface but throws "Not implemented" errors for most operations.
|
||||
*
|
||||
*
|
||||
* @remarks
|
||||
* This service is intended for desktop application functionality through Electron.
|
||||
* Future implementations should provide:
|
||||
@@ -25,7 +29,7 @@ export class ElectronPlatformService implements PlatformService {
|
||||
isMobile: false,
|
||||
isIOS: false,
|
||||
hasFileDownload: false, // Not implemented yet
|
||||
needsFileHandlingInstructions: false
|
||||
needsFileHandlingInstructions: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService";
|
||||
import {
|
||||
ImageResult,
|
||||
PlatformService,
|
||||
PlatformCapabilities,
|
||||
} from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
|
||||
/**
|
||||
* Platform service implementation for PyWebView platform.
|
||||
* Note: This is a placeholder implementation with most methods currently unimplemented.
|
||||
* Implements the PlatformService interface but throws "Not implemented" errors for most operations.
|
||||
*
|
||||
*
|
||||
* @remarks
|
||||
* This service is intended for Python-based desktop applications using pywebview.
|
||||
* Future implementations should provide:
|
||||
@@ -26,7 +30,7 @@ export class PyWebViewPlatformService implements PlatformService {
|
||||
isMobile: false,
|
||||
isIOS: false,
|
||||
hasFileDownload: false, // Not implemented yet
|
||||
needsFileHandlingInstructions: false
|
||||
needsFileHandlingInstructions: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService";
|
||||
import {
|
||||
ImageResult,
|
||||
PlatformService,
|
||||
PlatformCapabilities,
|
||||
} from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
|
||||
/**
|
||||
* Platform service implementation for web browser platform.
|
||||
* Implements the PlatformService interface with web-specific functionality.
|
||||
*
|
||||
*
|
||||
* @remarks
|
||||
* This service provides web-based implementations for:
|
||||
* - Image capture using the browser's file input
|
||||
* - Image selection from local filesystem
|
||||
* - Image processing and conversion
|
||||
*
|
||||
*
|
||||
* Note: File system operations are not available in the web platform
|
||||
* due to browser security restrictions. These methods throw appropriate errors.
|
||||
*/
|
||||
@@ -26,7 +30,7 @@ export class WebPlatformService implements PlatformService {
|
||||
isMobile: /iPhone|iPad|iPod|Android/i.test(navigator.userAgent),
|
||||
isIOS: /iPad|iPhone|iPod/.test(navigator.userAgent),
|
||||
hasFileDownload: true,
|
||||
needsFileHandlingInstructions: false
|
||||
needsFileHandlingInstructions: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -70,10 +74,10 @@ export class WebPlatformService implements PlatformService {
|
||||
/**
|
||||
* Opens a file input dialog configured for camera capture.
|
||||
* Creates a temporary file input element to access the device camera.
|
||||
*
|
||||
*
|
||||
* @returns Promise resolving to the captured image data
|
||||
* @throws Error if image capture fails or no image is selected
|
||||
*
|
||||
*
|
||||
* @remarks
|
||||
* Uses the 'capture' attribute to prefer the device camera.
|
||||
* Falls back to file selection if camera is not available.
|
||||
@@ -111,10 +115,10 @@ export class WebPlatformService implements PlatformService {
|
||||
/**
|
||||
* Opens a file input dialog for selecting an image file.
|
||||
* Creates a temporary file input element to access local files.
|
||||
*
|
||||
*
|
||||
* @returns Promise resolving to the selected image data
|
||||
* @throws Error if image processing fails or no image is selected
|
||||
*
|
||||
*
|
||||
* @remarks
|
||||
* Allows selection of any image file type.
|
||||
* Processes the selected image to ensure consistent format.
|
||||
@@ -150,11 +154,11 @@ export class WebPlatformService implements PlatformService {
|
||||
/**
|
||||
* Processes an image file to ensure consistent format.
|
||||
* Converts the file to a data URL and then to a Blob.
|
||||
*
|
||||
*
|
||||
* @param file - The image File object to process
|
||||
* @returns Promise resolving to processed image Blob
|
||||
* @throws Error if file reading or conversion fails
|
||||
*
|
||||
*
|
||||
* @remarks
|
||||
* This method ensures consistent image format across different
|
||||
* input sources by converting through data URL to Blob.
|
||||
@@ -216,7 +220,7 @@ export class WebPlatformService implements PlatformService {
|
||||
/**
|
||||
* Handles deep link URLs in the web platform.
|
||||
* Deep links are handled through URL parameters in the web environment.
|
||||
*
|
||||
*
|
||||
* @param _url - The deep link URL to handle (unused in web implementation)
|
||||
* @returns Promise that resolves immediately as web handles URLs naturally
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user