react-native-ensys-camera-x 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CustomCamera.podspec +20 -0
- package/LICENSE +20 -0
- package/README.md +833 -0
- package/android/build.gradle +135 -0
- package/android/consumer-rules.pro +47 -0
- package/android/src/main/AndroidManifest.xml +72 -0
- package/android/src/main/java/android/print/PdfPrint.java +51 -0
- package/android/src/main/java/com/customcamera/AnimatedImageViewManager.kt +199 -0
- package/android/src/main/java/com/customcamera/AudioPlayerView.kt +322 -0
- package/android/src/main/java/com/customcamera/AudioRecorder.kt +506 -0
- package/android/src/main/java/com/customcamera/BarcodeScannerActivity.kt +361 -0
- package/android/src/main/java/com/customcamera/BlurBackgroundView.kt +199 -0
- package/android/src/main/java/com/customcamera/CacheCleanupManager.kt +386 -0
- package/android/src/main/java/com/customcamera/CameraAspectRatioMode.kt +77 -0
- package/android/src/main/java/com/customcamera/CameraAsset.kt +211 -0
- package/android/src/main/java/com/customcamera/CameraTheme.kt +479 -0
- package/android/src/main/java/com/customcamera/CompressionCacheStore.kt +504 -0
- package/android/src/main/java/com/customcamera/CompressionFileNameUtils.kt +7 -0
- package/android/src/main/java/com/customcamera/CompressionProfile.kt +195 -0
- package/android/src/main/java/com/customcamera/CustomCameraActivity.kt +7291 -0
- package/android/src/main/java/com/customcamera/CustomCameraFileProvider.kt +9 -0
- package/android/src/main/java/com/customcamera/CustomCameraModule.kt +2479 -0
- package/android/src/main/java/com/customcamera/CustomCameraPackage.kt +53 -0
- package/android/src/main/java/com/customcamera/DisplayUtils.kt +9 -0
- package/android/src/main/java/com/customcamera/DocumentPreviewView.kt +846 -0
- package/android/src/main/java/com/customcamera/DrawingView.kt +214 -0
- package/android/src/main/java/com/customcamera/EmojiPickerData.kt +228 -0
- package/android/src/main/java/com/customcamera/FilterStripAdapter.kt +158 -0
- package/android/src/main/java/com/customcamera/GifSupport.kt +215 -0
- package/android/src/main/java/com/customcamera/GlobalAudioPlayer.kt +320 -0
- package/android/src/main/java/com/customcamera/ImageExporter.kt +1394 -0
- package/android/src/main/java/com/customcamera/ImageFormatSupport.kt +163 -0
- package/android/src/main/java/com/customcamera/Localization.kt +206 -0
- package/android/src/main/java/com/customcamera/MediaAdapters.kt +758 -0
- package/android/src/main/java/com/customcamera/MediaCacheManager.kt +782 -0
- package/android/src/main/java/com/customcamera/MediaExportFormats.kt +201 -0
- package/android/src/main/java/com/customcamera/MediaFileIo.kt +310 -0
- package/android/src/main/java/com/customcamera/MediaMetadataStore.kt +494 -0
- package/android/src/main/java/com/customcamera/MediaPreviewEditor.kt +14865 -0
- package/android/src/main/java/com/customcamera/MediaPublisher.kt +423 -0
- package/android/src/main/java/com/customcamera/MediaStorageWorkflow.kt +722 -0
- package/android/src/main/java/com/customcamera/MediaStoreRepository.kt +378 -0
- package/android/src/main/java/com/customcamera/MediaThumbnailView.kt +286 -0
- package/android/src/main/java/com/customcamera/MediaUtils.kt +37 -0
- package/android/src/main/java/com/customcamera/NativeVideoViewManager.kt +845 -0
- package/android/src/main/java/com/customcamera/OfficeDocumentConverter.kt +2791 -0
- package/android/src/main/java/com/customcamera/PendingCaptureCrops.kt +88 -0
- package/android/src/main/java/com/customcamera/PowerPointPreview.kt +4077 -0
- package/android/src/main/java/com/customcamera/RecentPickerStore.kt +74 -0
- package/android/src/main/java/com/customcamera/SecureFileEraser.kt +411 -0
- package/android/src/main/java/com/customcamera/SecureKeyModule.kt +88 -0
- package/android/src/main/java/com/customcamera/SecureMediaDeleter.kt +493 -0
- package/android/src/main/java/com/customcamera/StickerPickerData.kt +107 -0
- package/android/src/main/java/com/customcamera/SvgDrawable.kt +175 -0
- package/android/src/main/java/com/customcamera/SvgIconViewManager.kt +77 -0
- package/android/src/main/java/com/customcamera/TextEntryController.kt +553 -0
- package/android/src/main/java/com/customcamera/ThumbnailLoader.kt +455 -0
- package/android/src/main/java/com/customcamera/UploadService.kt +909 -0
- package/android/src/main/java/com/customcamera/VideoEditUtils.kt +210 -0
- package/android/src/main/java/com/customcamera/VideoRotationTranscoder.kt +1992 -0
- package/android/src/main/java/com/customcamera/gif/AnimatedGifEncoder.kt +473 -0
- package/android/src/main/java/com/customcamera/gif/GifDecoder.kt +690 -0
- package/android/src/main/java/com/customcamera/gif/GifFramesDrawable.kt +160 -0
- package/android/src/main/java/com/customcamera/gif/GifHttp.kt +112 -0
- package/android/src/main/java/com/customcamera/gif/GifImageLoader.kt +186 -0
- package/android/src/main/java/com/customcamera/gif/GifModels.kt +74 -0
- package/android/src/main/java/com/customcamera/gif/GifProvider.kt +49 -0
- package/android/src/main/java/com/customcamera/gif/GifProviders.kt +27 -0
- package/android/src/main/java/com/customcamera/gif/GifRepository.kt +124 -0
- package/android/src/main/java/com/customcamera/gif/GifSafety.kt +33 -0
- package/android/src/main/java/com/customcamera/gif/GiphyGifProvider.kt +146 -0
- package/android/src/main/java/com/customcamera/gif/LZWEncoder.kt +258 -0
- package/android/src/main/java/com/customcamera/gif/NeuQuant.kt +435 -0
- package/android/src/main/java/com/customcamera/gif/TenorGifProvider.kt +147 -0
- package/android/src/main/res/drawable/bg_brush_selected.xml +5 -0
- package/android/src/main/res/drawable/bg_color_swatch.xml +5 -0
- package/android/src/main/res/drawable/bg_editor_toolbar.xml +6 -0
- package/android/src/main/res/drawable/bg_icon_circle.xml +5 -0
- package/android/src/main/res/drawable/bg_icon_circle_light.xml +5 -0
- package/android/src/main/res/drawable/bg_mode_tab_active.xml +6 -0
- package/android/src/main/res/drawable/bg_pill.xml +6 -0
- package/android/src/main/res/drawable/bg_recording_dot.xml +6 -0
- package/android/src/main/res/drawable/bg_selection_badge.xml +8 -0
- package/android/src/main/res/drawable/bg_send_button.xml +5 -0
- package/android/src/main/res/drawable/bg_shutter_inner.xml +5 -0
- package/android/src/main/res/drawable/bg_shutter_recording.xml +6 -0
- package/android/src/main/res/drawable/bg_shutter_ring.xml +8 -0
- package/android/src/main/res/drawable/bg_shutter_video_idle.xml +5 -0
- package/android/src/main/res/drawable/bg_thumbnail.xml +9 -0
- package/android/src/main/res/drawable/ic_aspect_ratio.xml +17 -0
- package/android/src/main/res/drawable/ic_audio.xml +10 -0
- package/android/src/main/res/drawable/ic_back.xml +10 -0
- package/android/src/main/res/drawable/ic_brush_medium.xml +12 -0
- package/android/src/main/res/drawable/ic_brush_thick.xml +12 -0
- package/android/src/main/res/drawable/ic_brush_thin.xml +12 -0
- package/android/src/main/res/drawable/ic_check.xml +17 -0
- package/android/src/main/res/drawable/ic_chevron_down.xml +10 -0
- package/android/src/main/res/drawable/ic_chevron_up.xml +13 -0
- package/android/src/main/res/drawable/ic_clear_drawing.xml +10 -0
- package/android/src/main/res/drawable/ic_close.xml +10 -0
- package/android/src/main/res/drawable/ic_cover.xml +9 -0
- package/android/src/main/res/drawable/ic_crop.xml +10 -0
- package/android/src/main/res/drawable/ic_delete.xml +9 -0
- package/android/src/main/res/drawable/ic_document.xml +10 -0
- package/android/src/main/res/drawable/ic_done.xml +10 -0
- package/android/src/main/res/drawable/ic_download.xml +10 -0
- package/android/src/main/res/drawable/ic_emoji.xml +10 -0
- package/android/src/main/res/drawable/ic_filter.xml +10 -0
- package/android/src/main/res/drawable/ic_flash_auto.xml +7 -0
- package/android/src/main/res/drawable/ic_flash_off.xml +23 -0
- package/android/src/main/res/drawable/ic_flash_on.xml +16 -0
- package/android/src/main/res/drawable/ic_flip.xml +15 -0
- package/android/src/main/res/drawable/ic_gallery.xml +10 -0
- package/android/src/main/res/drawable/ic_gif.xml +24 -0
- package/android/src/main/res/drawable/ic_lock.xml +19 -0
- package/android/src/main/res/drawable/ic_lock_open.xml +22 -0
- package/android/src/main/res/drawable/ic_marker.xml +10 -0
- package/android/src/main/res/drawable/ic_more_vert.xml +18 -0
- package/android/src/main/res/drawable/ic_overlay_close.xml +19 -0
- package/android/src/main/res/drawable/ic_overlay_resize.xml +18 -0
- package/android/src/main/res/drawable/ic_pause.xml +10 -0
- package/android/src/main/res/drawable/ic_photo_mode.xml +10 -0
- package/android/src/main/res/drawable/ic_play.xml +10 -0
- package/android/src/main/res/drawable/ic_redo.xml +10 -0
- package/android/src/main/res/drawable/ic_rotate.xml +9 -0
- package/android/src/main/res/drawable/ic_send.xml +10 -0
- package/android/src/main/res/drawable/ic_share.xml +10 -0
- package/android/src/main/res/drawable/ic_stat_upload.xml +10 -0
- package/android/src/main/res/drawable/ic_sticker.xml +24 -0
- package/android/src/main/res/drawable/ic_text.xml +10 -0
- package/android/src/main/res/drawable/ic_text_align_center.xml +11 -0
- package/android/src/main/res/drawable/ic_text_align_left.xml +11 -0
- package/android/src/main/res/drawable/ic_text_align_right.xml +11 -0
- package/android/src/main/res/drawable/ic_text_bg.xml +11 -0
- package/android/src/main/res/drawable/ic_trim.xml +23 -0
- package/android/src/main/res/drawable/ic_undo.xml +10 -0
- package/android/src/main/res/drawable/ic_video_mode.xml +10 -0
- package/android/src/main/res/drawable/ic_video_note.xml +13 -0
- package/android/src/main/res/drawable/ic_volume_off.xml +9 -0
- package/android/src/main/res/drawable/ic_volume_on.xml +9 -0
- package/android/src/main/res/drawable/sticker_heart.xml +9 -0
- package/android/src/main/res/drawable/sticker_smile.xml +9 -0
- package/android/src/main/res/drawable/sticker_star.xml +9 -0
- package/android/src/main/res/drawable/sticker_thumbsup.xml +9 -0
- package/android/src/main/res/values/colors.xml +34 -0
- package/android/src/main/res/values/ids.xml +15 -0
- package/android/src/main/res/values/strings.xml +15 -0
- package/android/src/main/res/values/styles.xml +20 -0
- package/android/src/main/res/xml/file_paths.xml +34 -0
- package/ios/CustomCamera.h +5 -0
- package/ios/CustomCamera.mm +214 -0
- package/lib/module/AudioPlayerContext.js +233 -0
- package/lib/module/AudioPlayerContext.js.map +1 -0
- package/lib/module/CameraPreview.js +304 -0
- package/lib/module/CameraPreview.js.map +1 -0
- package/lib/module/NativeAnimatedImageView.js +41 -0
- package/lib/module/NativeAnimatedImageView.js.map +1 -0
- package/lib/module/NativeAudioPlayerView.js +33 -0
- package/lib/module/NativeAudioPlayerView.js.map +1 -0
- package/lib/module/NativeBlurView.js +35 -0
- package/lib/module/NativeBlurView.js.map +1 -0
- package/lib/module/NativeCustomCamera.js +128 -0
- package/lib/module/NativeCustomCamera.js.map +1 -0
- package/lib/module/NativeCustomCamera.web.js +143 -0
- package/lib/module/NativeCustomCamera.web.js.map +1 -0
- package/lib/module/NativeCustomVideoView.js +5 -0
- package/lib/module/NativeCustomVideoView.js.map +1 -0
- package/lib/module/NativeDocumentPreviewView.js +156 -0
- package/lib/module/NativeDocumentPreviewView.js.map +1 -0
- package/lib/module/NativeMediaThumbnailView.js +110 -0
- package/lib/module/NativeMediaThumbnailView.js.map +1 -0
- package/lib/module/NativeSvgIcon.js +32 -0
- package/lib/module/NativeSvgIcon.js.map +1 -0
- package/lib/module/ResponsivePreviewContainer.js +171 -0
- package/lib/module/ResponsivePreviewContainer.js.map +1 -0
- package/lib/module/accessibility.js +61 -0
- package/lib/module/accessibility.js.map +1 -0
- package/lib/module/config.js +352 -0
- package/lib/module/config.js.map +1 -0
- package/lib/module/cpuOptimization.js +296 -0
- package/lib/module/cpuOptimization.js.map +1 -0
- package/lib/module/db/DatabaseManager.js +191 -0
- package/lib/module/db/DatabaseManager.js.map +1 -0
- package/lib/module/db/MediaMapper.js +284 -0
- package/lib/module/db/MediaMapper.js.map +1 -0
- package/lib/module/db/MediaRepository.js +242 -0
- package/lib/module/db/MediaRepository.js.map +1 -0
- package/lib/module/db/index.js +41 -0
- package/lib/module/db/index.js.map +1 -0
- package/lib/module/db/migrations.js +180 -0
- package/lib/module/db/migrations.js.map +1 -0
- package/lib/module/db/react-native-sqlcipher.d.js +2 -0
- package/lib/module/db/react-native-sqlcipher.d.js.map +1 -0
- package/lib/module/db/secureKey.js +87 -0
- package/lib/module/db/secureKey.js.map +1 -0
- package/lib/module/db/types.js +57 -0
- package/lib/module/db/types.js.map +1 -0
- package/lib/module/db/useMediaDatabase.js +123 -0
- package/lib/module/db/useMediaDatabase.js.map +1 -0
- package/lib/module/defaultIcons.js +2259 -0
- package/lib/module/defaultIcons.js.map +1 -0
- package/lib/module/deviceCapabilities.js +408 -0
- package/lib/module/deviceCapabilities.js.map +1 -0
- package/lib/module/errors.js +267 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/iconConfig.js +796 -0
- package/lib/module/iconConfig.js.map +1 -0
- package/lib/module/icons.js +514 -0
- package/lib/module/icons.js.map +1 -0
- package/lib/module/index.js +251 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/jest-globals.d.js +2 -0
- package/lib/module/jest-globals.d.js.map +1 -0
- package/lib/module/library/MediaLibrary.js +107 -0
- package/lib/module/library/MediaLibrary.js.map +1 -0
- package/lib/module/library/MediaLibraryScreen.js +2597 -0
- package/lib/module/library/MediaLibraryScreen.js.map +1 -0
- package/lib/module/library/components/AudioPreview.js +74 -0
- package/lib/module/library/components/AudioPreview.js.map +1 -0
- package/lib/module/library/components/DocumentPreview.js +331 -0
- package/lib/module/library/components/DocumentPreview.js.map +1 -0
- package/lib/module/library/components/ExpandableFab.js +343 -0
- package/lib/module/library/components/ExpandableFab.js.map +1 -0
- package/lib/module/library/components/FileTiles.js +251 -0
- package/lib/module/library/components/FileTiles.js.map +1 -0
- package/lib/module/library/components/ImagePreview.js +70 -0
- package/lib/module/library/components/ImagePreview.js.map +1 -0
- package/lib/module/library/components/MediaMetadataHeader.js +175 -0
- package/lib/module/library/components/MediaMetadataHeader.js.map +1 -0
- package/lib/module/library/components/RecordAudioScreen.js +816 -0
- package/lib/module/library/components/RecordAudioScreen.js.map +1 -0
- package/lib/module/library/components/VideoPreview.js +453 -0
- package/lib/module/library/components/VideoPreview.js.map +1 -0
- package/lib/module/library/components/ViewerCounter.js +55 -0
- package/lib/module/library/components/ViewerCounter.js.map +1 -0
- package/lib/module/library/compressionEstimate.js +507 -0
- package/lib/module/library/compressionEstimate.js.map +1 -0
- package/lib/module/library/fileMetadata.js +196 -0
- package/lib/module/library/fileMetadata.js.map +1 -0
- package/lib/module/library/index.js +42 -0
- package/lib/module/library/index.js.map +1 -0
- package/lib/module/library/libraryIconRegistry.js +69 -0
- package/lib/module/library/libraryIconRegistry.js.map +1 -0
- package/lib/module/library/libraryIcons.js +858 -0
- package/lib/module/library/libraryIcons.js.map +1 -0
- package/lib/module/library/localizedFormat.js +181 -0
- package/lib/module/library/localizedFormat.js.map +1 -0
- package/lib/module/library/palette.js +225 -0
- package/lib/module/library/palette.js.map +1 -0
- package/lib/module/library/responsive.js +53 -0
- package/lib/module/library/responsive.js.map +1 -0
- package/lib/module/locales.js +416 -0
- package/lib/module/locales.js.map +1 -0
- package/lib/module/localization.js +1064 -0
- package/lib/module/localization.js.map +1 -0
- package/lib/module/logger.js +20 -0
- package/lib/module/logger.js.map +1 -0
- package/lib/module/lowMemoryCache.js +206 -0
- package/lib/module/lowMemoryCache.js.map +1 -0
- package/lib/module/mediaHistory.js +33 -0
- package/lib/module/mediaHistory.js.map +1 -0
- package/lib/module/mediaStorageService.js +402 -0
- package/lib/module/mediaStorageService.js.map +1 -0
- package/lib/module/memory.js +79 -0
- package/lib/module/memory.js.map +1 -0
- package/lib/module/nativeActions.js +307 -0
- package/lib/module/nativeActions.js.map +1 -0
- package/lib/module/nativeComponentSupport.js +61 -0
- package/lib/module/nativeComponentSupport.js.map +1 -0
- package/lib/module/networkPerformance.js +24 -0
- package/lib/module/networkPerformance.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/performance.js +104 -0
- package/lib/module/performance.js.map +1 -0
- package/lib/module/performanceMonitor.js +155 -0
- package/lib/module/performanceMonitor.js.map +1 -0
- package/lib/module/permissions.js +370 -0
- package/lib/module/permissions.js.map +1 -0
- package/lib/module/rendering.js +40 -0
- package/lib/module/rendering.js.map +1 -0
- package/lib/module/security.js +18 -0
- package/lib/module/security.js.map +1 -0
- package/lib/module/state.js +266 -0
- package/lib/module/state.js.map +1 -0
- package/lib/module/storage.js +400 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/theme.js +390 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +115 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/validation.js +288 -0
- package/lib/module/validation.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/AudioPlayerContext.d.ts +27 -0
- package/lib/typescript/src/AudioPlayerContext.d.ts.map +1 -0
- package/lib/typescript/src/CameraPreview.d.ts +13 -0
- package/lib/typescript/src/CameraPreview.d.ts.map +1 -0
- package/lib/typescript/src/NativeAnimatedImageView.d.ts +33 -0
- package/lib/typescript/src/NativeAnimatedImageView.d.ts.map +1 -0
- package/lib/typescript/src/NativeAudioPlayerView.d.ts +12 -0
- package/lib/typescript/src/NativeAudioPlayerView.d.ts.map +1 -0
- package/lib/typescript/src/NativeBlurView.d.ts +12 -0
- package/lib/typescript/src/NativeBlurView.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomCamera.d.ts +167 -0
- package/lib/typescript/src/NativeCustomCamera.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomCamera.web.d.ts +47 -0
- package/lib/typescript/src/NativeCustomCamera.web.d.ts.map +1 -0
- package/lib/typescript/src/NativeCustomVideoView.d.ts +30 -0
- package/lib/typescript/src/NativeCustomVideoView.d.ts.map +1 -0
- package/lib/typescript/src/NativeDocumentPreviewView.d.ts +48 -0
- package/lib/typescript/src/NativeDocumentPreviewView.d.ts.map +1 -0
- package/lib/typescript/src/NativeMediaThumbnailView.d.ts +54 -0
- package/lib/typescript/src/NativeMediaThumbnailView.d.ts.map +1 -0
- package/lib/typescript/src/NativeSvgIcon.d.ts +25 -0
- package/lib/typescript/src/NativeSvgIcon.d.ts.map +1 -0
- package/lib/typescript/src/ResponsivePreviewContainer.d.ts +92 -0
- package/lib/typescript/src/ResponsivePreviewContainer.d.ts.map +1 -0
- package/lib/typescript/src/accessibility.d.ts +20 -0
- package/lib/typescript/src/accessibility.d.ts.map +1 -0
- package/lib/typescript/src/config.d.ts +145 -0
- package/lib/typescript/src/config.d.ts.map +1 -0
- package/lib/typescript/src/cpuOptimization.d.ts +63 -0
- package/lib/typescript/src/cpuOptimization.d.ts.map +1 -0
- package/lib/typescript/src/db/DatabaseManager.d.ts +48 -0
- package/lib/typescript/src/db/DatabaseManager.d.ts.map +1 -0
- package/lib/typescript/src/db/MediaMapper.d.ts +77 -0
- package/lib/typescript/src/db/MediaMapper.d.ts.map +1 -0
- package/lib/typescript/src/db/MediaRepository.d.ts +66 -0
- package/lib/typescript/src/db/MediaRepository.d.ts.map +1 -0
- package/lib/typescript/src/db/index.d.ts +23 -0
- package/lib/typescript/src/db/index.d.ts.map +1 -0
- package/lib/typescript/src/db/migrations.d.ts +31 -0
- package/lib/typescript/src/db/migrations.d.ts.map +1 -0
- package/lib/typescript/src/db/secureKey.d.ts +10 -0
- package/lib/typescript/src/db/secureKey.d.ts.map +1 -0
- package/lib/typescript/src/db/types.d.ts +115 -0
- package/lib/typescript/src/db/types.d.ts.map +1 -0
- package/lib/typescript/src/db/useMediaDatabase.d.ts +41 -0
- package/lib/typescript/src/db/useMediaDatabase.d.ts.map +1 -0
- package/lib/typescript/src/defaultIcons.d.ts +139 -0
- package/lib/typescript/src/defaultIcons.d.ts.map +1 -0
- package/lib/typescript/src/deviceCapabilities.d.ts +92 -0
- package/lib/typescript/src/deviceCapabilities.d.ts.map +1 -0
- package/lib/typescript/src/errors.d.ts +95 -0
- package/lib/typescript/src/errors.d.ts.map +1 -0
- package/lib/typescript/src/iconConfig.d.ts +176 -0
- package/lib/typescript/src/iconConfig.d.ts.map +1 -0
- package/lib/typescript/src/icons.d.ts +217 -0
- package/lib/typescript/src/icons.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +104 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/library/MediaLibrary.d.ts +57 -0
- package/lib/typescript/src/library/MediaLibrary.d.ts.map +1 -0
- package/lib/typescript/src/library/MediaLibraryScreen.d.ts +51 -0
- package/lib/typescript/src/library/MediaLibraryScreen.d.ts.map +1 -0
- package/lib/typescript/src/library/components/AudioPreview.d.ts +6 -0
- package/lib/typescript/src/library/components/AudioPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/DocumentPreview.d.ts +10 -0
- package/lib/typescript/src/library/components/DocumentPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ExpandableFab.d.ts +39 -0
- package/lib/typescript/src/library/components/ExpandableFab.d.ts.map +1 -0
- package/lib/typescript/src/library/components/FileTiles.d.ts +8 -0
- package/lib/typescript/src/library/components/FileTiles.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ImagePreview.d.ts +5 -0
- package/lib/typescript/src/library/components/ImagePreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts +16 -0
- package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts.map +1 -0
- package/lib/typescript/src/library/components/RecordAudioScreen.d.ts +8 -0
- package/lib/typescript/src/library/components/RecordAudioScreen.d.ts.map +1 -0
- package/lib/typescript/src/library/components/VideoPreview.d.ts +20 -0
- package/lib/typescript/src/library/components/VideoPreview.d.ts.map +1 -0
- package/lib/typescript/src/library/components/ViewerCounter.d.ts +13 -0
- package/lib/typescript/src/library/components/ViewerCounter.d.ts.map +1 -0
- package/lib/typescript/src/library/compressionEstimate.d.ts +313 -0
- package/lib/typescript/src/library/compressionEstimate.d.ts.map +1 -0
- package/lib/typescript/src/library/fileMetadata.d.ts +33 -0
- package/lib/typescript/src/library/fileMetadata.d.ts.map +1 -0
- package/lib/typescript/src/library/index.d.ts +40 -0
- package/lib/typescript/src/library/index.d.ts.map +1 -0
- package/lib/typescript/src/library/libraryIconRegistry.d.ts +35 -0
- package/lib/typescript/src/library/libraryIconRegistry.d.ts.map +1 -0
- package/lib/typescript/src/library/libraryIcons.d.ts +85 -0
- package/lib/typescript/src/library/libraryIcons.d.ts.map +1 -0
- package/lib/typescript/src/library/localizedFormat.d.ts +49 -0
- package/lib/typescript/src/library/localizedFormat.d.ts.map +1 -0
- package/lib/typescript/src/library/palette.d.ts +104 -0
- package/lib/typescript/src/library/palette.d.ts.map +1 -0
- package/lib/typescript/src/library/responsive.d.ts +15 -0
- package/lib/typescript/src/library/responsive.d.ts.map +1 -0
- package/lib/typescript/src/locales.d.ts +103 -0
- package/lib/typescript/src/locales.d.ts.map +1 -0
- package/lib/typescript/src/localization.d.ts +1051 -0
- package/lib/typescript/src/localization.d.ts.map +1 -0
- package/lib/typescript/src/logger.d.ts +4 -0
- package/lib/typescript/src/logger.d.ts.map +1 -0
- package/lib/typescript/src/lowMemoryCache.d.ts +64 -0
- package/lib/typescript/src/lowMemoryCache.d.ts.map +1 -0
- package/lib/typescript/src/mediaHistory.d.ts +3 -0
- package/lib/typescript/src/mediaHistory.d.ts.map +1 -0
- package/lib/typescript/src/mediaStorageService.d.ts +155 -0
- package/lib/typescript/src/mediaStorageService.d.ts.map +1 -0
- package/lib/typescript/src/memory.d.ts +21 -0
- package/lib/typescript/src/memory.d.ts.map +1 -0
- package/lib/typescript/src/nativeActions.d.ts +174 -0
- package/lib/typescript/src/nativeActions.d.ts.map +1 -0
- package/lib/typescript/src/nativeComponentSupport.d.ts +30 -0
- package/lib/typescript/src/nativeComponentSupport.d.ts.map +1 -0
- package/lib/typescript/src/networkPerformance.d.ts +12 -0
- package/lib/typescript/src/networkPerformance.d.ts.map +1 -0
- package/lib/typescript/src/performance.d.ts +32 -0
- package/lib/typescript/src/performance.d.ts.map +1 -0
- package/lib/typescript/src/performanceMonitor.d.ts +45 -0
- package/lib/typescript/src/performanceMonitor.d.ts.map +1 -0
- package/lib/typescript/src/permissions.d.ts +132 -0
- package/lib/typescript/src/permissions.d.ts.map +1 -0
- package/lib/typescript/src/rendering.d.ts +9 -0
- package/lib/typescript/src/rendering.d.ts.map +1 -0
- package/lib/typescript/src/security.d.ts +6 -0
- package/lib/typescript/src/security.d.ts.map +1 -0
- package/lib/typescript/src/state.d.ts +102 -0
- package/lib/typescript/src/state.d.ts.map +1 -0
- package/lib/typescript/src/storage.d.ts +117 -0
- package/lib/typescript/src/storage.d.ts.map +1 -0
- package/lib/typescript/src/theme.d.ts +15 -0
- package/lib/typescript/src/theme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +802 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +50 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/validation.d.ts +52 -0
- package/lib/typescript/src/validation.d.ts.map +1 -0
- package/package.json +204 -0
- package/react-native.config.js +17 -0
- package/src/AudioPlayerContext.tsx +220 -0
- package/src/CameraPreview.tsx +352 -0
- package/src/NativeAnimatedImageView.tsx +71 -0
- package/src/NativeAudioPlayerView.tsx +39 -0
- package/src/NativeBlurView.tsx +40 -0
- package/src/NativeCustomCamera.ts +305 -0
- package/src/NativeCustomCamera.web.ts +192 -0
- package/src/NativeCustomVideoView.ts +30 -0
- package/src/NativeDocumentPreviewView.tsx +196 -0
- package/src/NativeMediaThumbnailView.tsx +167 -0
- package/src/NativeSvgIcon.tsx +46 -0
- package/src/ResponsivePreviewContainer.tsx +227 -0
- package/src/accessibility.ts +80 -0
- package/src/config.ts +406 -0
- package/src/cpuOptimization.ts +365 -0
- package/src/db/DatabaseManager.ts +212 -0
- package/src/db/MediaMapper.ts +377 -0
- package/src/db/MediaRepository.ts +313 -0
- package/src/db/index.ts +73 -0
- package/src/db/migrations.ts +222 -0
- package/src/db/react-native-sqlcipher.d.ts +76 -0
- package/src/db/secureKey.ts +100 -0
- package/src/db/types.ts +123 -0
- package/src/db/useMediaDatabase.ts +191 -0
- package/src/defaultIcons.tsx +2390 -0
- package/src/deviceCapabilities.ts +438 -0
- package/src/errors.ts +350 -0
- package/src/iconConfig.tsx +962 -0
- package/src/icons.tsx +788 -0
- package/src/index.tsx +763 -0
- package/src/jest-globals.d.ts +9 -0
- package/src/library/MediaLibrary.tsx +141 -0
- package/src/library/MediaLibraryScreen.tsx +3003 -0
- package/src/library/components/AudioPreview.tsx +73 -0
- package/src/library/components/DocumentPreview.tsx +361 -0
- package/src/library/components/ExpandableFab.tsx +342 -0
- package/src/library/components/FileTiles.tsx +252 -0
- package/src/library/components/ImagePreview.tsx +72 -0
- package/src/library/components/MediaMetadataHeader.tsx +208 -0
- package/src/library/components/RecordAudioScreen.tsx +845 -0
- package/src/library/components/VideoPreview.tsx +478 -0
- package/src/library/components/ViewerCounter.tsx +71 -0
- package/src/library/compressionEstimate.ts +662 -0
- package/src/library/fileMetadata.ts +212 -0
- package/src/library/index.ts +66 -0
- package/src/library/libraryIconRegistry.tsx +86 -0
- package/src/library/libraryIcons.tsx +928 -0
- package/src/library/localizedFormat.ts +207 -0
- package/src/library/palette.ts +281 -0
- package/src/library/responsive.ts +49 -0
- package/src/locales.ts +381 -0
- package/src/localization.ts +1947 -0
- package/src/logger.ts +20 -0
- package/src/lowMemoryCache.ts +218 -0
- package/src/mediaHistory.ts +42 -0
- package/src/mediaStorageService.ts +546 -0
- package/src/memory.ts +102 -0
- package/src/nativeActions.ts +422 -0
- package/src/nativeComponentSupport.ts +60 -0
- package/src/networkPerformance.ts +30 -0
- package/src/performance.ts +137 -0
- package/src/performanceMonitor.ts +219 -0
- package/src/permissions.ts +403 -0
- package/src/rendering.ts +47 -0
- package/src/security.ts +19 -0
- package/src/state.ts +333 -0
- package/src/storage.ts +453 -0
- package/src/theme.tsx +467 -0
- package/src/types.ts +946 -0
- package/src/utils.ts +177 -0
- package/src/validation.ts +372 -0
package/src/utils.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CameraTheme,
|
|
3
|
+
FaceEffect,
|
|
4
|
+
FilterType,
|
|
5
|
+
FlashMode,
|
|
6
|
+
ImageCropOptions,
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_FILTERS: FilterType[] = [
|
|
10
|
+
'none',
|
|
11
|
+
'grayscale',
|
|
12
|
+
'sepia',
|
|
13
|
+
'vintage',
|
|
14
|
+
'blur',
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export const DEFAULT_FACE_EFFECTS: FaceEffect[] = [
|
|
18
|
+
'none',
|
|
19
|
+
'dog',
|
|
20
|
+
'cat',
|
|
21
|
+
'glasses',
|
|
22
|
+
'hat',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const DEFAULT_THEMES: CameraTheme[] = [
|
|
26
|
+
'default',
|
|
27
|
+
'dark',
|
|
28
|
+
'light',
|
|
29
|
+
'minimal',
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const DEFAULT_FLASH_MODES: FlashMode[] = ['off', 'on', 'auto', 'torch'];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Helper function to validate image crop options
|
|
36
|
+
*/
|
|
37
|
+
export function validateCropOptions(options: ImageCropOptions): boolean {
|
|
38
|
+
if (options.width === 0 || (options.width !== undefined && options.width < 0)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (options.height === 0 || (options.height !== undefined && options.height < 0)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (options.x !== undefined && options.x < 0) return false;
|
|
45
|
+
if (options.y !== undefined && options.y < 0) return false;
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to generate a unique album name
|
|
51
|
+
*/
|
|
52
|
+
let albumNameCounter = 0;
|
|
53
|
+
|
|
54
|
+
export function generateAlbumName(baseName: string): string {
|
|
55
|
+
const timestamp = new Date().getTime();
|
|
56
|
+
albumNameCounter += 1;
|
|
57
|
+
return `${baseName}_${timestamp}_${albumNameCounter}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Helper function to format video duration
|
|
62
|
+
*/
|
|
63
|
+
export function formatVideoDuration(seconds: number): string {
|
|
64
|
+
const mins = Math.floor(seconds / 60);
|
|
65
|
+
const secs = Math.floor(seconds % 60);
|
|
66
|
+
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Helper function to check if a URI is a video
|
|
71
|
+
*/
|
|
72
|
+
export function isVideoUri(uri: string): boolean {
|
|
73
|
+
return (
|
|
74
|
+
uri.toLowerCase().endsWith('.mp4') ||
|
|
75
|
+
uri.toLowerCase().endsWith('.mov') ||
|
|
76
|
+
uri.toLowerCase().endsWith('.avi')
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Every still-image container the library handles end to end. Mirrors the native
|
|
82
|
+
* `ImageFormatSupport` registry — a format present in one and absent from the other is how an
|
|
83
|
+
* image ends up discovered but not rendered (or vice versa).
|
|
84
|
+
*/
|
|
85
|
+
const IMAGE_EXTENSIONS = new Set([
|
|
86
|
+
'jpg',
|
|
87
|
+
'jpeg',
|
|
88
|
+
'png',
|
|
89
|
+
'gif',
|
|
90
|
+
'webp',
|
|
91
|
+
'bmp',
|
|
92
|
+
'heic',
|
|
93
|
+
'heif',
|
|
94
|
+
'hif',
|
|
95
|
+
'avif',
|
|
96
|
+
'avifs',
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to check if a URI is an image
|
|
101
|
+
*/
|
|
102
|
+
export function isImageUri(uri: string): boolean {
|
|
103
|
+
// Strip any query string / fragment so `…/photo.avif?token=…` still matches.
|
|
104
|
+
const path = uri.split(/[?#]/)[0] ?? '';
|
|
105
|
+
const extension = path.split('.').pop()?.toLowerCase() ?? '';
|
|
106
|
+
return IMAGE_EXTENSIONS.has(extension);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Whether an asset is a GIF, judged by its declared MIME type first and its file name / uri
|
|
111
|
+
* extension second — so a file from a provider that reports no MIME type is still recognised.
|
|
112
|
+
*
|
|
113
|
+
* A declared, recognised `image/*` type is authoritative: an asset that says it is `image/jpeg`
|
|
114
|
+
* is not reclassified just because something in its path ends in `.gif`. Mirrors the native
|
|
115
|
+
* `GifSupport.isGif` precedence so the two sides never disagree about the same file.
|
|
116
|
+
*/
|
|
117
|
+
export function isGifAsset(asset: {
|
|
118
|
+
mimeType?: string | null;
|
|
119
|
+
fileName?: string | null;
|
|
120
|
+
uri?: string | null;
|
|
121
|
+
}): boolean {
|
|
122
|
+
const mime = asset.mimeType?.toLowerCase();
|
|
123
|
+
if (mime) {
|
|
124
|
+
if (mime === 'image/gif') return true;
|
|
125
|
+
if (mime.startsWith('image/')) return false;
|
|
126
|
+
}
|
|
127
|
+
const name = asset.fileName ?? asset.uri;
|
|
128
|
+
if (!name) return false;
|
|
129
|
+
// Strip any query string so `…/file.gif?token=…` still matches.
|
|
130
|
+
const path = name.split(/[?#]/)[0] ?? '';
|
|
131
|
+
return path.toLowerCase().endsWith('.gif');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Containers ReactNative's own `<Image>` cannot decode on Android. Fresco has no HEIF or AVIF
|
|
136
|
+
* decoder, so an `<Image>` pointed at one renders nothing at all — a blank tile, with no error.
|
|
137
|
+
*/
|
|
138
|
+
const NATIVE_DECODE_ONLY_MIMES = new Set([
|
|
139
|
+
'image/heic',
|
|
140
|
+
'image/heif',
|
|
141
|
+
'image/heic-sequence',
|
|
142
|
+
'image/heif-sequence',
|
|
143
|
+
'image/avif',
|
|
144
|
+
]);
|
|
145
|
+
const NATIVE_DECODE_ONLY_EXTENSIONS = new Set([
|
|
146
|
+
'heic',
|
|
147
|
+
'heif',
|
|
148
|
+
'hif',
|
|
149
|
+
'avif',
|
|
150
|
+
'avifs',
|
|
151
|
+
]);
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Whether this image must be rendered through the library's native image view instead of
|
|
155
|
+
* ReactNative's `<Image>`.
|
|
156
|
+
*
|
|
157
|
+
* HEIF and AVIF are decoded by the Android platform (API 28+ / API 31+ respectively) but NOT by
|
|
158
|
+
* Fresco, which is what backs `<Image>` on Android — so those assets silently render as empty
|
|
159
|
+
* space. `NativeAnimatedImageView` decodes through ImageDecoder/BitmapFactory and therefore shows
|
|
160
|
+
* them wherever the platform can. Same MIME-then-extension precedence as {@link isGifAsset}.
|
|
161
|
+
*/
|
|
162
|
+
export function requiresNativeImageDecoder(asset: {
|
|
163
|
+
mimeType?: string | null;
|
|
164
|
+
fileName?: string | null;
|
|
165
|
+
uri?: string | null;
|
|
166
|
+
}): boolean {
|
|
167
|
+
const mime = asset.mimeType?.toLowerCase().split(';')[0]?.trim();
|
|
168
|
+
if (mime) {
|
|
169
|
+
if (NATIVE_DECODE_ONLY_MIMES.has(mime)) return true;
|
|
170
|
+
if (mime.startsWith('image/')) return false;
|
|
171
|
+
}
|
|
172
|
+
const name = asset.fileName ?? asset.uri;
|
|
173
|
+
if (!name) return false;
|
|
174
|
+
const path = name.split(/[?#]/)[0] ?? '';
|
|
175
|
+
const extension = path.split('.').pop()?.toLowerCase() ?? '';
|
|
176
|
+
return NATIVE_DECODE_ONLY_EXTENSIONS.has(extension);
|
|
177
|
+
}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive validation utilities for camera operations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CameraError, ERROR_CODES, validateUri } from './errors';
|
|
6
|
+
import { LocalizationManager } from './localization';
|
|
7
|
+
import type { CameraPickerOptions } from './types';
|
|
8
|
+
|
|
9
|
+
// Constants
|
|
10
|
+
const MAX_IMAGE_SIZE = 50 * 1024 * 1024; // 50MB
|
|
11
|
+
const MAX_VIDEO_SIZE = 500 * 1024 * 1024; // 500MB
|
|
12
|
+
const MAX_ALBUM_NAME_LENGTH = 100;
|
|
13
|
+
const MAX_CAPTION_LENGTH = 2000;
|
|
14
|
+
const MAX_BATCH_SIZE = 50;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Validate camera picker options
|
|
18
|
+
*/
|
|
19
|
+
export function validateCameraPickerOptions(
|
|
20
|
+
options: CameraPickerOptions
|
|
21
|
+
): void {
|
|
22
|
+
if (options.selectionLimit !== undefined) {
|
|
23
|
+
if (
|
|
24
|
+
!Number.isInteger(options.selectionLimit) ||
|
|
25
|
+
options.selectionLimit < 0
|
|
26
|
+
) {
|
|
27
|
+
throw new CameraError(
|
|
28
|
+
LocalizationManager.getString('validationSelectionLimitNonNegativeInteger'),
|
|
29
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
30
|
+
{ parameter: 'selectionLimit', value: options.selectionLimit }
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
options.initialCamera &&
|
|
37
|
+
!['back', 'front'].includes(options.initialCamera)
|
|
38
|
+
) {
|
|
39
|
+
throw new CameraError(
|
|
40
|
+
LocalizationManager.getString('validationInitialCameraInvalid'),
|
|
41
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
42
|
+
{ parameter: 'initialCamera', value: options.initialCamera }
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (
|
|
47
|
+
options.mediaTypes &&
|
|
48
|
+
!['all', 'photo', 'video'].includes(options.mediaTypes)
|
|
49
|
+
) {
|
|
50
|
+
throw new CameraError(
|
|
51
|
+
LocalizationManager.getString('validationMediaTypesInvalid'),
|
|
52
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
53
|
+
{ parameter: 'mediaTypes', value: options.mediaTypes }
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Hold-to-record durations. The native side clamps these anyway, but a nonsense value is far
|
|
58
|
+
// easier to spot here than as a gesture that silently behaves nothing like the caller asked.
|
|
59
|
+
if (options.holdToRecordDelayMs !== undefined) {
|
|
60
|
+
if (
|
|
61
|
+
!Number.isFinite(options.holdToRecordDelayMs) ||
|
|
62
|
+
options.holdToRecordDelayMs < 0
|
|
63
|
+
) {
|
|
64
|
+
throw new CameraError(
|
|
65
|
+
LocalizationManager.getString('validationHoldToRecordDelayInvalid'),
|
|
66
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
67
|
+
{
|
|
68
|
+
parameter: 'holdToRecordDelayMs',
|
|
69
|
+
value: options.holdToRecordDelayMs,
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (options.minRecordDurationMs !== undefined) {
|
|
76
|
+
if (
|
|
77
|
+
!Number.isFinite(options.minRecordDurationMs) ||
|
|
78
|
+
options.minRecordDurationMs < 0
|
|
79
|
+
) {
|
|
80
|
+
throw new CameraError(
|
|
81
|
+
LocalizationManager.getString('validationMinRecordDurationInvalid'),
|
|
82
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
83
|
+
{ parameter: 'minRecordDurationMs', value: options.minRecordDurationMs }
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Validate URIs array
|
|
91
|
+
*/
|
|
92
|
+
export function validateUrisArray(uris: string[]): void {
|
|
93
|
+
if (!Array.isArray(uris)) {
|
|
94
|
+
throw new CameraError(
|
|
95
|
+
LocalizationManager.getString('validationUrisMustBeArray'),
|
|
96
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
97
|
+
{ parameter: 'uris', value: uris }
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (uris.length === 0) {
|
|
102
|
+
throw new CameraError(
|
|
103
|
+
LocalizationManager.getString('validationUrisCannotBeEmpty'),
|
|
104
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
105
|
+
{ parameter: 'uris', value: uris }
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (uris.length > MAX_BATCH_SIZE) {
|
|
110
|
+
throw new CameraError(
|
|
111
|
+
LocalizationManager.getString('validationTooManyFiles', MAX_BATCH_SIZE),
|
|
112
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
113
|
+
{ parameter: 'uris', value: uris, maxAllowed: MAX_BATCH_SIZE }
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
uris.forEach((uri, index) => {
|
|
118
|
+
if (!validateUri(uri)) {
|
|
119
|
+
throw new CameraError(
|
|
120
|
+
LocalizationManager.getString('validationInvalidUriAtIndex', index, uri),
|
|
121
|
+
ERROR_CODES.INVALID_URI,
|
|
122
|
+
{ uri, index }
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Validate album name
|
|
130
|
+
*/
|
|
131
|
+
export function validateAlbumName(albumName: string): void {
|
|
132
|
+
if (!albumName || typeof albumName !== 'string') {
|
|
133
|
+
throw new CameraError(
|
|
134
|
+
LocalizationManager.getString('validationAlbumNameRequired'),
|
|
135
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
136
|
+
{ parameter: 'albumName', value: albumName }
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (albumName.length > MAX_ALBUM_NAME_LENGTH) {
|
|
141
|
+
throw new CameraError(
|
|
142
|
+
LocalizationManager.getString(
|
|
143
|
+
'validationAlbumNameTooLong',
|
|
144
|
+
MAX_ALBUM_NAME_LENGTH
|
|
145
|
+
),
|
|
146
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
147
|
+
{
|
|
148
|
+
parameter: 'albumName',
|
|
149
|
+
value: albumName,
|
|
150
|
+
maxLength: MAX_ALBUM_NAME_LENGTH,
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Check for invalid characters
|
|
156
|
+
const invalidChars = /[/:*?"<>|]/;
|
|
157
|
+
if (invalidChars.test(albumName)) {
|
|
158
|
+
throw new CameraError(
|
|
159
|
+
LocalizationManager.getString('validationAlbumNameInvalidCharacters'),
|
|
160
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
161
|
+
{ parameter: 'albumName', value: albumName }
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Validate caption
|
|
168
|
+
*/
|
|
169
|
+
export function validateCaption(caption: string): void {
|
|
170
|
+
if (caption === undefined || caption === null) return;
|
|
171
|
+
|
|
172
|
+
if (typeof caption !== 'string') {
|
|
173
|
+
throw new CameraError(
|
|
174
|
+
LocalizationManager.getString('validationCaptionMustBeString'),
|
|
175
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
176
|
+
{ parameter: 'caption', value: caption }
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (caption.length > MAX_CAPTION_LENGTH) {
|
|
181
|
+
throw new CameraError(
|
|
182
|
+
LocalizationManager.getString('validationCaptionTooLong', MAX_CAPTION_LENGTH),
|
|
183
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
184
|
+
{ parameter: 'caption', value: caption, maxLength: MAX_CAPTION_LENGTH }
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Validate timer delay
|
|
191
|
+
*/
|
|
192
|
+
export function validateTimerDelay(delaySeconds: number): void {
|
|
193
|
+
if (isNaN(delaySeconds) || !isFinite(delaySeconds)) {
|
|
194
|
+
throw new CameraError(
|
|
195
|
+
LocalizationManager.getString('validationDelayMustBeNumber'),
|
|
196
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
197
|
+
{ parameter: 'delaySeconds', value: delaySeconds }
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (delaySeconds < 0) {
|
|
202
|
+
throw new CameraError(
|
|
203
|
+
LocalizationManager.getString('validationDelayCannotBeNegative'),
|
|
204
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
205
|
+
{ parameter: 'delaySeconds', value: delaySeconds }
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (delaySeconds > 30) {
|
|
210
|
+
throw new CameraError(
|
|
211
|
+
LocalizationManager.getString('validationDelayTooLong', 30),
|
|
212
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
213
|
+
{ parameter: 'delaySeconds', value: delaySeconds, maxAllowed: 30 }
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Validate video trim parameters
|
|
220
|
+
*/
|
|
221
|
+
export function validateVideoTrimParameters(
|
|
222
|
+
startTime: number,
|
|
223
|
+
endTime: number
|
|
224
|
+
): void {
|
|
225
|
+
if (isNaN(startTime) || !isFinite(startTime) || startTime < 0) {
|
|
226
|
+
throw new CameraError(
|
|
227
|
+
LocalizationManager.getString('validationStartTimeInvalid'),
|
|
228
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
229
|
+
{ parameter: 'startTime', value: startTime }
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (isNaN(endTime) || !isFinite(endTime) || endTime < 0) {
|
|
234
|
+
throw new CameraError(
|
|
235
|
+
LocalizationManager.getString('validationEndTimeInvalid'),
|
|
236
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
237
|
+
{ parameter: 'endTime', value: endTime }
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (startTime >= endTime) {
|
|
242
|
+
throw new CameraError(
|
|
243
|
+
LocalizationManager.getString('validationStartBeforeEnd'),
|
|
244
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
245
|
+
{ startTime, endTime }
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (endTime - startTime > 600) {
|
|
250
|
+
// 10 minutes max
|
|
251
|
+
throw new CameraError(
|
|
252
|
+
LocalizationManager.getString('validationTrimDurationTooLong', 600),
|
|
253
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
254
|
+
{ startTime, endTime, maxDuration: 600 }
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Validate upload URL
|
|
261
|
+
*/
|
|
262
|
+
export function validateUploadUrl(uploadUrl: string): void {
|
|
263
|
+
if (!uploadUrl || typeof uploadUrl !== 'string') {
|
|
264
|
+
throw new CameraError(
|
|
265
|
+
LocalizationManager.getString('validationUploadUrlRequired'),
|
|
266
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
267
|
+
{ parameter: 'uploadUrl', value: uploadUrl }
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
try {
|
|
272
|
+
// Basic URL validation
|
|
273
|
+
const parsedUrl = new URL(uploadUrl);
|
|
274
|
+
if (!parsedUrl.hostname) {
|
|
275
|
+
throw new Error('invalid URL');
|
|
276
|
+
}
|
|
277
|
+
} catch {
|
|
278
|
+
throw new CameraError(
|
|
279
|
+
LocalizationManager.getString('validationUploadUrlInvalid'),
|
|
280
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
281
|
+
{ parameter: 'uploadUrl', value: uploadUrl }
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Check file size limits
|
|
288
|
+
*/
|
|
289
|
+
export function checkFileSize(
|
|
290
|
+
uri: string,
|
|
291
|
+
size: number,
|
|
292
|
+
isVideo: boolean
|
|
293
|
+
): void {
|
|
294
|
+
const maxSize = isVideo ? MAX_VIDEO_SIZE : MAX_IMAGE_SIZE;
|
|
295
|
+
|
|
296
|
+
if (size > maxSize) {
|
|
297
|
+
const maxSizeMb = maxSize / (1024 * 1024);
|
|
298
|
+
const fileSizeMb = size / (1024 * 1024);
|
|
299
|
+
|
|
300
|
+
throw new CameraError(
|
|
301
|
+
LocalizationManager.getString(
|
|
302
|
+
'validationFileTooLarge',
|
|
303
|
+
isVideo
|
|
304
|
+
? LocalizationManager.getString('video', 'Video')
|
|
305
|
+
: LocalizationManager.getString('image', 'Image'),
|
|
306
|
+
fileSizeMb.toFixed(2),
|
|
307
|
+
maxSizeMb
|
|
308
|
+
),
|
|
309
|
+
ERROR_CODES.FILE_TOO_LARGE,
|
|
310
|
+
{ uri, size, maxSize, isVideo }
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Validate album ID
|
|
317
|
+
*/
|
|
318
|
+
export function validateAlbumId(albumId: string): void {
|
|
319
|
+
if (!albumId || typeof albumId !== 'string') {
|
|
320
|
+
throw new CameraError(
|
|
321
|
+
LocalizationManager.getString('validationAlbumIdRequired'),
|
|
322
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
323
|
+
{ parameter: 'albumId', value: albumId }
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (albumId.length > 100) {
|
|
328
|
+
throw new CameraError(
|
|
329
|
+
LocalizationManager.getString('validationAlbumIdTooLong', 100),
|
|
330
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
331
|
+
{ parameter: 'albumId', value: albumId }
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Validate rotation degrees
|
|
338
|
+
*/
|
|
339
|
+
export function validateRotationDegrees(degrees: number): void {
|
|
340
|
+
if (isNaN(degrees) || !isFinite(degrees)) {
|
|
341
|
+
throw new CameraError(
|
|
342
|
+
LocalizationManager.getString('validationDegreesMustBeNumber'),
|
|
343
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
344
|
+
{ parameter: 'degrees', value: degrees }
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Normalize degrees to 0-360 range
|
|
349
|
+
const normalized = ((degrees % 360) + 360) % 360;
|
|
350
|
+
|
|
351
|
+
if (
|
|
352
|
+
normalized !== 0 &&
|
|
353
|
+
normalized !== 90 &&
|
|
354
|
+
normalized !== 180 &&
|
|
355
|
+
normalized !== 270
|
|
356
|
+
) {
|
|
357
|
+
throw new CameraError(
|
|
358
|
+
LocalizationManager.getString('validationDegreesInvalid'),
|
|
359
|
+
ERROR_CODES.INVALID_PARAMETER,
|
|
360
|
+
{ parameter: 'degrees', value: degrees, validOptions: [0, 90, 180, 270] }
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Export constants for external use
|
|
366
|
+
export const VALIDATION_CONSTANTS = {
|
|
367
|
+
MAX_IMAGE_SIZE,
|
|
368
|
+
MAX_VIDEO_SIZE,
|
|
369
|
+
MAX_ALBUM_NAME_LENGTH,
|
|
370
|
+
MAX_CAPTION_LENGTH,
|
|
371
|
+
MAX_BATCH_SIZE,
|
|
372
|
+
} as const;
|