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.
Files changed (506) hide show
  1. package/CustomCamera.podspec +20 -0
  2. package/LICENSE +20 -0
  3. package/README.md +833 -0
  4. package/android/build.gradle +135 -0
  5. package/android/consumer-rules.pro +47 -0
  6. package/android/src/main/AndroidManifest.xml +72 -0
  7. package/android/src/main/java/android/print/PdfPrint.java +51 -0
  8. package/android/src/main/java/com/customcamera/AnimatedImageViewManager.kt +199 -0
  9. package/android/src/main/java/com/customcamera/AudioPlayerView.kt +322 -0
  10. package/android/src/main/java/com/customcamera/AudioRecorder.kt +506 -0
  11. package/android/src/main/java/com/customcamera/BarcodeScannerActivity.kt +361 -0
  12. package/android/src/main/java/com/customcamera/BlurBackgroundView.kt +199 -0
  13. package/android/src/main/java/com/customcamera/CacheCleanupManager.kt +386 -0
  14. package/android/src/main/java/com/customcamera/CameraAspectRatioMode.kt +77 -0
  15. package/android/src/main/java/com/customcamera/CameraAsset.kt +211 -0
  16. package/android/src/main/java/com/customcamera/CameraTheme.kt +479 -0
  17. package/android/src/main/java/com/customcamera/CompressionCacheStore.kt +504 -0
  18. package/android/src/main/java/com/customcamera/CompressionFileNameUtils.kt +7 -0
  19. package/android/src/main/java/com/customcamera/CompressionProfile.kt +195 -0
  20. package/android/src/main/java/com/customcamera/CustomCameraActivity.kt +7291 -0
  21. package/android/src/main/java/com/customcamera/CustomCameraFileProvider.kt +9 -0
  22. package/android/src/main/java/com/customcamera/CustomCameraModule.kt +2479 -0
  23. package/android/src/main/java/com/customcamera/CustomCameraPackage.kt +53 -0
  24. package/android/src/main/java/com/customcamera/DisplayUtils.kt +9 -0
  25. package/android/src/main/java/com/customcamera/DocumentPreviewView.kt +846 -0
  26. package/android/src/main/java/com/customcamera/DrawingView.kt +214 -0
  27. package/android/src/main/java/com/customcamera/EmojiPickerData.kt +228 -0
  28. package/android/src/main/java/com/customcamera/FilterStripAdapter.kt +158 -0
  29. package/android/src/main/java/com/customcamera/GifSupport.kt +215 -0
  30. package/android/src/main/java/com/customcamera/GlobalAudioPlayer.kt +320 -0
  31. package/android/src/main/java/com/customcamera/ImageExporter.kt +1394 -0
  32. package/android/src/main/java/com/customcamera/ImageFormatSupport.kt +163 -0
  33. package/android/src/main/java/com/customcamera/Localization.kt +206 -0
  34. package/android/src/main/java/com/customcamera/MediaAdapters.kt +758 -0
  35. package/android/src/main/java/com/customcamera/MediaCacheManager.kt +782 -0
  36. package/android/src/main/java/com/customcamera/MediaExportFormats.kt +201 -0
  37. package/android/src/main/java/com/customcamera/MediaFileIo.kt +310 -0
  38. package/android/src/main/java/com/customcamera/MediaMetadataStore.kt +494 -0
  39. package/android/src/main/java/com/customcamera/MediaPreviewEditor.kt +14865 -0
  40. package/android/src/main/java/com/customcamera/MediaPublisher.kt +423 -0
  41. package/android/src/main/java/com/customcamera/MediaStorageWorkflow.kt +722 -0
  42. package/android/src/main/java/com/customcamera/MediaStoreRepository.kt +378 -0
  43. package/android/src/main/java/com/customcamera/MediaThumbnailView.kt +286 -0
  44. package/android/src/main/java/com/customcamera/MediaUtils.kt +37 -0
  45. package/android/src/main/java/com/customcamera/NativeVideoViewManager.kt +845 -0
  46. package/android/src/main/java/com/customcamera/OfficeDocumentConverter.kt +2791 -0
  47. package/android/src/main/java/com/customcamera/PendingCaptureCrops.kt +88 -0
  48. package/android/src/main/java/com/customcamera/PowerPointPreview.kt +4077 -0
  49. package/android/src/main/java/com/customcamera/RecentPickerStore.kt +74 -0
  50. package/android/src/main/java/com/customcamera/SecureFileEraser.kt +411 -0
  51. package/android/src/main/java/com/customcamera/SecureKeyModule.kt +88 -0
  52. package/android/src/main/java/com/customcamera/SecureMediaDeleter.kt +493 -0
  53. package/android/src/main/java/com/customcamera/StickerPickerData.kt +107 -0
  54. package/android/src/main/java/com/customcamera/SvgDrawable.kt +175 -0
  55. package/android/src/main/java/com/customcamera/SvgIconViewManager.kt +77 -0
  56. package/android/src/main/java/com/customcamera/TextEntryController.kt +553 -0
  57. package/android/src/main/java/com/customcamera/ThumbnailLoader.kt +455 -0
  58. package/android/src/main/java/com/customcamera/UploadService.kt +909 -0
  59. package/android/src/main/java/com/customcamera/VideoEditUtils.kt +210 -0
  60. package/android/src/main/java/com/customcamera/VideoRotationTranscoder.kt +1992 -0
  61. package/android/src/main/java/com/customcamera/gif/AnimatedGifEncoder.kt +473 -0
  62. package/android/src/main/java/com/customcamera/gif/GifDecoder.kt +690 -0
  63. package/android/src/main/java/com/customcamera/gif/GifFramesDrawable.kt +160 -0
  64. package/android/src/main/java/com/customcamera/gif/GifHttp.kt +112 -0
  65. package/android/src/main/java/com/customcamera/gif/GifImageLoader.kt +186 -0
  66. package/android/src/main/java/com/customcamera/gif/GifModels.kt +74 -0
  67. package/android/src/main/java/com/customcamera/gif/GifProvider.kt +49 -0
  68. package/android/src/main/java/com/customcamera/gif/GifProviders.kt +27 -0
  69. package/android/src/main/java/com/customcamera/gif/GifRepository.kt +124 -0
  70. package/android/src/main/java/com/customcamera/gif/GifSafety.kt +33 -0
  71. package/android/src/main/java/com/customcamera/gif/GiphyGifProvider.kt +146 -0
  72. package/android/src/main/java/com/customcamera/gif/LZWEncoder.kt +258 -0
  73. package/android/src/main/java/com/customcamera/gif/NeuQuant.kt +435 -0
  74. package/android/src/main/java/com/customcamera/gif/TenorGifProvider.kt +147 -0
  75. package/android/src/main/res/drawable/bg_brush_selected.xml +5 -0
  76. package/android/src/main/res/drawable/bg_color_swatch.xml +5 -0
  77. package/android/src/main/res/drawable/bg_editor_toolbar.xml +6 -0
  78. package/android/src/main/res/drawable/bg_icon_circle.xml +5 -0
  79. package/android/src/main/res/drawable/bg_icon_circle_light.xml +5 -0
  80. package/android/src/main/res/drawable/bg_mode_tab_active.xml +6 -0
  81. package/android/src/main/res/drawable/bg_pill.xml +6 -0
  82. package/android/src/main/res/drawable/bg_recording_dot.xml +6 -0
  83. package/android/src/main/res/drawable/bg_selection_badge.xml +8 -0
  84. package/android/src/main/res/drawable/bg_send_button.xml +5 -0
  85. package/android/src/main/res/drawable/bg_shutter_inner.xml +5 -0
  86. package/android/src/main/res/drawable/bg_shutter_recording.xml +6 -0
  87. package/android/src/main/res/drawable/bg_shutter_ring.xml +8 -0
  88. package/android/src/main/res/drawable/bg_shutter_video_idle.xml +5 -0
  89. package/android/src/main/res/drawable/bg_thumbnail.xml +9 -0
  90. package/android/src/main/res/drawable/ic_aspect_ratio.xml +17 -0
  91. package/android/src/main/res/drawable/ic_audio.xml +10 -0
  92. package/android/src/main/res/drawable/ic_back.xml +10 -0
  93. package/android/src/main/res/drawable/ic_brush_medium.xml +12 -0
  94. package/android/src/main/res/drawable/ic_brush_thick.xml +12 -0
  95. package/android/src/main/res/drawable/ic_brush_thin.xml +12 -0
  96. package/android/src/main/res/drawable/ic_check.xml +17 -0
  97. package/android/src/main/res/drawable/ic_chevron_down.xml +10 -0
  98. package/android/src/main/res/drawable/ic_chevron_up.xml +13 -0
  99. package/android/src/main/res/drawable/ic_clear_drawing.xml +10 -0
  100. package/android/src/main/res/drawable/ic_close.xml +10 -0
  101. package/android/src/main/res/drawable/ic_cover.xml +9 -0
  102. package/android/src/main/res/drawable/ic_crop.xml +10 -0
  103. package/android/src/main/res/drawable/ic_delete.xml +9 -0
  104. package/android/src/main/res/drawable/ic_document.xml +10 -0
  105. package/android/src/main/res/drawable/ic_done.xml +10 -0
  106. package/android/src/main/res/drawable/ic_download.xml +10 -0
  107. package/android/src/main/res/drawable/ic_emoji.xml +10 -0
  108. package/android/src/main/res/drawable/ic_filter.xml +10 -0
  109. package/android/src/main/res/drawable/ic_flash_auto.xml +7 -0
  110. package/android/src/main/res/drawable/ic_flash_off.xml +23 -0
  111. package/android/src/main/res/drawable/ic_flash_on.xml +16 -0
  112. package/android/src/main/res/drawable/ic_flip.xml +15 -0
  113. package/android/src/main/res/drawable/ic_gallery.xml +10 -0
  114. package/android/src/main/res/drawable/ic_gif.xml +24 -0
  115. package/android/src/main/res/drawable/ic_lock.xml +19 -0
  116. package/android/src/main/res/drawable/ic_lock_open.xml +22 -0
  117. package/android/src/main/res/drawable/ic_marker.xml +10 -0
  118. package/android/src/main/res/drawable/ic_more_vert.xml +18 -0
  119. package/android/src/main/res/drawable/ic_overlay_close.xml +19 -0
  120. package/android/src/main/res/drawable/ic_overlay_resize.xml +18 -0
  121. package/android/src/main/res/drawable/ic_pause.xml +10 -0
  122. package/android/src/main/res/drawable/ic_photo_mode.xml +10 -0
  123. package/android/src/main/res/drawable/ic_play.xml +10 -0
  124. package/android/src/main/res/drawable/ic_redo.xml +10 -0
  125. package/android/src/main/res/drawable/ic_rotate.xml +9 -0
  126. package/android/src/main/res/drawable/ic_send.xml +10 -0
  127. package/android/src/main/res/drawable/ic_share.xml +10 -0
  128. package/android/src/main/res/drawable/ic_stat_upload.xml +10 -0
  129. package/android/src/main/res/drawable/ic_sticker.xml +24 -0
  130. package/android/src/main/res/drawable/ic_text.xml +10 -0
  131. package/android/src/main/res/drawable/ic_text_align_center.xml +11 -0
  132. package/android/src/main/res/drawable/ic_text_align_left.xml +11 -0
  133. package/android/src/main/res/drawable/ic_text_align_right.xml +11 -0
  134. package/android/src/main/res/drawable/ic_text_bg.xml +11 -0
  135. package/android/src/main/res/drawable/ic_trim.xml +23 -0
  136. package/android/src/main/res/drawable/ic_undo.xml +10 -0
  137. package/android/src/main/res/drawable/ic_video_mode.xml +10 -0
  138. package/android/src/main/res/drawable/ic_video_note.xml +13 -0
  139. package/android/src/main/res/drawable/ic_volume_off.xml +9 -0
  140. package/android/src/main/res/drawable/ic_volume_on.xml +9 -0
  141. package/android/src/main/res/drawable/sticker_heart.xml +9 -0
  142. package/android/src/main/res/drawable/sticker_smile.xml +9 -0
  143. package/android/src/main/res/drawable/sticker_star.xml +9 -0
  144. package/android/src/main/res/drawable/sticker_thumbsup.xml +9 -0
  145. package/android/src/main/res/values/colors.xml +34 -0
  146. package/android/src/main/res/values/ids.xml +15 -0
  147. package/android/src/main/res/values/strings.xml +15 -0
  148. package/android/src/main/res/values/styles.xml +20 -0
  149. package/android/src/main/res/xml/file_paths.xml +34 -0
  150. package/ios/CustomCamera.h +5 -0
  151. package/ios/CustomCamera.mm +214 -0
  152. package/lib/module/AudioPlayerContext.js +233 -0
  153. package/lib/module/AudioPlayerContext.js.map +1 -0
  154. package/lib/module/CameraPreview.js +304 -0
  155. package/lib/module/CameraPreview.js.map +1 -0
  156. package/lib/module/NativeAnimatedImageView.js +41 -0
  157. package/lib/module/NativeAnimatedImageView.js.map +1 -0
  158. package/lib/module/NativeAudioPlayerView.js +33 -0
  159. package/lib/module/NativeAudioPlayerView.js.map +1 -0
  160. package/lib/module/NativeBlurView.js +35 -0
  161. package/lib/module/NativeBlurView.js.map +1 -0
  162. package/lib/module/NativeCustomCamera.js +128 -0
  163. package/lib/module/NativeCustomCamera.js.map +1 -0
  164. package/lib/module/NativeCustomCamera.web.js +143 -0
  165. package/lib/module/NativeCustomCamera.web.js.map +1 -0
  166. package/lib/module/NativeCustomVideoView.js +5 -0
  167. package/lib/module/NativeCustomVideoView.js.map +1 -0
  168. package/lib/module/NativeDocumentPreviewView.js +156 -0
  169. package/lib/module/NativeDocumentPreviewView.js.map +1 -0
  170. package/lib/module/NativeMediaThumbnailView.js +110 -0
  171. package/lib/module/NativeMediaThumbnailView.js.map +1 -0
  172. package/lib/module/NativeSvgIcon.js +32 -0
  173. package/lib/module/NativeSvgIcon.js.map +1 -0
  174. package/lib/module/ResponsivePreviewContainer.js +171 -0
  175. package/lib/module/ResponsivePreviewContainer.js.map +1 -0
  176. package/lib/module/accessibility.js +61 -0
  177. package/lib/module/accessibility.js.map +1 -0
  178. package/lib/module/config.js +352 -0
  179. package/lib/module/config.js.map +1 -0
  180. package/lib/module/cpuOptimization.js +296 -0
  181. package/lib/module/cpuOptimization.js.map +1 -0
  182. package/lib/module/db/DatabaseManager.js +191 -0
  183. package/lib/module/db/DatabaseManager.js.map +1 -0
  184. package/lib/module/db/MediaMapper.js +284 -0
  185. package/lib/module/db/MediaMapper.js.map +1 -0
  186. package/lib/module/db/MediaRepository.js +242 -0
  187. package/lib/module/db/MediaRepository.js.map +1 -0
  188. package/lib/module/db/index.js +41 -0
  189. package/lib/module/db/index.js.map +1 -0
  190. package/lib/module/db/migrations.js +180 -0
  191. package/lib/module/db/migrations.js.map +1 -0
  192. package/lib/module/db/react-native-sqlcipher.d.js +2 -0
  193. package/lib/module/db/react-native-sqlcipher.d.js.map +1 -0
  194. package/lib/module/db/secureKey.js +87 -0
  195. package/lib/module/db/secureKey.js.map +1 -0
  196. package/lib/module/db/types.js +57 -0
  197. package/lib/module/db/types.js.map +1 -0
  198. package/lib/module/db/useMediaDatabase.js +123 -0
  199. package/lib/module/db/useMediaDatabase.js.map +1 -0
  200. package/lib/module/defaultIcons.js +2259 -0
  201. package/lib/module/defaultIcons.js.map +1 -0
  202. package/lib/module/deviceCapabilities.js +408 -0
  203. package/lib/module/deviceCapabilities.js.map +1 -0
  204. package/lib/module/errors.js +267 -0
  205. package/lib/module/errors.js.map +1 -0
  206. package/lib/module/iconConfig.js +796 -0
  207. package/lib/module/iconConfig.js.map +1 -0
  208. package/lib/module/icons.js +514 -0
  209. package/lib/module/icons.js.map +1 -0
  210. package/lib/module/index.js +251 -0
  211. package/lib/module/index.js.map +1 -0
  212. package/lib/module/jest-globals.d.js +2 -0
  213. package/lib/module/jest-globals.d.js.map +1 -0
  214. package/lib/module/library/MediaLibrary.js +107 -0
  215. package/lib/module/library/MediaLibrary.js.map +1 -0
  216. package/lib/module/library/MediaLibraryScreen.js +2597 -0
  217. package/lib/module/library/MediaLibraryScreen.js.map +1 -0
  218. package/lib/module/library/components/AudioPreview.js +74 -0
  219. package/lib/module/library/components/AudioPreview.js.map +1 -0
  220. package/lib/module/library/components/DocumentPreview.js +331 -0
  221. package/lib/module/library/components/DocumentPreview.js.map +1 -0
  222. package/lib/module/library/components/ExpandableFab.js +343 -0
  223. package/lib/module/library/components/ExpandableFab.js.map +1 -0
  224. package/lib/module/library/components/FileTiles.js +251 -0
  225. package/lib/module/library/components/FileTiles.js.map +1 -0
  226. package/lib/module/library/components/ImagePreview.js +70 -0
  227. package/lib/module/library/components/ImagePreview.js.map +1 -0
  228. package/lib/module/library/components/MediaMetadataHeader.js +175 -0
  229. package/lib/module/library/components/MediaMetadataHeader.js.map +1 -0
  230. package/lib/module/library/components/RecordAudioScreen.js +816 -0
  231. package/lib/module/library/components/RecordAudioScreen.js.map +1 -0
  232. package/lib/module/library/components/VideoPreview.js +453 -0
  233. package/lib/module/library/components/VideoPreview.js.map +1 -0
  234. package/lib/module/library/components/ViewerCounter.js +55 -0
  235. package/lib/module/library/components/ViewerCounter.js.map +1 -0
  236. package/lib/module/library/compressionEstimate.js +507 -0
  237. package/lib/module/library/compressionEstimate.js.map +1 -0
  238. package/lib/module/library/fileMetadata.js +196 -0
  239. package/lib/module/library/fileMetadata.js.map +1 -0
  240. package/lib/module/library/index.js +42 -0
  241. package/lib/module/library/index.js.map +1 -0
  242. package/lib/module/library/libraryIconRegistry.js +69 -0
  243. package/lib/module/library/libraryIconRegistry.js.map +1 -0
  244. package/lib/module/library/libraryIcons.js +858 -0
  245. package/lib/module/library/libraryIcons.js.map +1 -0
  246. package/lib/module/library/localizedFormat.js +181 -0
  247. package/lib/module/library/localizedFormat.js.map +1 -0
  248. package/lib/module/library/palette.js +225 -0
  249. package/lib/module/library/palette.js.map +1 -0
  250. package/lib/module/library/responsive.js +53 -0
  251. package/lib/module/library/responsive.js.map +1 -0
  252. package/lib/module/locales.js +416 -0
  253. package/lib/module/locales.js.map +1 -0
  254. package/lib/module/localization.js +1064 -0
  255. package/lib/module/localization.js.map +1 -0
  256. package/lib/module/logger.js +20 -0
  257. package/lib/module/logger.js.map +1 -0
  258. package/lib/module/lowMemoryCache.js +206 -0
  259. package/lib/module/lowMemoryCache.js.map +1 -0
  260. package/lib/module/mediaHistory.js +33 -0
  261. package/lib/module/mediaHistory.js.map +1 -0
  262. package/lib/module/mediaStorageService.js +402 -0
  263. package/lib/module/mediaStorageService.js.map +1 -0
  264. package/lib/module/memory.js +79 -0
  265. package/lib/module/memory.js.map +1 -0
  266. package/lib/module/nativeActions.js +307 -0
  267. package/lib/module/nativeActions.js.map +1 -0
  268. package/lib/module/nativeComponentSupport.js +61 -0
  269. package/lib/module/nativeComponentSupport.js.map +1 -0
  270. package/lib/module/networkPerformance.js +24 -0
  271. package/lib/module/networkPerformance.js.map +1 -0
  272. package/lib/module/package.json +1 -0
  273. package/lib/module/performance.js +104 -0
  274. package/lib/module/performance.js.map +1 -0
  275. package/lib/module/performanceMonitor.js +155 -0
  276. package/lib/module/performanceMonitor.js.map +1 -0
  277. package/lib/module/permissions.js +370 -0
  278. package/lib/module/permissions.js.map +1 -0
  279. package/lib/module/rendering.js +40 -0
  280. package/lib/module/rendering.js.map +1 -0
  281. package/lib/module/security.js +18 -0
  282. package/lib/module/security.js.map +1 -0
  283. package/lib/module/state.js +266 -0
  284. package/lib/module/state.js.map +1 -0
  285. package/lib/module/storage.js +400 -0
  286. package/lib/module/storage.js.map +1 -0
  287. package/lib/module/theme.js +390 -0
  288. package/lib/module/theme.js.map +1 -0
  289. package/lib/module/types.js +4 -0
  290. package/lib/module/types.js.map +1 -0
  291. package/lib/module/utils.js +115 -0
  292. package/lib/module/utils.js.map +1 -0
  293. package/lib/module/validation.js +288 -0
  294. package/lib/module/validation.js.map +1 -0
  295. package/lib/typescript/package.json +1 -0
  296. package/lib/typescript/src/AudioPlayerContext.d.ts +27 -0
  297. package/lib/typescript/src/AudioPlayerContext.d.ts.map +1 -0
  298. package/lib/typescript/src/CameraPreview.d.ts +13 -0
  299. package/lib/typescript/src/CameraPreview.d.ts.map +1 -0
  300. package/lib/typescript/src/NativeAnimatedImageView.d.ts +33 -0
  301. package/lib/typescript/src/NativeAnimatedImageView.d.ts.map +1 -0
  302. package/lib/typescript/src/NativeAudioPlayerView.d.ts +12 -0
  303. package/lib/typescript/src/NativeAudioPlayerView.d.ts.map +1 -0
  304. package/lib/typescript/src/NativeBlurView.d.ts +12 -0
  305. package/lib/typescript/src/NativeBlurView.d.ts.map +1 -0
  306. package/lib/typescript/src/NativeCustomCamera.d.ts +167 -0
  307. package/lib/typescript/src/NativeCustomCamera.d.ts.map +1 -0
  308. package/lib/typescript/src/NativeCustomCamera.web.d.ts +47 -0
  309. package/lib/typescript/src/NativeCustomCamera.web.d.ts.map +1 -0
  310. package/lib/typescript/src/NativeCustomVideoView.d.ts +30 -0
  311. package/lib/typescript/src/NativeCustomVideoView.d.ts.map +1 -0
  312. package/lib/typescript/src/NativeDocumentPreviewView.d.ts +48 -0
  313. package/lib/typescript/src/NativeDocumentPreviewView.d.ts.map +1 -0
  314. package/lib/typescript/src/NativeMediaThumbnailView.d.ts +54 -0
  315. package/lib/typescript/src/NativeMediaThumbnailView.d.ts.map +1 -0
  316. package/lib/typescript/src/NativeSvgIcon.d.ts +25 -0
  317. package/lib/typescript/src/NativeSvgIcon.d.ts.map +1 -0
  318. package/lib/typescript/src/ResponsivePreviewContainer.d.ts +92 -0
  319. package/lib/typescript/src/ResponsivePreviewContainer.d.ts.map +1 -0
  320. package/lib/typescript/src/accessibility.d.ts +20 -0
  321. package/lib/typescript/src/accessibility.d.ts.map +1 -0
  322. package/lib/typescript/src/config.d.ts +145 -0
  323. package/lib/typescript/src/config.d.ts.map +1 -0
  324. package/lib/typescript/src/cpuOptimization.d.ts +63 -0
  325. package/lib/typescript/src/cpuOptimization.d.ts.map +1 -0
  326. package/lib/typescript/src/db/DatabaseManager.d.ts +48 -0
  327. package/lib/typescript/src/db/DatabaseManager.d.ts.map +1 -0
  328. package/lib/typescript/src/db/MediaMapper.d.ts +77 -0
  329. package/lib/typescript/src/db/MediaMapper.d.ts.map +1 -0
  330. package/lib/typescript/src/db/MediaRepository.d.ts +66 -0
  331. package/lib/typescript/src/db/MediaRepository.d.ts.map +1 -0
  332. package/lib/typescript/src/db/index.d.ts +23 -0
  333. package/lib/typescript/src/db/index.d.ts.map +1 -0
  334. package/lib/typescript/src/db/migrations.d.ts +31 -0
  335. package/lib/typescript/src/db/migrations.d.ts.map +1 -0
  336. package/lib/typescript/src/db/secureKey.d.ts +10 -0
  337. package/lib/typescript/src/db/secureKey.d.ts.map +1 -0
  338. package/lib/typescript/src/db/types.d.ts +115 -0
  339. package/lib/typescript/src/db/types.d.ts.map +1 -0
  340. package/lib/typescript/src/db/useMediaDatabase.d.ts +41 -0
  341. package/lib/typescript/src/db/useMediaDatabase.d.ts.map +1 -0
  342. package/lib/typescript/src/defaultIcons.d.ts +139 -0
  343. package/lib/typescript/src/defaultIcons.d.ts.map +1 -0
  344. package/lib/typescript/src/deviceCapabilities.d.ts +92 -0
  345. package/lib/typescript/src/deviceCapabilities.d.ts.map +1 -0
  346. package/lib/typescript/src/errors.d.ts +95 -0
  347. package/lib/typescript/src/errors.d.ts.map +1 -0
  348. package/lib/typescript/src/iconConfig.d.ts +176 -0
  349. package/lib/typescript/src/iconConfig.d.ts.map +1 -0
  350. package/lib/typescript/src/icons.d.ts +217 -0
  351. package/lib/typescript/src/icons.d.ts.map +1 -0
  352. package/lib/typescript/src/index.d.ts +104 -0
  353. package/lib/typescript/src/index.d.ts.map +1 -0
  354. package/lib/typescript/src/library/MediaLibrary.d.ts +57 -0
  355. package/lib/typescript/src/library/MediaLibrary.d.ts.map +1 -0
  356. package/lib/typescript/src/library/MediaLibraryScreen.d.ts +51 -0
  357. package/lib/typescript/src/library/MediaLibraryScreen.d.ts.map +1 -0
  358. package/lib/typescript/src/library/components/AudioPreview.d.ts +6 -0
  359. package/lib/typescript/src/library/components/AudioPreview.d.ts.map +1 -0
  360. package/lib/typescript/src/library/components/DocumentPreview.d.ts +10 -0
  361. package/lib/typescript/src/library/components/DocumentPreview.d.ts.map +1 -0
  362. package/lib/typescript/src/library/components/ExpandableFab.d.ts +39 -0
  363. package/lib/typescript/src/library/components/ExpandableFab.d.ts.map +1 -0
  364. package/lib/typescript/src/library/components/FileTiles.d.ts +8 -0
  365. package/lib/typescript/src/library/components/FileTiles.d.ts.map +1 -0
  366. package/lib/typescript/src/library/components/ImagePreview.d.ts +5 -0
  367. package/lib/typescript/src/library/components/ImagePreview.d.ts.map +1 -0
  368. package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts +16 -0
  369. package/lib/typescript/src/library/components/MediaMetadataHeader.d.ts.map +1 -0
  370. package/lib/typescript/src/library/components/RecordAudioScreen.d.ts +8 -0
  371. package/lib/typescript/src/library/components/RecordAudioScreen.d.ts.map +1 -0
  372. package/lib/typescript/src/library/components/VideoPreview.d.ts +20 -0
  373. package/lib/typescript/src/library/components/VideoPreview.d.ts.map +1 -0
  374. package/lib/typescript/src/library/components/ViewerCounter.d.ts +13 -0
  375. package/lib/typescript/src/library/components/ViewerCounter.d.ts.map +1 -0
  376. package/lib/typescript/src/library/compressionEstimate.d.ts +313 -0
  377. package/lib/typescript/src/library/compressionEstimate.d.ts.map +1 -0
  378. package/lib/typescript/src/library/fileMetadata.d.ts +33 -0
  379. package/lib/typescript/src/library/fileMetadata.d.ts.map +1 -0
  380. package/lib/typescript/src/library/index.d.ts +40 -0
  381. package/lib/typescript/src/library/index.d.ts.map +1 -0
  382. package/lib/typescript/src/library/libraryIconRegistry.d.ts +35 -0
  383. package/lib/typescript/src/library/libraryIconRegistry.d.ts.map +1 -0
  384. package/lib/typescript/src/library/libraryIcons.d.ts +85 -0
  385. package/lib/typescript/src/library/libraryIcons.d.ts.map +1 -0
  386. package/lib/typescript/src/library/localizedFormat.d.ts +49 -0
  387. package/lib/typescript/src/library/localizedFormat.d.ts.map +1 -0
  388. package/lib/typescript/src/library/palette.d.ts +104 -0
  389. package/lib/typescript/src/library/palette.d.ts.map +1 -0
  390. package/lib/typescript/src/library/responsive.d.ts +15 -0
  391. package/lib/typescript/src/library/responsive.d.ts.map +1 -0
  392. package/lib/typescript/src/locales.d.ts +103 -0
  393. package/lib/typescript/src/locales.d.ts.map +1 -0
  394. package/lib/typescript/src/localization.d.ts +1051 -0
  395. package/lib/typescript/src/localization.d.ts.map +1 -0
  396. package/lib/typescript/src/logger.d.ts +4 -0
  397. package/lib/typescript/src/logger.d.ts.map +1 -0
  398. package/lib/typescript/src/lowMemoryCache.d.ts +64 -0
  399. package/lib/typescript/src/lowMemoryCache.d.ts.map +1 -0
  400. package/lib/typescript/src/mediaHistory.d.ts +3 -0
  401. package/lib/typescript/src/mediaHistory.d.ts.map +1 -0
  402. package/lib/typescript/src/mediaStorageService.d.ts +155 -0
  403. package/lib/typescript/src/mediaStorageService.d.ts.map +1 -0
  404. package/lib/typescript/src/memory.d.ts +21 -0
  405. package/lib/typescript/src/memory.d.ts.map +1 -0
  406. package/lib/typescript/src/nativeActions.d.ts +174 -0
  407. package/lib/typescript/src/nativeActions.d.ts.map +1 -0
  408. package/lib/typescript/src/nativeComponentSupport.d.ts +30 -0
  409. package/lib/typescript/src/nativeComponentSupport.d.ts.map +1 -0
  410. package/lib/typescript/src/networkPerformance.d.ts +12 -0
  411. package/lib/typescript/src/networkPerformance.d.ts.map +1 -0
  412. package/lib/typescript/src/performance.d.ts +32 -0
  413. package/lib/typescript/src/performance.d.ts.map +1 -0
  414. package/lib/typescript/src/performanceMonitor.d.ts +45 -0
  415. package/lib/typescript/src/performanceMonitor.d.ts.map +1 -0
  416. package/lib/typescript/src/permissions.d.ts +132 -0
  417. package/lib/typescript/src/permissions.d.ts.map +1 -0
  418. package/lib/typescript/src/rendering.d.ts +9 -0
  419. package/lib/typescript/src/rendering.d.ts.map +1 -0
  420. package/lib/typescript/src/security.d.ts +6 -0
  421. package/lib/typescript/src/security.d.ts.map +1 -0
  422. package/lib/typescript/src/state.d.ts +102 -0
  423. package/lib/typescript/src/state.d.ts.map +1 -0
  424. package/lib/typescript/src/storage.d.ts +117 -0
  425. package/lib/typescript/src/storage.d.ts.map +1 -0
  426. package/lib/typescript/src/theme.d.ts +15 -0
  427. package/lib/typescript/src/theme.d.ts.map +1 -0
  428. package/lib/typescript/src/types.d.ts +802 -0
  429. package/lib/typescript/src/types.d.ts.map +1 -0
  430. package/lib/typescript/src/utils.d.ts +50 -0
  431. package/lib/typescript/src/utils.d.ts.map +1 -0
  432. package/lib/typescript/src/validation.d.ts +52 -0
  433. package/lib/typescript/src/validation.d.ts.map +1 -0
  434. package/package.json +204 -0
  435. package/react-native.config.js +17 -0
  436. package/src/AudioPlayerContext.tsx +220 -0
  437. package/src/CameraPreview.tsx +352 -0
  438. package/src/NativeAnimatedImageView.tsx +71 -0
  439. package/src/NativeAudioPlayerView.tsx +39 -0
  440. package/src/NativeBlurView.tsx +40 -0
  441. package/src/NativeCustomCamera.ts +305 -0
  442. package/src/NativeCustomCamera.web.ts +192 -0
  443. package/src/NativeCustomVideoView.ts +30 -0
  444. package/src/NativeDocumentPreviewView.tsx +196 -0
  445. package/src/NativeMediaThumbnailView.tsx +167 -0
  446. package/src/NativeSvgIcon.tsx +46 -0
  447. package/src/ResponsivePreviewContainer.tsx +227 -0
  448. package/src/accessibility.ts +80 -0
  449. package/src/config.ts +406 -0
  450. package/src/cpuOptimization.ts +365 -0
  451. package/src/db/DatabaseManager.ts +212 -0
  452. package/src/db/MediaMapper.ts +377 -0
  453. package/src/db/MediaRepository.ts +313 -0
  454. package/src/db/index.ts +73 -0
  455. package/src/db/migrations.ts +222 -0
  456. package/src/db/react-native-sqlcipher.d.ts +76 -0
  457. package/src/db/secureKey.ts +100 -0
  458. package/src/db/types.ts +123 -0
  459. package/src/db/useMediaDatabase.ts +191 -0
  460. package/src/defaultIcons.tsx +2390 -0
  461. package/src/deviceCapabilities.ts +438 -0
  462. package/src/errors.ts +350 -0
  463. package/src/iconConfig.tsx +962 -0
  464. package/src/icons.tsx +788 -0
  465. package/src/index.tsx +763 -0
  466. package/src/jest-globals.d.ts +9 -0
  467. package/src/library/MediaLibrary.tsx +141 -0
  468. package/src/library/MediaLibraryScreen.tsx +3003 -0
  469. package/src/library/components/AudioPreview.tsx +73 -0
  470. package/src/library/components/DocumentPreview.tsx +361 -0
  471. package/src/library/components/ExpandableFab.tsx +342 -0
  472. package/src/library/components/FileTiles.tsx +252 -0
  473. package/src/library/components/ImagePreview.tsx +72 -0
  474. package/src/library/components/MediaMetadataHeader.tsx +208 -0
  475. package/src/library/components/RecordAudioScreen.tsx +845 -0
  476. package/src/library/components/VideoPreview.tsx +478 -0
  477. package/src/library/components/ViewerCounter.tsx +71 -0
  478. package/src/library/compressionEstimate.ts +662 -0
  479. package/src/library/fileMetadata.ts +212 -0
  480. package/src/library/index.ts +66 -0
  481. package/src/library/libraryIconRegistry.tsx +86 -0
  482. package/src/library/libraryIcons.tsx +928 -0
  483. package/src/library/localizedFormat.ts +207 -0
  484. package/src/library/palette.ts +281 -0
  485. package/src/library/responsive.ts +49 -0
  486. package/src/locales.ts +381 -0
  487. package/src/localization.ts +1947 -0
  488. package/src/logger.ts +20 -0
  489. package/src/lowMemoryCache.ts +218 -0
  490. package/src/mediaHistory.ts +42 -0
  491. package/src/mediaStorageService.ts +546 -0
  492. package/src/memory.ts +102 -0
  493. package/src/nativeActions.ts +422 -0
  494. package/src/nativeComponentSupport.ts +60 -0
  495. package/src/networkPerformance.ts +30 -0
  496. package/src/performance.ts +137 -0
  497. package/src/performanceMonitor.ts +219 -0
  498. package/src/permissions.ts +403 -0
  499. package/src/rendering.ts +47 -0
  500. package/src/security.ts +19 -0
  501. package/src/state.ts +333 -0
  502. package/src/storage.ts +453 -0
  503. package/src/theme.tsx +467 -0
  504. package/src/types.ts +946 -0
  505. package/src/utils.ts +177 -0
  506. package/src/validation.ts +372 -0
@@ -0,0 +1,307 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * nativeActions — the TurboModule bridge calls that plugin UI needs, in a module
5
+ * that plugin UI can safely import.
6
+ *
7
+ * `src/index.tsx` is the package barrel: it re-exports every module in the
8
+ * library. Anything under `src/library/` that imported it to reach a bridge call
9
+ * would create a require cycle (barrel → screen → barrel), and in Metro that
10
+ * resolves to a half-initialised module object at import time — the classic
11
+ * "undefined is not a function" on first render.
12
+ *
13
+ * So the wrappers live HERE, and both sides import this file:
14
+ * • `src/index.tsx` re-exports them, keeping the public API byte-identical.
15
+ * • `src/library/**` imports them directly, never through `../index`.
16
+ *
17
+ * Every function is a thin pass-through to the native module. The one exception
18
+ * is {@link openGalleryEditor}, which composes two calls; its helpers live here
19
+ * with it rather than being reached back through the barrel.
20
+ */
21
+ import { DeviceEventEmitter } from 'react-native';
22
+ /**
23
+ * The native TurboModule, or a safe empty stand-in.
24
+ *
25
+ * Resolved lazily through `require` (not a static import) so that importing any
26
+ * part of this package in a plain Node/Jest environment — where the native
27
+ * module is absent — does not throw at module-evaluation time. Calls made
28
+ * against the stand-in fail individually instead of taking the whole bundle
29
+ * down at import.
30
+ */
31
+ export function getCustomCameraModule() {
32
+ try {
33
+ const module = require('./NativeCustomCamera');
34
+ if (module) {
35
+ return module.default ?? module;
36
+ }
37
+ } catch {
38
+ // Fall back to a safe empty object for non-native test environments.
39
+ }
40
+ return {};
41
+ }
42
+ export function openCameraPicker(options = {}) {
43
+ return getCustomCameraModule().openCameraPicker(options);
44
+ }
45
+
46
+ /**
47
+ * Open the native document picker (Android Storage Access Framework). Resolves with the same
48
+ * `{ cancelled, assets }` shape as {@link openCameraPicker}; each asset has `type: 'document'`.
49
+ */
50
+ export function openDocumentPicker(options = {}) {
51
+ return getCustomCameraModule().openDocumentPicker(options);
52
+ }
53
+
54
+ /**
55
+ * Open the native audio picker (Android Storage Access Framework, scoped to `audio/*`). Resolves
56
+ * with the same `{ cancelled, assets }` shape as {@link openCameraPicker}; each asset has
57
+ * `type: 'audio'`.
58
+ */
59
+ export function openAudioPicker(options = {}) {
60
+ return getCustomCameraModule().openAudioPicker(options);
61
+ }
62
+
63
+ /**
64
+ * Open the native image/video picker (Android Storage Access Framework, scoped to `image/*` and
65
+ * `video/*`). Resolves with the same `{ cancelled, assets }` shape as {@link openCameraPicker};
66
+ * each asset has `type: 'photo'` or `type: 'video'` depending on the MIME type.
67
+ */
68
+ export function openImageVideoPicker(options = {}) {
69
+ return getCustomCameraModule().openImageVideoPicker(options);
70
+ }
71
+
72
+ /**
73
+ * Open EXISTING photos/videos on the camera's own preview/editor screens.
74
+ *
75
+ * This is not a second editor: it is the same native Activity, the same preview/editor controller
76
+ * and the same tool set freshly captured media opens on — crop, rotate, draw, text, stickers,
77
+ * emoji, filters, export/compress for images; trim, mute, cover frame, compress for videos — and it
78
+ * finishes through the same send pipeline (cache → edit → publish to Documents). The result
79
+ * therefore has the identical `{ cancelled, assets }` shape as {@link openCameraPicker}, and the
80
+ * assets it returns are indistinguishable from captured ones downstream.
81
+ *
82
+ * The number of items picks the screen, exactly as it does for captures:
83
+ * • ONE item — `{ uri }` or a single-entry `items` — opens the single-asset image/video editor.
84
+ * • SEVERAL items open the multi-media Add More + Send preview, holding the whole selection in the
85
+ * order given, with its strip, per-item removal and one Send for the lot.
86
+ *
87
+ * Resolves with `cancelled: true` when the user backs out, or when nothing in the selection can be
88
+ * opened (unreadable files, or uris that are neither image nor video).
89
+ */
90
+ export function openMediaEditor(options) {
91
+ return getCustomCameraModule().openMediaEditor(options);
92
+ }
93
+ const VIDEO_EXTENSIONS = new Set(['mp4', 'm4v', 'mov', 'mkv', '3gp', '3g2', 'webm', 'avi', 'ts', 'mts', 'm2ts', 'flv', 'wmv']);
94
+ const IMAGE_EXTENSIONS = new Set(['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'heic', 'heif', 'avif', 'dng', 'tif', 'tiff']);
95
+
96
+ /**
97
+ * Media kind for an asset coming back from a picker. The native picker already types the file from
98
+ * its MIME type; this only covers the gaps (a provider that reports no/garbage MIME) by falling
99
+ * back to the file extension, so a `.mp4` never lands in the image editor. Returns null when the
100
+ * item is neither an image nor a video — an invalid selection for the editor.
101
+ */
102
+ function resolveMediaKind(asset) {
103
+ if (asset.type === 'video' || asset.type === 'photo') return asset.type;
104
+ const mimeType = asset.mimeType?.toLowerCase() ?? '';
105
+ if (mimeType.startsWith('video/')) return 'video';
106
+ if (mimeType.startsWith('image/')) return 'photo';
107
+ const name = (asset.fileName || asset.uri || '').toLowerCase();
108
+ const extension = name.slice(name.lastIndexOf('.') + 1);
109
+ if (VIDEO_EXTENSIONS.has(extension)) return 'video';
110
+ if (IMAGE_EXTENSIONS.has(extension)) return 'photo';
111
+ return null;
112
+ }
113
+
114
+ /**
115
+ * One-call "pick from the gallery, then edit" flow: opens the device gallery
116
+ * ({@link openImageVideoPicker}) with unlimited selection, detects whether each chosen item is an
117
+ * image or a video, and hands the lot to {@link openMediaEditor} — so picked media lands on the
118
+ * same screens a capture does, with the same tools and the same send behaviour.
119
+ *
120
+ * Selection count drives the navigation, exactly as it does for captures: one item goes straight to
121
+ * the image or video editor; several go to the multi-media Add More + Send preview, carrying every
122
+ * item — images and videos in any combination — in the order they were picked.
123
+ *
124
+ * Resolves `{ cancelled: true, assets: [] }` when the user backs out of either step, and when
125
+ * nothing in the selection can be opened as media at all. Never throws for a cancel; genuine
126
+ * failures (no Activity, unusable uris) still reject like the underlying calls do.
127
+ */
128
+ export async function openGalleryEditor(options = {}) {
129
+ const cancelled = {
130
+ cancelled: true,
131
+ assets: []
132
+ };
133
+ // 0 = unlimited: any number of images and videos, in any combination.
134
+ const picked = await openImageVideoPicker({
135
+ selectionLimit: 0
136
+ });
137
+ if (!picked || picked.cancelled || !Array.isArray(picked.assets)) return cancelled;
138
+
139
+ // Pick order is preserved end to end — it is the order the preview, the strip and the sent
140
+ // result all use. Items that resolve to neither image nor video are dropped rather than sent to
141
+ // an editor that can't open them.
142
+ const items = [];
143
+ for (const asset of picked.assets) {
144
+ if (!asset?.uri) continue;
145
+ const kind = resolveMediaKind(asset);
146
+ if (!kind) continue;
147
+ items.push({
148
+ uri: asset.uri,
149
+ type: kind,
150
+ fileName: asset.fileName,
151
+ mimeType: asset.mimeType
152
+ });
153
+ }
154
+ if (items.length === 0) return cancelled;
155
+ return openMediaEditor({
156
+ items,
157
+ enableFilter: options.enableFilter
158
+ });
159
+ }
160
+
161
+ /**
162
+ * Opens a document uri in an external viewer (Android `ACTION_VIEW`). Resolves `true` when an
163
+ * app was launched to view it, `false` when no handler is available. `mimeType` may be empty —
164
+ * the native side falls back to inferring it from the uri.
165
+ */
166
+ export function openDocument(uri, mimeType = '') {
167
+ return getCustomCameraModule().openDocument(uri, mimeType);
168
+ }
169
+ export function startUpload(uris, uploadUrl) {
170
+ return getCustomCameraModule().startUpload(uris, uploadUrl);
171
+ }
172
+
173
+ /**
174
+ * Securely delete ONE media item natively, and report exactly what happened.
175
+ *
176
+ * The native implementation measures the file's exact size, overwrites it with
177
+ * encrypted cryptographically secure random data 2 MB larger than that size
178
+ * (written in fixed-size chunks and flushed to storage, so a multi-gigabyte
179
+ * video never lands in RAM), unlinks the file, then removes thumbnails, cached
180
+ * copies, derived variants (compressed / exported / edited / cover frames) and
181
+ * native metadata references. It runs entirely off the main thread.
182
+ *
183
+ * Pass `assetId` whenever you have it: derived variants are named after it, so
184
+ * omitting it leaves those extra copies of the same media on disk.
185
+ *
186
+ * Inspect {@link SecureDeleteResult.fullySecure} before reporting success —
187
+ * a file can be deleted while its overwrite failed, and the two must not be
188
+ * presented to the user identically. Failures are logged natively.
189
+ *
190
+ * Removing the SQLCipher row is the caller's job (see `useMediaDatabase`), and
191
+ * should happen only after this resolves.
192
+ */
193
+ export function secureDeleteMedia(uri, options = {}) {
194
+ return getCustomCameraModule().secureDeleteMedia(uri, options);
195
+ }
196
+
197
+ /**
198
+ * Share one or more media uris through the native Android share sheet
199
+ * (Intent.ACTION_SEND for a single item, ACTION_SEND_MULTIPLE for several)
200
+ * with the correct MIME type for images, videos, documents and audio.
201
+ * Resolves `true` when the share chooser was launched.
202
+ */
203
+ export function shareMedia(uris, mimeType) {
204
+ return getCustomCameraModule().shareMedia(uris, mimeType);
205
+ }
206
+ export function getMediaMetadata(uri) {
207
+ return getCustomCameraModule().getMediaMetadata(uri);
208
+ }
209
+
210
+ /**
211
+ * The byte length of the exact clip the recording process finalized under `mediaId`, or 0 when the
212
+ * native layer remembers none. A freshly recorded clip's cached file is swapped in the background
213
+ * for a smaller aspect-cropped re-encode; this reports the pre-crop recorded length so a preview
214
+ * shows the same size the recording counter approached and the editor's "Original" row shows,
215
+ * rather than the smaller file now on disk. Returns 0 for gallery media, user-compressed/exported
216
+ * copies, trimmed clips, and anything after an app restart — callers then fall back to the real
217
+ * on-disk size.
218
+ */
219
+ export function getRecordedOriginalSize(mediaId) {
220
+ return getCustomCameraModule().getRecordedOriginalSize(mediaId);
221
+ }
222
+
223
+ // ── Audio Recording ─────────────────────────────────────────────────
224
+
225
+ export function startAudioRecording(options = {}) {
226
+ return getCustomCameraModule().startAudioRecording(options);
227
+ }
228
+ export function stopAudioRecording() {
229
+ return getCustomCameraModule().stopAudioRecording();
230
+ }
231
+ export function cancelAudioRecording() {
232
+ return getCustomCameraModule().cancelAudioRecording();
233
+ }
234
+ export function stopAndPublishAudioRecording() {
235
+ return getCustomCameraModule().stopAndPublishAudioRecording();
236
+ }
237
+ export function pauseAudioRecording() {
238
+ return getCustomCameraModule().pauseAudioRecording();
239
+ }
240
+ export function resumeAudioRecording() {
241
+ return getCustomCameraModule().resumeAudioRecording();
242
+ }
243
+ export function getAudioRecordingState() {
244
+ return getCustomCameraModule().getAudioRecordingState();
245
+ }
246
+ export function getAudioAmplitude() {
247
+ return getCustomCameraModule().getAudioAmplitude();
248
+ }
249
+
250
+ // ── Compression ─────────────────────────────────────────────────────
251
+ // The library shell's viewer offers compression on the displayed image/video, so
252
+ // these wrappers live here with the other bridge calls rather than in the barrel.
253
+
254
+ /**
255
+ * Re-encode a video smaller, resolving with a URI for the new file. The original is only ever
256
+ * read — never overwritten, moved or deleted.
257
+ *
258
+ * `qualityOrOption` is a QUALITY RATIO: `'25%'` and `'0.25'` both mean "keep a quarter of the
259
+ * quality" (so a LOWER value is stronger compression), and only a string starting with
260
+ * `'Original'` (quality ratio 1.0) resolves the input URI back untouched.
261
+ */
262
+ export function compressVideo(uri, qualityOrOption) {
263
+ return getCustomCameraModule().compressVideo(uri, qualityOrOption);
264
+ }
265
+
266
+ /**
267
+ * Re-encode a still image smaller, resolving with a URI for the new file. The original is only
268
+ * ever read — never overwritten, moved or deleted.
269
+ *
270
+ * `qualityOrOption` is a QUALITY RATIO, exactly as {@link compressVideo} takes: `'25%'` and
271
+ * `'0.25'` both mean "keep a quarter of the quality" (so a LOWER value is stronger compression),
272
+ * and only `'Original Image'` (quality ratio 1.0) resolves the input URI back untouched — every
273
+ * level below it, from `'5%'` up to `'99%'`, runs the encoder. An image that is already as small as
274
+ * it can get also resolves the input URI, since a "compressed" copy would only be larger.
275
+ *
276
+ * The compressed copy comes back as JPEG, or as lossy WebP when the source could be carrying
277
+ * transparency, so an image with an alpha channel is never flattened onto white.
278
+ */
279
+ export function compressImage(uri, qualityOrOption) {
280
+ return getCustomCameraModule().compressImage(uri, qualityOrOption);
281
+ }
282
+
283
+ /** One measured progress report from an in-flight {@link compressVideo} / {@link compressImage}. */
284
+
285
+ /**
286
+ * Subscribe to measured progress from {@link compressVideo} and {@link compressImage}.
287
+ *
288
+ * The reports are measurements, not predictions: the video transcode reports the encoder's own
289
+ * output position against the clip's duration, and the still compressor reports the encodes its
290
+ * quality search has spent. That is what makes a real remaining time derivable — `elapsed /
291
+ * progress` is the total the job is actually on course for — instead of counting a fixed estimate
292
+ * down and either running out mid-compression or still promising seconds after it has finished.
293
+ *
294
+ * Notes for callers:
295
+ * - Reports are throttled natively (a few per second at most), so this is safe to render from.
296
+ * - `progress` reaches 1 when the work ends, but do not WAIT for it: a compression that fails part
297
+ * way through resolves its promise (or rejects) without a final report on every path. Treat the
298
+ * promise as the completion signal and these events purely as progress.
299
+ * - Media whose length cannot be read reports only its start and end, so treat a quiet compression
300
+ * as "progress unknown", never as "stalled".
301
+ *
302
+ * @returns the subscription; call `.remove()` to stop listening.
303
+ */
304
+ export function addCompressionProgressListener(listener) {
305
+ return DeviceEventEmitter.addListener('onCompressionProgress', listener);
306
+ }
307
+ //# sourceMappingURL=nativeActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DeviceEventEmitter","getCustomCameraModule","module","require","default","openCameraPicker","options","openDocumentPicker","openAudioPicker","openImageVideoPicker","openMediaEditor","VIDEO_EXTENSIONS","Set","IMAGE_EXTENSIONS","resolveMediaKind","asset","type","mimeType","toLowerCase","startsWith","name","fileName","uri","extension","slice","lastIndexOf","has","openGalleryEditor","cancelled","assets","picked","selectionLimit","Array","isArray","items","kind","push","length","enableFilter","openDocument","startUpload","uris","uploadUrl","secureDeleteMedia","shareMedia","getMediaMetadata","getRecordedOriginalSize","mediaId","startAudioRecording","stopAudioRecording","cancelAudioRecording","stopAndPublishAudioRecording","pauseAudioRecording","resumeAudioRecording","getAudioRecordingState","getAudioAmplitude","compressVideo","qualityOrOption","compressImage","addCompressionProgressListener","listener","addListener"],"sourceRoot":"..\\..\\src","sources":["nativeActions.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAkB,QAAQ,cAAc;AAkBjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,IAAI;IACF,MAAMC,MAAM,GAAGC,OAAO,CAAC,sBAAsB,CAGhC;IAEb,IAAID,MAAM,EAAE;MACV,OAAQA,MAAM,CAACE,OAAO,IACpBF,MAAM;IACV;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAGF,OAAO,CAAC,CAAC;AACX;AAEA,OAAO,SAASG,gBAAgBA,CAC9BC,OAA4B,GAAG,CAAC,CAAC,EACJ;EAC7B,OAAOL,qBAAqB,CAAC,CAAC,CAACI,gBAAgB,CAC7CC,OACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAChCD,OAA0B,GAAG,CAAC,CAAC,EACF;EAC7B,OAAOL,qBAAqB,CAAC,CAAC,CAACM,kBAAkB,CAC/CD,OACF,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EAAEmC,eAAe,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAC3BpC,GAAW,EACXmC,eAAuB,EACN;EACjB,OAAOxD,qBAAqB,CAAC,CAAC,CAACyD,aAAa,CAACpC,GAAG,EAAEmC,eAAe,CAAC;AACpE;;AAEA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,8BAA8BA,CAC5CC,QAAmD,EAC3B;EACxB,OAAO5D,kBAAkB,CAAC6D,WAAW,CAAC,uBAAuB,EAAED,QAAQ,CAAC;AAC1E","ignoreList":[]}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Resolution helpers for this library's optional native views.
5
+ *
6
+ * Every native view here is optional by design: the JS half of the library is published as
7
+ * plain source and can be running against a host app whose native module was built before that
8
+ * view existed (or against a platform that has no native half at all). The JS must therefore be
9
+ * able to answer "is this view actually in the binary?" — and answer it *before* rendering.
10
+ */
11
+
12
+ import { Platform, UIManager, requireNativeComponent } from 'react-native';
13
+
14
+ /**
15
+ * The native component registered under [name], or `null` when this build does not have it.
16
+ *
17
+ * `requireNativeComponent` resolves its view config LAZILY: the call itself always succeeds and
18
+ * the UIManager lookup only happens when React first renders the element. Wrapping the call in
19
+ * try/catch — the shape this library used previously — therefore cannot see a missing view
20
+ * manager, so `isNative…Available()` reported `true` and the first row that rendered the view
21
+ * threw `requireNativeComponent: '<name>' was not found in the UIManager` instead of quietly
22
+ * taking the fallback. Asking the UIManager up front makes the answer truthful, which is what
23
+ * every caller's fallback path depends on.
24
+ */
25
+ export function resolveNativeComponent(name) {
26
+ if (Platform.OS !== 'android') return null;
27
+ // Only a definite "no" rules the view out. An unanswerable probe must not: reading it as
28
+ // absent would send a working build down the fallback path for every view in the library.
29
+ if (isViewManagerRegistered(name) === false) return null;
30
+ try {
31
+ return requireNativeComponent(name);
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Whether the UIManager knows [name] — `null` when this runtime cannot say, which is not the
39
+ * same answer as `false`.
40
+ */
41
+ function isViewManagerRegistered(name) {
42
+ try {
43
+ if (typeof UIManager?.hasViewManagerConfig !== 'function') return null;
44
+ return UIManager.hasViewManagerConfig(name);
45
+ } catch {
46
+ return null;
47
+ }
48
+ }
49
+
50
+ /**
51
+ * A URI ReactNative's `<Image>` can actually load.
52
+ *
53
+ * The media database stores plain absolute paths (`/data/user/0/…/Documents/media_documents/
54
+ * photo.jpg`), and Fresco needs a scheme: pointed at a bare path it renders nothing at all and
55
+ * reports no error, which is indistinguishable from an empty tile.
56
+ */
57
+ export function toImageSourceUri(uri) {
58
+ if (!uri) return undefined;
59
+ return /^[a-z][a-z0-9+.-]*:/i.test(uri) ? uri : `file://${uri}`;
60
+ }
61
+ //# sourceMappingURL=nativeComponentSupport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","UIManager","requireNativeComponent","resolveNativeComponent","name","OS","isViewManagerRegistered","hasViewManagerConfig","toImageSourceUri","uri","undefined","test"],"sourceRoot":"..\\..\\src","sources":["nativeComponentSupport.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,sBAAsB,QAAQ,cAAc;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,IAAY,EACiB;EAC7B,IAAIJ,QAAQ,CAACK,EAAE,KAAK,SAAS,EAAE,OAAO,IAAI;EAC1C;EACA;EACA,IAAIC,uBAAuB,CAACF,IAAI,CAAC,KAAK,KAAK,EAAE,OAAO,IAAI;EACxD,IAAI;IACF,OAAOF,sBAAsB,CAAQE,IAAI,CAAC;EAC5C,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACA;AACA;AACA;AACA,SAASE,uBAAuBA,CAACF,IAAY,EAAkB;EAC7D,IAAI;IACF,IAAI,OAAOH,SAAS,EAAEM,oBAAoB,KAAK,UAAU,EAAE,OAAO,IAAI;IACtE,OAAON,SAAS,CAACM,oBAAoB,CAACH,IAAI,CAAC;EAC7C,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,gBAAgBA,CAACC,GAAmB,EAAsB;EACxE,IAAI,CAACA,GAAG,EAAE,OAAOC,SAAS;EAC1B,OAAO,sBAAsB,CAACC,IAAI,CAACF,GAAG,CAAC,GAAGA,GAAG,GAAG,UAAUA,GAAG,EAAE;AACjE","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ import { validateUploadUrl } from "./validation.js";
4
+ export { validateUploadUrl } from "./validation.js";
5
+ export async function checkNetworkConnectivity() {
6
+ return true;
7
+ }
8
+ export async function adaptiveUpload(uri, uploadUrl) {
9
+ validateUploadUrl(uploadUrl);
10
+ return {
11
+ ok: true,
12
+ uri,
13
+ uploadUrl
14
+ };
15
+ }
16
+ export function estimateBandwidth() {
17
+ return 0;
18
+ }
19
+ export class NetworkMonitor {
20
+ async check() {
21
+ return true;
22
+ }
23
+ }
24
+ //# sourceMappingURL=networkPerformance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["validateUploadUrl","checkNetworkConnectivity","adaptiveUpload","uri","uploadUrl","ok","estimateBandwidth","NetworkMonitor","check"],"sourceRoot":"..\\..\\src","sources":["networkPerformance.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,iBAAc;AAEhD,SAASA,iBAAiB,QAAQ,iBAAc;AAEhD,OAAO,eAAeC,wBAAwBA,CAAA,EAAqB;EACjE,OAAO,IAAI;AACb;AAEA,OAAO,eAAeC,cAAcA,CAClCC,GAAW,EACXC,SAAiB,EACyC;EAC1DJ,iBAAiB,CAACI,SAAS,CAAC;EAE5B,OAAO;IACLC,EAAE,EAAE,IAAI;IACRF,GAAG;IACHC;EACF,CAAC;AACH;AAEA,OAAO,SAASE,iBAAiBA,CAAA,EAAW;EAC1C,OAAO,CAAC;AACV;AAEA,OAAO,MAAMC,cAAc,CAAC;EAC1B,MAAMC,KAAKA,CAAA,EAAqB;IAC9B,OAAO,IAAI;EACb;AACF","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ import { measurePerformance as measurePerformanceMonitor } from "./performanceMonitor.js";
4
+ export { measurePerformance } from "./performanceMonitor.js";
5
+ export function debounce(fn, wait = 0) {
6
+ let timeout = null;
7
+ return (...args) => {
8
+ if (timeout) {
9
+ clearTimeout(timeout);
10
+ }
11
+ timeout = setTimeout(() => {
12
+ timeout = null;
13
+ fn(...args);
14
+ }, wait);
15
+ };
16
+ }
17
+ export function throttle(fn, wait = 0) {
18
+ let lastCall = 0;
19
+ return (...args) => {
20
+ const now = Date.now();
21
+ if (now - lastCall >= wait) {
22
+ lastCall = now;
23
+ fn(...args);
24
+ }
25
+ };
26
+ }
27
+ export class MediaCache {
28
+ store = new Map();
29
+ set(key, value) {
30
+ this.store.set(key, value);
31
+ }
32
+ get(key) {
33
+ return this.store.get(key);
34
+ }
35
+ delete(key) {
36
+ this.store.delete(key);
37
+ }
38
+ clear() {
39
+ this.store.clear();
40
+ }
41
+ }
42
+ export class BackgroundOperationManager {
43
+ queue = [];
44
+ async enqueue(operation) {
45
+ this.queue.push(operation);
46
+ return this.runNext();
47
+ }
48
+ async runNext() {
49
+ const operation = this.queue.shift();
50
+ if (!operation) {
51
+ return undefined;
52
+ }
53
+ try {
54
+ return await operation();
55
+ } finally {
56
+ if (this.queue.length > 0) {
57
+ await this.runNext();
58
+ }
59
+ }
60
+ }
61
+ }
62
+ export class LazyLoader {
63
+ isLoading = false;
64
+ error = null;
65
+ constructor(factory) {
66
+ this.factory = factory;
67
+ }
68
+ load() {
69
+ if (this.value === undefined && !this.isLoading) {
70
+ try {
71
+ this.isLoading = true;
72
+ this.value = this.factory();
73
+ this.error = null;
74
+ } catch (err) {
75
+ this.error = err;
76
+ throw err;
77
+ } finally {
78
+ this.isLoading = false;
79
+ }
80
+ }
81
+ if (this.error) {
82
+ throw this.error;
83
+ }
84
+ return this.value;
85
+ }
86
+ reset() {
87
+ this.value = undefined;
88
+ this.error = null;
89
+ }
90
+ get isLoaded() {
91
+ return this.value !== undefined;
92
+ }
93
+ get hasError() {
94
+ return this.error !== null;
95
+ }
96
+ }
97
+ export async function processMediaInChunks(items, batchSize = 10, processor) {
98
+ for (let index = 0; index < items.length; index += batchSize) {
99
+ const chunk = items.slice(index, index + batchSize);
100
+ await processor(chunk);
101
+ }
102
+ }
103
+ export { measurePerformanceMonitor as measurePerformanceMonitorImpl };
104
+ //# sourceMappingURL=performance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["measurePerformance","measurePerformanceMonitor","debounce","fn","wait","timeout","args","clearTimeout","setTimeout","throttle","lastCall","now","Date","MediaCache","store","Map","set","key","value","get","delete","clear","BackgroundOperationManager","queue","enqueue","operation","push","runNext","shift","undefined","length","LazyLoader","isLoading","error","constructor","factory","load","err","reset","isLoaded","hasError","processMediaInChunks","items","batchSize","processor","index","chunk","slice","measurePerformanceMonitorImpl"],"sourceRoot":"..\\..\\src","sources":["performance.ts"],"mappings":";;AACA,SAASA,kBAAkB,IAAIC,yBAAyB,QAAQ,yBAAsB;AAEtF,SAASD,kBAAkB,QAAQ,yBAAsB;AAEzD,OAAO,SAASE,QAAQA,CACtBC,EAAK,EACLC,IAAI,GAAG,CAAC,EACR;EACA,IAAIC,OAA6C,GAAG,IAAI;EAExD,OAAQ,CAAC,GAAGC,IAAmB,KAAK;IAClC,IAAID,OAAO,EAAE;MACXE,YAAY,CAACF,OAAO,CAAC;IACvB;IAEAA,OAAO,GAAGG,UAAU,CAAC,MAAM;MACzBH,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