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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility utilities for camera operations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { AccessibilityInfo, Platform } from 'react-native';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Check if screen reader is enabled
|
|
10
|
+
*/
|
|
11
|
+
export function useScreenReaderEnabled(): boolean {
|
|
12
|
+
const [screenReaderEnabled, setScreenReaderEnabled] = useState(false);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
AccessibilityInfo.isScreenReaderEnabled().then(setScreenReaderEnabled);
|
|
16
|
+
|
|
17
|
+
const subscription = AccessibilityInfo.addEventListener(
|
|
18
|
+
'screenReaderChanged',
|
|
19
|
+
setScreenReaderEnabled
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
return () => subscription.remove();
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return screenReaderEnabled;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Check if reduced motion is enabled
|
|
30
|
+
*/
|
|
31
|
+
export function useReducedMotion(): boolean {
|
|
32
|
+
const [reduceMotion, setReduceMotion] = useState(false);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (Platform.OS === 'ios') {
|
|
36
|
+
AccessibilityInfo.isReduceMotionEnabled().then(setReduceMotion);
|
|
37
|
+
|
|
38
|
+
const subscription = AccessibilityInfo.addEventListener(
|
|
39
|
+
'reduceMotionChanged',
|
|
40
|
+
setReduceMotion
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return () => subscription.remove();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return () => {};
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
return reduceMotion;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Check if bold text is enabled
|
|
54
|
+
*/
|
|
55
|
+
export function useBoldText(): boolean {
|
|
56
|
+
const [boldTextEnabled, setBoldTextEnabled] = useState(false);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
AccessibilityInfo.isBoldTextEnabled().then(setBoldTextEnabled);
|
|
60
|
+
|
|
61
|
+
const subscription = AccessibilityInfo.addEventListener(
|
|
62
|
+
'boldTextChanged',
|
|
63
|
+
setBoldTextEnabled
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return () => subscription.remove();
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
return boldTextEnabled;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Announce text for screen readers
|
|
74
|
+
*/
|
|
75
|
+
export function announceForAccessibility(announcement: string): void {
|
|
76
|
+
if (Platform.OS === 'ios') {
|
|
77
|
+
AccessibilityInfo.announceForAccessibility(announcement);
|
|
78
|
+
}
|
|
79
|
+
// Android accessibility announcements require native implementation
|
|
80
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized white-label configuration for the camera plugin.
|
|
3
|
+
*
|
|
4
|
+
* `configureCameraPlugin()` (aliased as `CameraPlugin.configure`) is the single
|
|
5
|
+
* entry point host apps use to re-brand every visual aspect of the plugin:
|
|
6
|
+
* theme (colors/typography/spacing/radii/component styles), strings, icons
|
|
7
|
+
* (tint/size/resource overrides), animation durations, structural dimensions,
|
|
8
|
+
* and upload-notification appearance.
|
|
9
|
+
*
|
|
10
|
+
* Every section is optional and deep-merged over defaults extracted verbatim
|
|
11
|
+
* from the previously hardcoded values — calling nothing, or calling
|
|
12
|
+
* `configure({})`, leaves the plugin pixel-identical to its stock appearance.
|
|
13
|
+
*
|
|
14
|
+
* The merged config is kept globally on the JS side (for the RN components and
|
|
15
|
+
* `useCameraConfig`) and serialized once to native via `setCameraConfig`,
|
|
16
|
+
* where the Android Activity/editor reads it on launch. The legacy
|
|
17
|
+
* `setCameraTheme()` / `setCameraLocalization()` entry points remain fully
|
|
18
|
+
* supported and now route through the same store.
|
|
19
|
+
*/
|
|
20
|
+
import NativeCustomCamera from './NativeCustomCamera';
|
|
21
|
+
import { setGlobalCameraTheme } from './theme';
|
|
22
|
+
import {
|
|
23
|
+
clearCameraLanguageProvider,
|
|
24
|
+
getCameraIsRtl,
|
|
25
|
+
getCameraLocale,
|
|
26
|
+
isCameraLanguageProvider,
|
|
27
|
+
LocalizationManager,
|
|
28
|
+
setCameraLanguage,
|
|
29
|
+
setCameraLanguageProvider,
|
|
30
|
+
syncCameraLanguage,
|
|
31
|
+
} from './localization';
|
|
32
|
+
import type { CameraLocalizationConfig } from './localization';
|
|
33
|
+
import { setGlobalIconRegistryConfig } from './icons';
|
|
34
|
+
import {
|
|
35
|
+
mergeCameraIconsConfig,
|
|
36
|
+
resolveCameraIconRegistryConfig,
|
|
37
|
+
resolveNativeIconConfig,
|
|
38
|
+
type CameraIconsConfig,
|
|
39
|
+
} from './iconConfig';
|
|
40
|
+
import type {
|
|
41
|
+
CameraAnimationConfig,
|
|
42
|
+
CameraDimensionConfig,
|
|
43
|
+
CameraIconConfig,
|
|
44
|
+
CameraIconName,
|
|
45
|
+
CameraIconStyle,
|
|
46
|
+
CameraPluginConfig,
|
|
47
|
+
GifPickerConfig,
|
|
48
|
+
UploadNotificationConfig,
|
|
49
|
+
} from './types';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Default animation durations (ms) — extracted verbatim from the native views
|
|
53
|
+
* (CustomCameraActivity, MediaPreviewEditor, MediaAdapters). Changing these
|
|
54
|
+
* values changes the native UI; leaving them produces the exact stock motion.
|
|
55
|
+
*/
|
|
56
|
+
export const DEFAULT_ANIMATION_CONFIG: Required<
|
|
57
|
+
Omit<CameraAnimationConfig, 'disableAnimations'>
|
|
58
|
+
> & { disableAnimations: boolean } = {
|
|
59
|
+
disableAnimations: false,
|
|
60
|
+
shutterPress: 80,
|
|
61
|
+
controlsFade: 180,
|
|
62
|
+
stripSlideIn: 260,
|
|
63
|
+
stripSlideOut: 220,
|
|
64
|
+
selectionFade: 150,
|
|
65
|
+
posterFade: 120,
|
|
66
|
+
playPauseFlash: 200,
|
|
67
|
+
playPauseFadeOut: 600,
|
|
68
|
+
playPauseFadeDelay: 400,
|
|
69
|
+
overlayFadeIn: 250,
|
|
70
|
+
overlayFadeOut: 200,
|
|
71
|
+
panelSlideIn: 350,
|
|
72
|
+
panelSlideOut: 300,
|
|
73
|
+
editorIconFade: 180,
|
|
74
|
+
quickFade: 150,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Icon defaults: no global tint override and no per-icon overrides — native
|
|
79
|
+
* renders each vector drawable exactly as shipped (white strokes at their
|
|
80
|
+
* responsive sizes).
|
|
81
|
+
*/
|
|
82
|
+
export const DEFAULT_ICON_CONFIG: CameraIconConfig = {
|
|
83
|
+
overrides: {},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Centralized icon defaults: nothing customized, so every icon resolves to the
|
|
88
|
+
* default the plugin ships. Adding an id to this map is what replaces an icon.
|
|
89
|
+
*/
|
|
90
|
+
export const DEFAULT_CUSTOM_ICONS: CameraIconsConfig = {};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Dimension defaults are intentionally EMPTY: the native UI sizes its chrome
|
|
94
|
+
* responsively (e.g. shutter = 18% of the short screen edge clamped to
|
|
95
|
+
* 64–78dp, control icons = 11.5% clamped to 42–52dp). A value set here becomes
|
|
96
|
+
* a fixed dp override; absence keeps the stock responsive behavior.
|
|
97
|
+
*/
|
|
98
|
+
export const DEFAULT_DIMENSION_CONFIG: CameraDimensionConfig = {};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Upload notification defaults — the current channel ids/names and texts from
|
|
102
|
+
* UploadService.kt. Text defaults live in the localization layer (the same
|
|
103
|
+
* `upload*` keys), so they are omitted here and only override when set.
|
|
104
|
+
*/
|
|
105
|
+
export const DEFAULT_NOTIFICATION_CONFIG: UploadNotificationConfig = {
|
|
106
|
+
progressChannelId: 'UploadServiceChannel',
|
|
107
|
+
progressChannelName: 'Upload Progress',
|
|
108
|
+
resultChannelId: 'UploadResultChannel',
|
|
109
|
+
resultChannelName: 'Upload Status',
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* GIF picker default: GIPHY provider, no API key. With no key the native "Add
|
|
114
|
+
* GIF" button still appears but the picker shows a "not configured" state
|
|
115
|
+
* instead of calling out. Host apps set `gif.apiKey` (and optionally switch
|
|
116
|
+
* `gif.provider` to `tenor`) via {@link configureCameraPlugin}.
|
|
117
|
+
*/
|
|
118
|
+
export const DEFAULT_GIF_CONFIG: GifPickerConfig = {
|
|
119
|
+
provider: 'giphy',
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
123
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function mergeDeep<T>(base: T, override?: Partial<T>): T {
|
|
127
|
+
if (!override) {
|
|
128
|
+
return base;
|
|
129
|
+
}
|
|
130
|
+
const merged = { ...base } as Record<string, unknown>;
|
|
131
|
+
Object.entries(override as Record<string, unknown>).forEach(
|
|
132
|
+
([key, value]) => {
|
|
133
|
+
const existing = merged[key];
|
|
134
|
+
if (isPlainObject(value) && isPlainObject(existing)) {
|
|
135
|
+
merged[key] = mergeDeep(existing, value);
|
|
136
|
+
} else if (value !== undefined) {
|
|
137
|
+
merged[key] = value;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
return merged as T;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** The fully-merged config the plugin currently applies. */
|
|
145
|
+
export type ResolvedCameraPluginConfig = {
|
|
146
|
+
/**
|
|
147
|
+
* The centralized icon configuration: icon id → replacement. This is the
|
|
148
|
+
* section host apps customize; see {@link setCameraIcons}.
|
|
149
|
+
*/
|
|
150
|
+
customIcons: CameraIconsConfig;
|
|
151
|
+
icons: CameraIconConfig;
|
|
152
|
+
animations: typeof DEFAULT_ANIMATION_CONFIG;
|
|
153
|
+
dimensions: CameraDimensionConfig;
|
|
154
|
+
notifications: UploadNotificationConfig;
|
|
155
|
+
gif: GifPickerConfig;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
let currentConfig: ResolvedCameraPluginConfig = {
|
|
159
|
+
customIcons: DEFAULT_CUSTOM_ICONS,
|
|
160
|
+
icons: DEFAULT_ICON_CONFIG,
|
|
161
|
+
animations: DEFAULT_ANIMATION_CONFIG,
|
|
162
|
+
dimensions: DEFAULT_DIMENSION_CONFIG,
|
|
163
|
+
notifications: DEFAULT_NOTIFICATION_CONFIG,
|
|
164
|
+
gif: DEFAULT_GIF_CONFIG,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const configListeners = new Set<(config: ResolvedCameraPluginConfig) => void>();
|
|
168
|
+
|
|
169
|
+
/** Returns the currently active (fully merged) white-label config. */
|
|
170
|
+
export function getCameraPluginConfig(): ResolvedCameraPluginConfig {
|
|
171
|
+
return currentConfig;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Subscribe to config changes; returns an unsubscribe function. */
|
|
175
|
+
export function subscribeToCameraPluginConfig(
|
|
176
|
+
listener: (config: ResolvedCameraPluginConfig) => void
|
|
177
|
+
): () => void {
|
|
178
|
+
configListeners.add(listener);
|
|
179
|
+
return () => {
|
|
180
|
+
configListeners.delete(listener);
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Fold the centralized icon config down onto the native `icons` section.
|
|
186
|
+
*
|
|
187
|
+
* Native only ever sees the legacy wire shape (`{ tintColor, overrides }`), so
|
|
188
|
+
* no Kotlin code has to know the centralized layer exists. Per-icon values from
|
|
189
|
+
* `customIcons` win field-wise over anything set through the lower-level
|
|
190
|
+
* `icons.overrides`, because `customIcons` is the documented entry point.
|
|
191
|
+
*/
|
|
192
|
+
function nativeIconPayload(): CameraIconConfig {
|
|
193
|
+
const legacy = currentConfig.icons;
|
|
194
|
+
const projected = resolveNativeIconConfig(currentConfig.customIcons);
|
|
195
|
+
const legacyOverrides = legacy.overrides ?? {};
|
|
196
|
+
const projectedOverrides = projected.overrides ?? {};
|
|
197
|
+
|
|
198
|
+
const overrides: Partial<Record<CameraIconName, CameraIconStyle>> = {
|
|
199
|
+
...legacyOverrides,
|
|
200
|
+
};
|
|
201
|
+
(Object.keys(projectedOverrides) as CameraIconName[]).forEach((name) => {
|
|
202
|
+
overrides[name] = { ...overrides[name], ...projectedOverrides[name] };
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
return { tintColor: legacy.tintColor, overrides };
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function pushConfigToNative(): Promise<void> {
|
|
209
|
+
const payload = {
|
|
210
|
+
icons: nativeIconPayload(),
|
|
211
|
+
animations: currentConfig.animations,
|
|
212
|
+
dimensions: currentConfig.dimensions,
|
|
213
|
+
notifications: currentConfig.notifications,
|
|
214
|
+
gif: currentConfig.gif,
|
|
215
|
+
};
|
|
216
|
+
const native = NativeCustomCamera as {
|
|
217
|
+
setCameraConfig?: (json: string) => Promise<void>;
|
|
218
|
+
};
|
|
219
|
+
// Older linked binaries without setCameraConfig degrade gracefully: theme
|
|
220
|
+
// and strings still flow through their legacy channels.
|
|
221
|
+
return native.setCameraConfig?.(JSON.stringify(payload)) ?? Promise.resolve();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Configure every customizable aspect of the plugin in one call. Sections are
|
|
226
|
+
* deep-merged over the previous configuration (which starts at the stock
|
|
227
|
+
* defaults), so repeated calls compose. Resolves when the config has been
|
|
228
|
+
* handed to the native layer.
|
|
229
|
+
*
|
|
230
|
+
* ```ts
|
|
231
|
+
* await configureCameraPlugin({
|
|
232
|
+
* theme: { colors: { primary: '#E91E63' } },
|
|
233
|
+
* customIcons: { close: MyCloseIcon, send: { tintColor: '#FFD54F' } },
|
|
234
|
+
* language: 'de',
|
|
235
|
+
* translations: { de: { photoMode: 'Foto', videoMode: 'Video' } },
|
|
236
|
+
* animations: { disableAnimations: true },
|
|
237
|
+
* });
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* `language` also accepts a live provider, which is the one-time setup for
|
|
241
|
+
* automatic language synchronization — after this the whole plugin, React Native
|
|
242
|
+
* screens and native camera alike, follows the host app's language on its own:
|
|
243
|
+
*
|
|
244
|
+
* ```ts
|
|
245
|
+
* await configureCameraPlugin({
|
|
246
|
+
* translations: myBundles,
|
|
247
|
+
* language: {
|
|
248
|
+
* get: () => i18n.language,
|
|
249
|
+
* subscribe: (onChange) => {
|
|
250
|
+
* i18n.on('languageChanged', onChange);
|
|
251
|
+
* return () => i18n.off('languageChanged', onChange);
|
|
252
|
+
* },
|
|
253
|
+
* },
|
|
254
|
+
* });
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
export function configureCameraPlugin(
|
|
258
|
+
config: CameraPluginConfig = {}
|
|
259
|
+
): Promise<void> {
|
|
260
|
+
const {
|
|
261
|
+
theme,
|
|
262
|
+
language,
|
|
263
|
+
translations,
|
|
264
|
+
fallbackLanguage,
|
|
265
|
+
strings,
|
|
266
|
+
rtl,
|
|
267
|
+
customIcons,
|
|
268
|
+
icons,
|
|
269
|
+
animations,
|
|
270
|
+
dimensions,
|
|
271
|
+
notifications,
|
|
272
|
+
gif,
|
|
273
|
+
} = config;
|
|
274
|
+
|
|
275
|
+
currentConfig = {
|
|
276
|
+
customIcons: mergeCameraIconsConfig(currentConfig.customIcons, customIcons),
|
|
277
|
+
icons: mergeDeep(currentConfig.icons, icons),
|
|
278
|
+
animations: mergeDeep(currentConfig.animations, animations),
|
|
279
|
+
dimensions: mergeDeep(currentConfig.dimensions, dimensions),
|
|
280
|
+
notifications: mergeDeep(currentConfig.notifications, notifications),
|
|
281
|
+
gif: mergeDeep(currentConfig.gif, gif),
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// Hand the RN component surface its projection of the same icon config. Done
|
|
285
|
+
// before the listeners fire so a subscriber that re-renders icons already
|
|
286
|
+
// sees the new artwork.
|
|
287
|
+
if (customIcons !== undefined) {
|
|
288
|
+
setGlobalIconRegistryConfig(
|
|
289
|
+
resolveCameraIconRegistryConfig(currentConfig.customIcons)
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
configListeners.forEach((listener) => listener(currentConfig));
|
|
294
|
+
|
|
295
|
+
const work: Promise<unknown>[] = [pushConfigToNative()];
|
|
296
|
+
|
|
297
|
+
if (theme !== undefined) {
|
|
298
|
+
const resolved = setGlobalCameraTheme(theme);
|
|
299
|
+
work.push(
|
|
300
|
+
NativeCustomCamera.setCameraTheme(JSON.stringify(resolved)).catch(() => {
|
|
301
|
+
// Keep configure() resolving even when the native module is absent
|
|
302
|
+
// (web / tests); the JS-side theme store is already updated.
|
|
303
|
+
})
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Localization is merged, never replaced: `configureCameraPlugin({ strings })`
|
|
308
|
+
// must not wipe a language or bundles registered by an earlier call.
|
|
309
|
+
if (
|
|
310
|
+
language !== undefined ||
|
|
311
|
+
translations !== undefined ||
|
|
312
|
+
fallbackLanguage !== undefined ||
|
|
313
|
+
strings !== undefined ||
|
|
314
|
+
rtl !== undefined
|
|
315
|
+
) {
|
|
316
|
+
const localization: CameraLocalizationConfig = {};
|
|
317
|
+
// `language` is either the host's current tag or a live provider. A provider
|
|
318
|
+
// is bound once and keeps reporting, which is what makes the rest of the app
|
|
319
|
+
// follow the host language with no further configure() calls.
|
|
320
|
+
if (language !== undefined) {
|
|
321
|
+
if (isCameraLanguageProvider(language)) {
|
|
322
|
+
localization.languageProvider = language;
|
|
323
|
+
} else {
|
|
324
|
+
localization.locale = language;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (translations !== undefined) localization.bundles = translations;
|
|
328
|
+
if (fallbackLanguage !== undefined) {
|
|
329
|
+
localization.fallbackLocale = fallbackLanguage;
|
|
330
|
+
}
|
|
331
|
+
if (strings !== undefined) localization.translations = strings;
|
|
332
|
+
if (rtl !== undefined) localization.isRtl = rtl;
|
|
333
|
+
|
|
334
|
+
LocalizationManager.updateLocalization(localization);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return Promise.all(work).then(() => undefined);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// ============================================================================
|
|
341
|
+
// Centralized icon configuration
|
|
342
|
+
// ============================================================================
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Replace any of the plugin's icons, on every surface, in one call.
|
|
346
|
+
*
|
|
347
|
+
* Keys are the unique ids from `CAMERA_ICON_CATALOG`; a key you leave out keeps
|
|
348
|
+
* the icon the plugin ships. Repeated calls compose (each icon merges
|
|
349
|
+
* field-wise), so a later `setCameraIcons({ send: { tintColor: 'green' } })`
|
|
350
|
+
* does not undo an earlier `setCameraIcons({ send: MySendIcon })`.
|
|
351
|
+
*
|
|
352
|
+
* ```ts
|
|
353
|
+
* setCameraIcons({
|
|
354
|
+
* close: MyCloseIcon, // React component
|
|
355
|
+
* gallery: require('./gallery.png'), // image
|
|
356
|
+
* send: { tintColor: '#25D366' }, // recolour the built-in icon
|
|
357
|
+
* crop: { resourceName: 'my_crop' }, // Android drawable in your app
|
|
358
|
+
* });
|
|
359
|
+
* ```
|
|
360
|
+
*
|
|
361
|
+
* Resolves once the native camera screen has the configuration.
|
|
362
|
+
*/
|
|
363
|
+
export function setCameraIcons(icons: CameraIconsConfig): Promise<void> {
|
|
364
|
+
return configureCameraPlugin({ customIcons: icons });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** The centralized icon customizations currently in effect. */
|
|
368
|
+
export function getCameraIcons(): CameraIconsConfig {
|
|
369
|
+
return currentConfig.customIcons;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** Drop every icon customization and go back to the plugin's default icons. */
|
|
373
|
+
export function resetCameraIcons(): Promise<void> {
|
|
374
|
+
currentConfig = { ...currentConfig, customIcons: {} };
|
|
375
|
+
setGlobalIconRegistryConfig(undefined);
|
|
376
|
+
configListeners.forEach((listener) => listener(currentConfig));
|
|
377
|
+
return pushConfigToNative();
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Namespace-style facade so integrations can write
|
|
382
|
+
* `CameraPlugin.configure({...})` / `CameraPlugin.getConfig()`.
|
|
383
|
+
*/
|
|
384
|
+
export const CameraPlugin = {
|
|
385
|
+
configure: configureCameraPlugin,
|
|
386
|
+
getConfig: getCameraPluginConfig,
|
|
387
|
+
subscribe: subscribeToCameraPluginConfig,
|
|
388
|
+
setIcons: setCameraIcons,
|
|
389
|
+
getIcons: getCameraIcons,
|
|
390
|
+
resetIcons: resetCameraIcons,
|
|
391
|
+
/** Switch to the host app's newly selected language. */
|
|
392
|
+
setLanguage: setCameraLanguage,
|
|
393
|
+
/**
|
|
394
|
+
* Bind the host app's language once and let every plugin surface follow it
|
|
395
|
+
* automatically from then on. The one-time alternative to `setLanguage`.
|
|
396
|
+
*/
|
|
397
|
+
setLanguageProvider: setCameraLanguageProvider,
|
|
398
|
+
/** Turn automatic language synchronization back off. */
|
|
399
|
+
clearLanguageProvider: clearCameraLanguageProvider,
|
|
400
|
+
/** Re-read the bound language provider, for hosts that cannot notify. */
|
|
401
|
+
syncLanguage: syncCameraLanguage,
|
|
402
|
+
/** The active language tag, or `''` when the host has not set one. */
|
|
403
|
+
getLanguage: getCameraLocale,
|
|
404
|
+
/** Whether plugin UI is currently laid out right-to-left. */
|
|
405
|
+
isRtl: getCameraIsRtl,
|
|
406
|
+
};
|