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,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo, useEffect, useState } from 'react';
|
|
4
|
+
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
5
|
+
import { useCameraTheme } from "./theme.js";
|
|
6
|
+
|
|
7
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
8
|
+
// Single source of truth for WhatsApp-like camera preview dimensions.
|
|
9
|
+
// Aspect ratio ≈ 720:1165 (≈ 9:14.6 ≈ 0.618) – matches WhatsApp's camera preview.
|
|
10
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
/** WhatsApp-like camera preview aspect ratio (720:1165 ≈ 9:14.6 ≈ 0.618) */
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export const WHATSAPP_ASPECT_RATIO = 720 / 1165;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Portrait 9:16 aspect ratio used for the media editing / preview canvas.
|
|
18
|
+
*
|
|
19
|
+
* After capture the user is taken to the editing preview, which always presents
|
|
20
|
+
* a portrait (9:16) canvas regardless of the captured media's own orientation.
|
|
21
|
+
* A landscape photo is scaled and centered (letterboxed) inside this canvas with
|
|
22
|
+
* its aspect ratio preserved — no rotation, stretching, distortion, or cropping.
|
|
23
|
+
* This single constant is the source of truth for that canvas so the on-screen
|
|
24
|
+
* preview matches the final exported / sent image exactly.
|
|
25
|
+
*/
|
|
26
|
+
export const PORTRAIT_PREVIEW_ASPECT_RATIO = 9 / 16;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Responsive preview geometry — the single source of truth. Every value is
|
|
30
|
+
* also exposed through `theme.components.responsivePreviewContainer` so host
|
|
31
|
+
* apps can re-tune them without touching this file.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/** Default geometry — the stock, WhatsApp-like responsive sizing. */
|
|
35
|
+
export const DEFAULT_PREVIEW_DIMENSION_CONFIG = {
|
|
36
|
+
widthRatio: 0.96,
|
|
37
|
+
maxWidth: 720,
|
|
38
|
+
maxHeightRatio: 0.92
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// ── Pure calculation helpers (no React dependency) ───────────────────────────
|
|
42
|
+
|
|
43
|
+
/** Compute preview dimensions from raw screen values */
|
|
44
|
+
export function calcPreviewDimensions(screenW, screenH, config = DEFAULT_PREVIEW_DIMENSION_CONFIG) {
|
|
45
|
+
const width = Math.min(screenW * config.widthRatio, config.maxWidth);
|
|
46
|
+
const height = Math.min(screenH * config.maxHeightRatio, width / WHATSAPP_ASPECT_RATIO);
|
|
47
|
+
return {
|
|
48
|
+
width,
|
|
49
|
+
height,
|
|
50
|
+
aspectRatio: WHATSAPP_ASPECT_RATIO
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Compute portrait 9:16 canvas dimensions from raw screen values.
|
|
56
|
+
*
|
|
57
|
+
* The canvas is fitted (contain) inside the available screen area so the whole
|
|
58
|
+
* 9:16 frame is always visible: it takes the largest 9:16 box that fits within
|
|
59
|
+
* both the width and height budget. The returned dimensions therefore always
|
|
60
|
+
* satisfy `width / height === PORTRAIT_PREVIEW_ASPECT_RATIO`, guaranteeing that
|
|
61
|
+
* the preview shown on screen is the exact same shape as the exported/sent image.
|
|
62
|
+
*/
|
|
63
|
+
export function calcPortraitPreviewDimensions(screenW, screenH, config = DEFAULT_PREVIEW_DIMENSION_CONFIG) {
|
|
64
|
+
// Start from the width budget, then clamp by the height budget so the fixed
|
|
65
|
+
// 9:16 ratio is preserved no matter the screen orientation.
|
|
66
|
+
let width = Math.min(screenW * config.widthRatio, config.maxWidth);
|
|
67
|
+
let height = width / PORTRAIT_PREVIEW_ASPECT_RATIO;
|
|
68
|
+
const maxHeight = screenH * config.maxHeightRatio;
|
|
69
|
+
if (height > maxHeight) {
|
|
70
|
+
height = maxHeight;
|
|
71
|
+
width = height * PORTRAIT_PREVIEW_ASPECT_RATIO;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
width,
|
|
75
|
+
height,
|
|
76
|
+
aspectRatio: PORTRAIT_PREVIEW_ASPECT_RATIO
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ── Static exports (computed once at import-time for lightweight consumers) ─
|
|
81
|
+
|
|
82
|
+
const _initial = Dimensions.get('window');
|
|
83
|
+
export const PREVIEW_WIDTH = calcPreviewDimensions(_initial.width, _initial.height).width;
|
|
84
|
+
export const PREVIEW_HEIGHT = calcPreviewDimensions(_initial.width, _initial.height).height;
|
|
85
|
+
|
|
86
|
+
// ── Reactive hook (recomputes on orientation / dimension changes) ─────────────
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns responsive preview dimensions that update on screen size changes.
|
|
90
|
+
* Use this inside components instead of the static PREVIEW_WIDTH/PREVIEW_HEIGHT
|
|
91
|
+
* exports to ensure correctness after rotation or window resize.
|
|
92
|
+
*/
|
|
93
|
+
export function usePreviewDimensions(config = DEFAULT_PREVIEW_DIMENSION_CONFIG) {
|
|
94
|
+
const [dims, setDims] = useState(() => Dimensions.get('window'));
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
const sub = Dimensions.addEventListener('change', ({
|
|
97
|
+
window
|
|
98
|
+
}) => {
|
|
99
|
+
setDims(window);
|
|
100
|
+
});
|
|
101
|
+
return () => sub.remove();
|
|
102
|
+
}, []);
|
|
103
|
+
return useMemo(() => calcPreviewDimensions(dims.width, dims.height, config), [dims, config]);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Returns responsive portrait 9:16 canvas dimensions that update on screen size
|
|
108
|
+
* changes. Use this for the editing / preview canvas so a captured landscape
|
|
109
|
+
* image is scaled and centered inside a fixed portrait frame, and the preview
|
|
110
|
+
* matches the final exported / sent image exactly.
|
|
111
|
+
*/
|
|
112
|
+
export function usePortraitPreviewDimensions(config = DEFAULT_PREVIEW_DIMENSION_CONFIG) {
|
|
113
|
+
const [dims, setDims] = useState(() => Dimensions.get('window'));
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
const sub = Dimensions.addEventListener('change', ({
|
|
116
|
+
window
|
|
117
|
+
}) => {
|
|
118
|
+
setDims(window);
|
|
119
|
+
});
|
|
120
|
+
return () => sub.remove();
|
|
121
|
+
}, []);
|
|
122
|
+
return useMemo(() => calcPortraitPreviewDimensions(dims.width, dims.height, config), [dims, config]);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ── Component ────────────────────────────────────────────────────────────────
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A fixed-aspect-ratio container that matches WhatsApp's camera preview area.
|
|
129
|
+
*
|
|
130
|
+
* Usage:
|
|
131
|
+
* <ResponsivePreviewContainer>
|
|
132
|
+
* <Image source={…} style={{ width: '100%', height: '100%', resizeMode: 'contain' }} />
|
|
133
|
+
* </ResponsivePreviewContainer>
|
|
134
|
+
*/
|
|
135
|
+
export const ResponsivePreviewContainer = ({
|
|
136
|
+
children,
|
|
137
|
+
style,
|
|
138
|
+
width: explicitWidth,
|
|
139
|
+
height: explicitHeight
|
|
140
|
+
}) => {
|
|
141
|
+
// React hooks must be called unconditionally, so we still call it,
|
|
142
|
+
// but explicit dimensions (when provided) take precedence below.
|
|
143
|
+
const theme = useCameraTheme();
|
|
144
|
+
const rpcTheme = theme.components.responsivePreviewContainer;
|
|
145
|
+
const previewConfig = useMemo(() => ({
|
|
146
|
+
widthRatio: rpcTheme.widthRatio,
|
|
147
|
+
maxWidth: rpcTheme.maxWidth,
|
|
148
|
+
maxHeightRatio: rpcTheme.maxHeightRatio
|
|
149
|
+
}), [rpcTheme.widthRatio, rpcTheme.maxWidth, rpcTheme.maxHeightRatio]);
|
|
150
|
+
const dims = usePreviewDimensions(previewConfig);
|
|
151
|
+
const finalWidth = explicitWidth ?? dims.width;
|
|
152
|
+
const finalHeight = explicitHeight ?? dims.height;
|
|
153
|
+
return /*#__PURE__*/_jsx(View, {
|
|
154
|
+
style: [styles.container, {
|
|
155
|
+
width: finalWidth,
|
|
156
|
+
height: finalHeight,
|
|
157
|
+
borderRadius: theme.components.responsivePreviewContainer.borderRadius,
|
|
158
|
+
backgroundColor: theme.components.responsivePreviewContainer.background
|
|
159
|
+
}, style],
|
|
160
|
+
children: children
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
const styles = StyleSheet.create({
|
|
164
|
+
container: {
|
|
165
|
+
overflow: 'hidden',
|
|
166
|
+
alignSelf: 'center',
|
|
167
|
+
justifyContent: 'center',
|
|
168
|
+
alignItems: 'center'
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
//# sourceMappingURL=ResponsivePreviewContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","useEffect","useState","View","StyleSheet","Dimensions","useCameraTheme","jsx","_jsx","WHATSAPP_ASPECT_RATIO","PORTRAIT_PREVIEW_ASPECT_RATIO","DEFAULT_PREVIEW_DIMENSION_CONFIG","widthRatio","maxWidth","maxHeightRatio","calcPreviewDimensions","screenW","screenH","config","width","Math","min","height","aspectRatio","calcPortraitPreviewDimensions","maxHeight","_initial","get","PREVIEW_WIDTH","PREVIEW_HEIGHT","usePreviewDimensions","dims","setDims","sub","addEventListener","window","remove","usePortraitPreviewDimensions","ResponsivePreviewContainer","children","style","explicitWidth","explicitHeight","theme","rpcTheme","components","responsivePreviewContainer","previewConfig","finalWidth","finalHeight","styles","container","borderRadius","backgroundColor","background","create","overflow","alignSelf","justifyContent","alignItems"],"sourceRoot":"..\\..\\src","sources":["ResponsivePreviewContainer.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SACEC,IAAI,EACJC,UAAU,EACVC,UAAU,QAEL,cAAc;AACrB,SAASC,cAAc,QAAQ,YAAS;;AAExC;AACA;AACA;AACA;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,OAAO,MAAMC,qBAAqB,GAAG,GAAG,GAAG,IAAI;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAA6B,GAAG,CAAC,GAAG,EAAE;;AAEnD;AACA;AACA;AACA;AACA;;AAUA;AACA,OAAO,MAAMC,gCAAwD,GAAG;EACtEC,UAAU,EAAE,IAAI;EAChBC,QAAQ,EAAE,GAAG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,MAAM,GAAG9C,UAAU,CAACmD,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IACTK,QAAQ,EAAE,QAAQ;IAClBC,SAAS,EAAE,QAAQ;IACnBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Accessibility utilities for camera operations
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import { AccessibilityInfo, Platform } from 'react-native';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Check if screen reader is enabled
|
|
12
|
+
*/
|
|
13
|
+
export function useScreenReaderEnabled() {
|
|
14
|
+
const [screenReaderEnabled, setScreenReaderEnabled] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
AccessibilityInfo.isScreenReaderEnabled().then(setScreenReaderEnabled);
|
|
17
|
+
const subscription = AccessibilityInfo.addEventListener('screenReaderChanged', setScreenReaderEnabled);
|
|
18
|
+
return () => subscription.remove();
|
|
19
|
+
}, []);
|
|
20
|
+
return screenReaderEnabled;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Check if reduced motion is enabled
|
|
25
|
+
*/
|
|
26
|
+
export function useReducedMotion() {
|
|
27
|
+
const [reduceMotion, setReduceMotion] = useState(false);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (Platform.OS === 'ios') {
|
|
30
|
+
AccessibilityInfo.isReduceMotionEnabled().then(setReduceMotion);
|
|
31
|
+
const subscription = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduceMotion);
|
|
32
|
+
return () => subscription.remove();
|
|
33
|
+
}
|
|
34
|
+
return () => {};
|
|
35
|
+
}, []);
|
|
36
|
+
return reduceMotion;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if bold text is enabled
|
|
41
|
+
*/
|
|
42
|
+
export function useBoldText() {
|
|
43
|
+
const [boldTextEnabled, setBoldTextEnabled] = useState(false);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
AccessibilityInfo.isBoldTextEnabled().then(setBoldTextEnabled);
|
|
46
|
+
const subscription = AccessibilityInfo.addEventListener('boldTextChanged', setBoldTextEnabled);
|
|
47
|
+
return () => subscription.remove();
|
|
48
|
+
}, []);
|
|
49
|
+
return boldTextEnabled;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Announce text for screen readers
|
|
54
|
+
*/
|
|
55
|
+
export function announceForAccessibility(announcement) {
|
|
56
|
+
if (Platform.OS === 'ios') {
|
|
57
|
+
AccessibilityInfo.announceForAccessibility(announcement);
|
|
58
|
+
}
|
|
59
|
+
// Android accessibility announcements require native implementation
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=accessibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","AccessibilityInfo","Platform","useScreenReaderEnabled","screenReaderEnabled","setScreenReaderEnabled","isScreenReaderEnabled","then","subscription","addEventListener","remove","useReducedMotion","reduceMotion","setReduceMotion","OS","isReduceMotionEnabled","useBoldText","boldTextEnabled","setBoldTextEnabled","isBoldTextEnabled","announceForAccessibility","announcement"],"sourceRoot":"..\\..\\src","sources":["accessibility.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,cAAc;;AAE1D;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAA,EAAY;EAChD,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GAAGL,QAAQ,CAAC,KAAK,CAAC;EAErED,SAAS,CAAC,MAAM;IACdE,iBAAiB,CAACK,qBAAqB,CAAC,CAAC,CAACC,IAAI,CAACF,sBA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AAK,EAAE;IACzBb,iBAAiB,CAACmB,wBAAwB,CAACC,YAAY,CAAC;EAC1D;EACA;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Centralized white-label configuration for the camera plugin.
|
|
5
|
+
*
|
|
6
|
+
* `configureCameraPlugin()` (aliased as `CameraPlugin.configure`) is the single
|
|
7
|
+
* entry point host apps use to re-brand every visual aspect of the plugin:
|
|
8
|
+
* theme (colors/typography/spacing/radii/component styles), strings, icons
|
|
9
|
+
* (tint/size/resource overrides), animation durations, structural dimensions,
|
|
10
|
+
* and upload-notification appearance.
|
|
11
|
+
*
|
|
12
|
+
* Every section is optional and deep-merged over defaults extracted verbatim
|
|
13
|
+
* from the previously hardcoded values — calling nothing, or calling
|
|
14
|
+
* `configure({})`, leaves the plugin pixel-identical to its stock appearance.
|
|
15
|
+
*
|
|
16
|
+
* The merged config is kept globally on the JS side (for the RN components and
|
|
17
|
+
* `useCameraConfig`) and serialized once to native via `setCameraConfig`,
|
|
18
|
+
* where the Android Activity/editor reads it on launch. The legacy
|
|
19
|
+
* `setCameraTheme()` / `setCameraLocalization()` entry points remain fully
|
|
20
|
+
* supported and now route through the same store.
|
|
21
|
+
*/
|
|
22
|
+
import NativeCustomCamera from './NativeCustomCamera';
|
|
23
|
+
import { setGlobalCameraTheme } from "./theme.js";
|
|
24
|
+
import { clearCameraLanguageProvider, getCameraIsRtl, getCameraLocale, isCameraLanguageProvider, LocalizationManager, setCameraLanguage, setCameraLanguageProvider, syncCameraLanguage } from "./localization.js";
|
|
25
|
+
import { setGlobalIconRegistryConfig } from "./icons.js";
|
|
26
|
+
import { mergeCameraIconsConfig, resolveCameraIconRegistryConfig, resolveNativeIconConfig } from "./iconConfig.js";
|
|
27
|
+
/**
|
|
28
|
+
* Default animation durations (ms) — extracted verbatim from the native views
|
|
29
|
+
* (CustomCameraActivity, MediaPreviewEditor, MediaAdapters). Changing these
|
|
30
|
+
* values changes the native UI; leaving them produces the exact stock motion.
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_ANIMATION_CONFIG = {
|
|
33
|
+
disableAnimations: false,
|
|
34
|
+
shutterPress: 80,
|
|
35
|
+
controlsFade: 180,
|
|
36
|
+
stripSlideIn: 260,
|
|
37
|
+
stripSlideOut: 220,
|
|
38
|
+
selectionFade: 150,
|
|
39
|
+
posterFade: 120,
|
|
40
|
+
playPauseFlash: 200,
|
|
41
|
+
playPauseFadeOut: 600,
|
|
42
|
+
playPauseFadeDelay: 400,
|
|
43
|
+
overlayFadeIn: 250,
|
|
44
|
+
overlayFadeOut: 200,
|
|
45
|
+
panelSlideIn: 350,
|
|
46
|
+
panelSlideOut: 300,
|
|
47
|
+
editorIconFade: 180,
|
|
48
|
+
quickFade: 150
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Icon defaults: no global tint override and no per-icon overrides — native
|
|
53
|
+
* renders each vector drawable exactly as shipped (white strokes at their
|
|
54
|
+
* responsive sizes).
|
|
55
|
+
*/
|
|
56
|
+
export const DEFAULT_ICON_CONFIG = {
|
|
57
|
+
overrides: {}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Centralized icon defaults: nothing customized, so every icon resolves to the
|
|
62
|
+
* default the plugin ships. Adding an id to this map is what replaces an icon.
|
|
63
|
+
*/
|
|
64
|
+
export const DEFAULT_CUSTOM_ICONS = {};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Dimension defaults are intentionally EMPTY: the native UI sizes its chrome
|
|
68
|
+
* responsively (e.g. shutter = 18% of the short screen edge clamped to
|
|
69
|
+
* 64–78dp, control icons = 11.5% clamped to 42–52dp). A value set here becomes
|
|
70
|
+
* a fixed dp override; absence keeps the stock responsive behavior.
|
|
71
|
+
*/
|
|
72
|
+
export const DEFAULT_DIMENSION_CONFIG = {};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Upload notification defaults — the current channel ids/names and texts from
|
|
76
|
+
* UploadService.kt. Text defaults live in the localization layer (the same
|
|
77
|
+
* `upload*` keys), so they are omitted here and only override when set.
|
|
78
|
+
*/
|
|
79
|
+
export const DEFAULT_NOTIFICATION_CONFIG = {
|
|
80
|
+
progressChannelId: 'UploadServiceChannel',
|
|
81
|
+
progressChannelName: 'Upload Progress',
|
|
82
|
+
resultChannelId: 'UploadResultChannel',
|
|
83
|
+
resultChannelName: 'Upload Status'
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* GIF picker default: GIPHY provider, no API key. With no key the native "Add
|
|
88
|
+
* GIF" button still appears but the picker shows a "not configured" state
|
|
89
|
+
* instead of calling out. Host apps set `gif.apiKey` (and optionally switch
|
|
90
|
+
* `gif.provider` to `tenor`) via {@link configureCameraPlugin}.
|
|
91
|
+
*/
|
|
92
|
+
export const DEFAULT_GIF_CONFIG = {
|
|
93
|
+
provider: 'giphy'
|
|
94
|
+
};
|
|
95
|
+
function isPlainObject(value) {
|
|
96
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
97
|
+
}
|
|
98
|
+
function mergeDeep(base, override) {
|
|
99
|
+
if (!override) {
|
|
100
|
+
return base;
|
|
101
|
+
}
|
|
102
|
+
const merged = {
|
|
103
|
+
...base
|
|
104
|
+
};
|
|
105
|
+
Object.entries(override).forEach(([key, value]) => {
|
|
106
|
+
const existing = merged[key];
|
|
107
|
+
if (isPlainObject(value) && isPlainObject(existing)) {
|
|
108
|
+
merged[key] = mergeDeep(existing, value);
|
|
109
|
+
} else if (value !== undefined) {
|
|
110
|
+
merged[key] = value;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return merged;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The fully-merged config the plugin currently applies. */
|
|
117
|
+
|
|
118
|
+
let currentConfig = {
|
|
119
|
+
customIcons: DEFAULT_CUSTOM_ICONS,
|
|
120
|
+
icons: DEFAULT_ICON_CONFIG,
|
|
121
|
+
animations: DEFAULT_ANIMATION_CONFIG,
|
|
122
|
+
dimensions: DEFAULT_DIMENSION_CONFIG,
|
|
123
|
+
notifications: DEFAULT_NOTIFICATION_CONFIG,
|
|
124
|
+
gif: DEFAULT_GIF_CONFIG
|
|
125
|
+
};
|
|
126
|
+
const configListeners = new Set();
|
|
127
|
+
|
|
128
|
+
/** Returns the currently active (fully merged) white-label config. */
|
|
129
|
+
export function getCameraPluginConfig() {
|
|
130
|
+
return currentConfig;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Subscribe to config changes; returns an unsubscribe function. */
|
|
134
|
+
export function subscribeToCameraPluginConfig(listener) {
|
|
135
|
+
configListeners.add(listener);
|
|
136
|
+
return () => {
|
|
137
|
+
configListeners.delete(listener);
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Fold the centralized icon config down onto the native `icons` section.
|
|
143
|
+
*
|
|
144
|
+
* Native only ever sees the legacy wire shape (`{ tintColor, overrides }`), so
|
|
145
|
+
* no Kotlin code has to know the centralized layer exists. Per-icon values from
|
|
146
|
+
* `customIcons` win field-wise over anything set through the lower-level
|
|
147
|
+
* `icons.overrides`, because `customIcons` is the documented entry point.
|
|
148
|
+
*/
|
|
149
|
+
function nativeIconPayload() {
|
|
150
|
+
const legacy = currentConfig.icons;
|
|
151
|
+
const projected = resolveNativeIconConfig(currentConfig.customIcons);
|
|
152
|
+
const legacyOverrides = legacy.overrides ?? {};
|
|
153
|
+
const projectedOverrides = projected.overrides ?? {};
|
|
154
|
+
const overrides = {
|
|
155
|
+
...legacyOverrides
|
|
156
|
+
};
|
|
157
|
+
Object.keys(projectedOverrides).forEach(name => {
|
|
158
|
+
overrides[name] = {
|
|
159
|
+
...overrides[name],
|
|
160
|
+
...projectedOverrides[name]
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
return {
|
|
164
|
+
tintColor: legacy.tintColor,
|
|
165
|
+
overrides
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function pushConfigToNative() {
|
|
169
|
+
const payload = {
|
|
170
|
+
icons: nativeIconPayload(),
|
|
171
|
+
animations: currentConfig.animations,
|
|
172
|
+
dimensions: currentConfig.dimensions,
|
|
173
|
+
notifications: currentConfig.notifications,
|
|
174
|
+
gif: currentConfig.gif
|
|
175
|
+
};
|
|
176
|
+
const native = NativeCustomCamera;
|
|
177
|
+
// Older linked binaries without setCameraConfig degrade gracefully: theme
|
|
178
|
+
// and strings still flow through their legacy channels.
|
|
179
|
+
return native.setCameraConfig?.(JSON.stringify(payload)) ?? Promise.resolve();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Configure every customizable aspect of the plugin in one call. Sections are
|
|
184
|
+
* deep-merged over the previous configuration (which starts at the stock
|
|
185
|
+
* defaults), so repeated calls compose. Resolves when the config has been
|
|
186
|
+
* handed to the native layer.
|
|
187
|
+
*
|
|
188
|
+
* ```ts
|
|
189
|
+
* await configureCameraPlugin({
|
|
190
|
+
* theme: { colors: { primary: '#E91E63' } },
|
|
191
|
+
* customIcons: { close: MyCloseIcon, send: { tintColor: '#FFD54F' } },
|
|
192
|
+
* language: 'de',
|
|
193
|
+
* translations: { de: { photoMode: 'Foto', videoMode: 'Video' } },
|
|
194
|
+
* animations: { disableAnimations: true },
|
|
195
|
+
* });
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* `language` also accepts a live provider, which is the one-time setup for
|
|
199
|
+
* automatic language synchronization — after this the whole plugin, React Native
|
|
200
|
+
* screens and native camera alike, follows the host app's language on its own:
|
|
201
|
+
*
|
|
202
|
+
* ```ts
|
|
203
|
+
* await configureCameraPlugin({
|
|
204
|
+
* translations: myBundles,
|
|
205
|
+
* language: {
|
|
206
|
+
* get: () => i18n.language,
|
|
207
|
+
* subscribe: (onChange) => {
|
|
208
|
+
* i18n.on('languageChanged', onChange);
|
|
209
|
+
* return () => i18n.off('languageChanged', onChange);
|
|
210
|
+
* },
|
|
211
|
+
* },
|
|
212
|
+
* });
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
export function configureCameraPlugin(config = {}) {
|
|
216
|
+
const {
|
|
217
|
+
theme,
|
|
218
|
+
language,
|
|
219
|
+
translations,
|
|
220
|
+
fallbackLanguage,
|
|
221
|
+
strings,
|
|
222
|
+
rtl,
|
|
223
|
+
customIcons,
|
|
224
|
+
icons,
|
|
225
|
+
animations,
|
|
226
|
+
dimensions,
|
|
227
|
+
notifications,
|
|
228
|
+
gif
|
|
229
|
+
} = config;
|
|
230
|
+
currentConfig = {
|
|
231
|
+
customIcons: mergeCameraIconsConfig(currentConfig.customIcons, customIcons),
|
|
232
|
+
icons: mergeDeep(currentConfig.icons, icons),
|
|
233
|
+
animations: mergeDeep(currentConfig.animations, animations),
|
|
234
|
+
dimensions: mergeDeep(currentConfig.dimensions, dimensions),
|
|
235
|
+
notifications: mergeDeep(currentConfig.notifications, notifications),
|
|
236
|
+
gif: mergeDeep(currentConfig.gif, gif)
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// Hand the RN component surface its projection of the same icon config. Done
|
|
240
|
+
// before the listeners fire so a subscriber that re-renders icons already
|
|
241
|
+
// sees the new artwork.
|
|
242
|
+
if (customIcons !== undefined) {
|
|
243
|
+
setGlobalIconRegistryConfig(resolveCameraIconRegistryConfig(currentConfig.customIcons));
|
|
244
|
+
}
|
|
245
|
+
configListeners.forEach(listener => listener(currentConfig));
|
|
246
|
+
const work = [pushConfigToNative()];
|
|
247
|
+
if (theme !== undefined) {
|
|
248
|
+
const resolved = setGlobalCameraTheme(theme);
|
|
249
|
+
work.push(NativeCustomCamera.setCameraTheme(JSON.stringify(resolved)).catch(() => {
|
|
250
|
+
// Keep configure() resolving even when the native module is absent
|
|
251
|
+
// (web / tests); the JS-side theme store is already updated.
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Localization is merged, never replaced: `configureCameraPlugin({ strings })`
|
|
256
|
+
// must not wipe a language or bundles registered by an earlier call.
|
|
257
|
+
if (language !== undefined || translations !== undefined || fallbackLanguage !== undefined || strings !== undefined || rtl !== undefined) {
|
|
258
|
+
const localization = {};
|
|
259
|
+
// `language` is either the host's current tag or a live provider. A provider
|
|
260
|
+
// is bound once and keeps reporting, which is what makes the rest of the app
|
|
261
|
+
// follow the host language with no further configure() calls.
|
|
262
|
+
if (language !== undefined) {
|
|
263
|
+
if (isCameraLanguageProvider(language)) {
|
|
264
|
+
localization.languageProvider = language;
|
|
265
|
+
} else {
|
|
266
|
+
localization.locale = language;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (translations !== undefined) localization.bundles = translations;
|
|
270
|
+
if (fallbackLanguage !== undefined) {
|
|
271
|
+
localization.fallbackLocale = fallbackLanguage;
|
|
272
|
+
}
|
|
273
|
+
if (strings !== undefined) localization.translations = strings;
|
|
274
|
+
if (rtl !== undefined) localization.isRtl = rtl;
|
|
275
|
+
LocalizationManager.updateLocalization(localization);
|
|
276
|
+
}
|
|
277
|
+
return Promise.all(work).then(() => undefined);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// ============================================================================
|
|
281
|
+
// Centralized icon configuration
|
|
282
|
+
// ============================================================================
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Replace any of the plugin's icons, on every surface, in one call.
|
|
286
|
+
*
|
|
287
|
+
* Keys are the unique ids from `CAMERA_ICON_CATALOG`; a key you leave out keeps
|
|
288
|
+
* the icon the plugin ships. Repeated calls compose (each icon merges
|
|
289
|
+
* field-wise), so a later `setCameraIcons({ send: { tintColor: 'green' } })`
|
|
290
|
+
* does not undo an earlier `setCameraIcons({ send: MySendIcon })`.
|
|
291
|
+
*
|
|
292
|
+
* ```ts
|
|
293
|
+
* setCameraIcons({
|
|
294
|
+
* close: MyCloseIcon, // React component
|
|
295
|
+
* gallery: require('./gallery.png'), // image
|
|
296
|
+
* send: { tintColor: '#25D366' }, // recolour the built-in icon
|
|
297
|
+
* crop: { resourceName: 'my_crop' }, // Android drawable in your app
|
|
298
|
+
* });
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* Resolves once the native camera screen has the configuration.
|
|
302
|
+
*/
|
|
303
|
+
export function setCameraIcons(icons) {
|
|
304
|
+
return configureCameraPlugin({
|
|
305
|
+
customIcons: icons
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** The centralized icon customizations currently in effect. */
|
|
310
|
+
export function getCameraIcons() {
|
|
311
|
+
return currentConfig.customIcons;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Drop every icon customization and go back to the plugin's default icons. */
|
|
315
|
+
export function resetCameraIcons() {
|
|
316
|
+
currentConfig = {
|
|
317
|
+
...currentConfig,
|
|
318
|
+
customIcons: {}
|
|
319
|
+
};
|
|
320
|
+
setGlobalIconRegistryConfig(undefined);
|
|
321
|
+
configListeners.forEach(listener => listener(currentConfig));
|
|
322
|
+
return pushConfigToNative();
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Namespace-style facade so integrations can write
|
|
327
|
+
* `CameraPlugin.configure({...})` / `CameraPlugin.getConfig()`.
|
|
328
|
+
*/
|
|
329
|
+
export const CameraPlugin = {
|
|
330
|
+
configure: configureCameraPlugin,
|
|
331
|
+
getConfig: getCameraPluginConfig,
|
|
332
|
+
subscribe: subscribeToCameraPluginConfig,
|
|
333
|
+
setIcons: setCameraIcons,
|
|
334
|
+
getIcons: getCameraIcons,
|
|
335
|
+
resetIcons: resetCameraIcons,
|
|
336
|
+
/** Switch to the host app's newly selected language. */
|
|
337
|
+
setLanguage: setCameraLanguage,
|
|
338
|
+
/**
|
|
339
|
+
* Bind the host app's language once and let every plugin surface follow it
|
|
340
|
+
* automatically from then on. The one-time alternative to `setLanguage`.
|
|
341
|
+
*/
|
|
342
|
+
setLanguageProvider: setCameraLanguageProvider,
|
|
343
|
+
/** Turn automatic language synchronization back off. */
|
|
344
|
+
clearLanguageProvider: clearCameraLanguageProvider,
|
|
345
|
+
/** Re-read the bound language provider, for hosts that cannot notify. */
|
|
346
|
+
syncLanguage: syncCameraLanguage,
|
|
347
|
+
/** The active language tag, or `''` when the host has not set one. */
|
|
348
|
+
getLanguage: getCameraLocale,
|
|
349
|
+
/** Whether plugin UI is currently laid out right-to-left. */
|
|
350
|
+
isRtl: getCameraIsRtl
|
|
351
|
+
};
|
|
352
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeCustomCamera","setGlobalCameraTheme","clearCameraLanguageProvider","getCameraIsRtl","getCameraLocale","isCameraLanguageProvider","LocalizationManager","setCameraLanguage","setCameraLanguageProvider","syncCameraLanguage","setGlobalIconRegistryConfig","mergeCameraIconsConfig","resolveCameraIconRegistryConfig","resolveNativeIconConfig","DEFAULT_ANIMATION_CONFIG","disableAnimations","shutterPress","controlsFade","stripSlideIn","stripSlideOut","selectionFade","posterFade","playPauseFlash","playPauseFadeOut","playPauseFadeDelay","overlayFadeIn","overlayFadeOut","panelSlideIn","panelSlideOut","editorIconFade","quickFade","DEFAULT_ICON_CONFIG","overrides","DEFAULT_CUSTOM_ICONS","DEFAULT_DIMENSION_CONFIG","DEFAULT_NOTIFICATION_CONFIG","progressChannelId","progressChannelName","resultChannelId","resultChannelName","DEFAULT_GIF_CONFIG","provider","isPlainObject","value","Array","isArray","mergeDeep","base","override","merged","Object","entries","forEach","key","existing","undefined","currentConfig","customIcons","icons","animations","dimensions","notifications","gif","configListeners","Set","getCameraPluginConfig","subscribeToCameraPluginConfig","listener","add","delete","nativeIconPayload","legacy","projected","legacyOverrides","projectedOverrides","keys","name","tintColor","pushConfigToNative","payload","native","setCameraConfig","JSON","stringify","Promise","resolve","configureCameraPlugin","config","theme","language","translations","fallbackLanguage","strings","rtl","work","resolved","push","setCameraTheme","catch","localization","languageProvider","locale","bundles","fallbackLocale","isRtl","updateLocalization","all","then","setCameraIcons","getCameraIcons","resetCameraIcons","CameraPlugin","configure","getConfig","subscribe","setIcons","getIcons","resetIcons","setLanguage","setLanguageProvider","clearLanguageProvider","syncLanguage","getLanguage"],"sourceRoot":"..\\..\\src","sources":["config.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,kBAAkB,MAAM,sBAAsB;AACrD,SAASC,oBAAoB,QAAQ,YAAS;AAC9C,SACEC,2BAA2B,EAC3BC,cAAc,EACdC,eAAe,EACfC,wBAAwB,EACxBC,mBAAmB,EACnBC,iBAAiB,EACjBC,yBAAyB,EACzBC,kBAAkB,QACb,mBAAgB;AAEvB,SAASC,2BAA2B,QAAQ,YAAS;AACrD,SACEC,sBAAsB,EACtBC,+BAA+B,EAC/BC,uBAAuB,QAElB,iBAAc;AAYrB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAEqB,GAAG;EACnCC,iBAAiB,EAAE,KAAK;EACxBC,YAAY,EAAE,EAAE;EAChBC,YAAY,EAAE,GAAG;EACjBC,YAAY,EAAE,GAAG;EACjBC,aAAa,EAAE,GAAG;EAClBC,aAAa,EAAE,GAAG;EAClBC,UAAU,EAAE,GAAG;EACfC,cAAc,EAAE,GAAG;EACnBC,gBAAgB,EAAE,GAAG;EACrBC,kBAAkB,EAAE,GAAG;EACvBC,aAAa,EAAE,GAAG;EAClBC,cAAc,EAAE,GAAG;EACnBC,YAAY,EAAE,GAAG;EACjBC,aAAa,EAAE,GAAG;EAClBC,cAAc,EAAE,GAAG;EACnBC,SAAS,EAAE;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAqC,GAAG;EACnDC,SAAS,EAAE,CAAC;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAuC,GAAG,CAAC,CAAC;;A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