shakebug-react-native 1.0.14

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 (296) hide show
  1. package/DeviceInfo/index.js.flow +177 -0
  2. package/DeviceInfo/index.ts +1034 -0
  3. package/DeviceInfo/internal/asyncHookWrappers.ts +59 -0
  4. package/DeviceInfo/internal/devicesWithDynamicIsland.ts +30 -0
  5. package/DeviceInfo/internal/devicesWithNotch.ts +374 -0
  6. package/DeviceInfo/internal/nativeInterface.ts +28 -0
  7. package/DeviceInfo/internal/privateTypes.ts +231 -0
  8. package/DeviceInfo/internal/supported-platform-info.ts +97 -0
  9. package/DeviceInfo/internal/types.ts +19 -0
  10. package/DeviceInfo/web/index.js +223 -0
  11. package/GetLocals/src/NativeRNLocalize.ts +18 -0
  12. package/GetLocals/src/constants.ts +269 -0
  13. package/GetLocals/src/index.ts +56 -0
  14. package/GetLocals/src/module.ts +51 -0
  15. package/GetLocals/src/module.web.ts +148 -0
  16. package/GetLocals/src/types.ts +31 -0
  17. package/GetLocation/LocationError.ts +20 -0
  18. package/GetLocation/index.ts +46 -0
  19. package/GetLocation/utils.ts +89 -0
  20. package/ImageOrVedioPicker/src/index.ts +28 -0
  21. package/ImageOrVedioPicker/src/platforms/NativeImagePicker.ts +10 -0
  22. package/ImageOrVedioPicker/src/platforms/native.ts +61 -0
  23. package/ImageOrVedioPicker/src/platforms/web.ts +159 -0
  24. package/ImageOrVedioPicker/src/types.ts +74 -0
  25. package/NetInfo/src/__tests__/eventListenerCallbacks.spec.ts +332 -0
  26. package/NetInfo/src/__tests__/fetch.spec.ts +479 -0
  27. package/NetInfo/src/index.ts +186 -0
  28. package/NetInfo/src/internal/__mocks__/nativeModule.ts +13 -0
  29. package/NetInfo/src/internal/defaultConfiguration.ts +17 -0
  30. package/NetInfo/src/internal/defaultConfiguration.web.ts +17 -0
  31. package/NetInfo/src/internal/internetReachability.ts +180 -0
  32. package/NetInfo/src/internal/nativeInterface.ts +43 -0
  33. package/NetInfo/src/internal/nativeInterface.web.ts +27 -0
  34. package/NetInfo/src/internal/nativeModule.ts +15 -0
  35. package/NetInfo/src/internal/nativeModule.web.ts +306 -0
  36. package/NetInfo/src/internal/privateTypes.ts +41 -0
  37. package/NetInfo/src/internal/state.ts +137 -0
  38. package/NetInfo/src/internal/types.ts +128 -0
  39. package/README.md +246 -0
  40. package/RecordScreen/src/index.tsx +75 -0
  41. package/ScreenShot/src/RNViewShot.js +3 -0
  42. package/ScreenShot/src/RNViewShot.web.js +42 -0
  43. package/ScreenShot/src/index.js +308 -0
  44. package/Sensor/src/index.js +14 -0
  45. package/Sensor/src/rnsensors.js +57 -0
  46. package/Sensor/src/sensors.js +97 -0
  47. package/VideoPlayer/PlayVideo.tsx +51 -0
  48. package/VideoPlayer/index.js +69 -0
  49. package/android/README.md +14 -0
  50. package/android/build/generated/source/buildConfig/debug/com/shakebug/BuildConfig.java +10 -0
  51. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +42 -0
  52. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
  53. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +6 -0
  54. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
  55. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  56. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  57. package/android/build/intermediates/compile_symbol_list/debug/R.txt +47 -0
  58. package/android/build/intermediates/compiled_local_resources/debug/out/xml_imagepicker_provider_paths.xml.flat +0 -0
  59. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +12 -0
  60. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  61. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  62. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  63. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  64. package/android/build/intermediates/javac/debug/classes/com/shakebug/BuildConfig.class +0 -0
  65. package/android/build/intermediates/javac/debug/classes/com/shakebug/CustomMediaMetadataRetriever.class +0 -0
  66. package/android/build/intermediates/javac/debug/classes/com/shakebug/ImageMetadata.class +0 -0
  67. package/android/build/intermediates/javac/debug/classes/com/shakebug/ImagePickerProvider.class +0 -0
  68. package/android/build/intermediates/javac/debug/classes/com/shakebug/Metadata.class +0 -0
  69. package/android/build/intermediates/javac/debug/classes/com/shakebug/Options.class +0 -0
  70. package/android/build/intermediates/javac/debug/classes/com/shakebug/RecordScreenModule$1.class +0 -0
  71. package/android/build/intermediates/javac/debug/classes/com/shakebug/RecordScreenModule.class +0 -0
  72. package/android/build/intermediates/javac/debug/classes/com/shakebug/Shakebug.class +0 -0
  73. package/android/build/intermediates/javac/debug/classes/com/shakebug/ShakebugPackage.class +0 -0
  74. package/android/build/intermediates/javac/debug/classes/com/shakebug/Utility.class +0 -0
  75. package/android/build/intermediates/javac/debug/classes/com/shakebug/Utils.class +0 -0
  76. package/android/build/intermediates/javac/debug/classes/com/shakebug/VideoMetadata.class +0 -0
  77. package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$1.class +0 -0
  78. package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$2.class +0 -0
  79. package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$Formats.class +0 -0
  80. package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$Results.class +0 -0
  81. package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$ReusableByteArrayOutputStream.class +0 -0
  82. package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot.class +0 -0
  83. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +49 -0
  84. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +82 -0
  85. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +42 -0
  86. package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
  87. package/android/build/intermediates/packaged_res/debug/values/values.xml +25 -0
  88. package/android/build/intermediates/packaged_res/debug/xml/imagepicker_provider_paths.xml +4 -0
  89. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/BuildConfig.class +0 -0
  90. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/CustomMediaMetadataRetriever.class +0 -0
  91. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ImageMetadata.class +0 -0
  92. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ImagePickerProvider.class +0 -0
  93. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Metadata.class +0 -0
  94. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Options.class +0 -0
  95. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/RecordScreenModule$1.class +0 -0
  96. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/RecordScreenModule.class +0 -0
  97. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Shakebug.class +0 -0
  98. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ShakebugPackage.class +0 -0
  99. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Utility.class +0 -0
  100. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Utils.class +0 -0
  101. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/VideoMetadata.class +0 -0
  102. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$1.class +0 -0
  103. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$2.class +0 -0
  104. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$Formats.class +0 -0
  105. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$Results.class +0 -0
  106. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$ReusableByteArrayOutputStream.class +0 -0
  107. package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot.class +0 -0
  108. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +48 -0
  109. package/android/build/outputs/logs/manifest-merger-debug-report.txt +97 -0
  110. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  111. package/android/build.gradle +235 -0
  112. package/android/src/main/AndroidManifest.xml +40 -0
  113. package/android/src/main/java/com/shakebug/AmazonFireDeviceConnectivityPoller.java +170 -0
  114. package/android/src/main/java/com/shakebug/BaseUtils.java +33 -0
  115. package/android/src/main/java/com/shakebug/BroadcastReceiverConnectivityReceiver.java +131 -0
  116. package/android/src/main/java/com/shakebug/ConnectivityReceiver.java +318 -0
  117. package/android/src/main/java/com/shakebug/CrashLoggerModule.java +48 -0
  118. package/android/src/main/java/com/shakebug/DateUtil.java +64 -0
  119. package/android/src/main/java/com/shakebug/DeviceType.java +18 -0
  120. package/android/src/main/java/com/shakebug/DeviceUtil.java +46 -0
  121. package/android/src/main/java/com/shakebug/DrawingView.java +90 -0
  122. package/android/src/main/java/com/shakebug/DrawingViewManager.java +38 -0
  123. package/android/src/main/java/com/shakebug/GetLocation.java +147 -0
  124. package/android/src/main/java/com/shakebug/ImageMetadata.java +42 -0
  125. package/android/src/main/java/com/shakebug/ImagePickerProvider.java +8 -0
  126. package/android/src/main/java/com/shakebug/Metadata.java +46 -0
  127. package/android/src/main/java/com/shakebug/NetInfoModule.java +79 -0
  128. package/android/src/main/java/com/shakebug/NetInfoUtils.java +50 -0
  129. package/android/src/main/java/com/shakebug/NetworkCallbackConnectivityReceiver.java +209 -0
  130. package/android/src/main/java/com/shakebug/Options.java +42 -0
  131. package/android/src/main/java/com/shakebug/RNDeviceModule.java +1036 -0
  132. package/android/src/main/java/com/shakebug/RNInstallReferrerClient.java +124 -0
  133. package/android/src/main/java/com/shakebug/RNLocalizeModule.java +79 -0
  134. package/android/src/main/java/com/shakebug/RNLocalizeModuleImpl.java +258 -0
  135. package/android/src/main/java/com/shakebug/ReactNativeGetLocationModule.java +95 -0
  136. package/android/src/main/java/com/shakebug/RecordScreenModule.java +202 -0
  137. package/android/src/main/java/com/shakebug/ScreenshotDetectorModule.java +63 -0
  138. package/android/src/main/java/com/shakebug/SettingsUtil.java +44 -0
  139. package/android/src/main/java/com/shakebug/Shakebug.java +181 -0
  140. package/android/src/main/java/com/shakebug/ShakebugPackage.java +75 -0
  141. package/android/src/main/java/com/shakebug/ShakebugSDKImagePickerModule.java +56 -0
  142. package/android/src/main/java/com/shakebug/ShakebugSDKImagePickerModuleImpl.java +230 -0
  143. package/android/src/main/java/com/shakebug/ShakebugSDKScreenShotModule.java +196 -0
  144. package/android/src/main/java/com/shakebug/SharedPreferencesModule.java +39 -0
  145. package/android/src/main/java/com/shakebug/UnitConverter.java +48 -0
  146. package/android/src/main/java/com/shakebug/Utility.java +29 -0
  147. package/android/src/main/java/com/shakebug/Utils.java +593 -0
  148. package/android/src/main/java/com/shakebug/VideoMetadata.java +91 -0
  149. package/android/src/main/java/com/shakebug/VideoPlayerModule.java +199 -0
  150. package/android/src/main/java/com/shakebug/VideoThumbnailModule.java +215 -0
  151. package/android/src/main/java/com/shakebug/VideoTrimModule.java +372 -0
  152. package/android/src/main/java/com/shakebug/ViewShot.java +627 -0
  153. package/android/src/main/java/com/shakebug/adapters/VideoTrimmerAdapter.java +54 -0
  154. package/android/src/main/java/com/shakebug/callback/SingleCallback.java +11 -0
  155. package/android/src/main/java/com/shakebug/interfaces/IVideoTrimmerView.java +5 -0
  156. package/android/src/main/java/com/shakebug/interfaces/VideoPlayerListner.java +5 -0
  157. package/android/src/main/java/com/shakebug/interfaces/VideoTrimListener.java +10 -0
  158. package/android/src/main/java/com/shakebug/resolver/DeviceIdResolver.java +87 -0
  159. package/android/src/main/java/com/shakebug/resolver/DeviceTypeResolver.java +94 -0
  160. package/android/src/main/java/com/shakebug/thread/BackgroundExecutor.java +246 -0
  161. package/android/src/main/java/com/shakebug/thread/UiThreadExecutor.java +120 -0
  162. package/android/src/main/java/com/shakebug/types/CellularGeneration.java +60 -0
  163. package/android/src/main/java/com/shakebug/types/ConnectionType.java +26 -0
  164. package/android/src/main/java/com/shakebug/utils/StorageUtil.java +139 -0
  165. package/android/src/main/java/com/shakebug/utils/VideoTrimmerUtil.java +89 -0
  166. package/android/src/main/java/com/shakebug/widgets/RangeSeekBarView.java +534 -0
  167. package/android/src/main/java/com/shakebug/widgets/SpacesItemDecoration2.java +32 -0
  168. package/android/src/main/java/com/shakebug/widgets/VideoPlayerView.java +429 -0
  169. package/android/src/main/java/com/shakebug/widgets/VideoTrimmerView.java +477 -0
  170. package/android/src/main/java/com/shakebug/widgets/ZVideoView.java +48 -0
  171. package/android/src/main/res/drawable/custom_progress.xml +16 -0
  172. package/android/src/main/res/drawable/custom_thumb.xml +4 -0
  173. package/android/src/main/res/drawable/ic_close_button.xml +10 -0
  174. package/android/src/main/res/drawable/ic_video_pause_black.png +0 -0
  175. package/android/src/main/res/drawable/ic_video_play_black.png +0 -0
  176. package/android/src/main/res/drawable/ic_video_thumb_handle.png +0 -0
  177. package/android/src/main/res/drawable/icon_seek_bar.png +0 -0
  178. package/android/src/main/res/layout/video_player_view.xml +121 -0
  179. package/android/src/main/res/layout/video_thumb_item_layout.xml +16 -0
  180. package/android/src/main/res/layout/video_trimmer_view.xml +148 -0
  181. package/android/src/main/res/values/colors.xml +17 -0
  182. package/android/src/main/res/values/strings.xml +14 -0
  183. package/android/src/main/res/xml/imagepicker_provider_paths.xml +4 -0
  184. package/ios/CammeraPermission/RNCameraPermission.h +16 -0
  185. package/ios/CammeraPermission/RNCameraPermission.m +46 -0
  186. package/ios/DeviceInfo/DeviceUID.h +14 -0
  187. package/ios/DeviceInfo/DeviceUID.m +202 -0
  188. package/ios/DeviceInfo/EnvironmentUtil.h +41 -0
  189. package/ios/DeviceInfo/EnvironmentUtil.m +56 -0
  190. package/ios/DeviceInfo/RNDeviceInfo.h +22 -0
  191. package/ios/DeviceInfo/RNDeviceInfo.m +918 -0
  192. package/ios/GetLocals/ShakebugSDKRNLocalize.h +21 -0
  193. package/ios/GetLocals/ShakebugSDKRNLocalize.m +296 -0
  194. package/ios/GetLocation/SettingsUtil.h +16 -0
  195. package/ios/GetLocation/SettingsUtil.m +21 -0
  196. package/ios/GetLocation/ShakebugSDKLocationModule.h +17 -0
  197. package/ios/GetLocation/ShakebugSDKLocationModule.m +218 -0
  198. package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerManager.h +40 -0
  199. package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerManager.m +588 -0
  200. package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerUtils.h +26 -0
  201. package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerUtils.m +194 -0
  202. package/ios/MicrophonePermissionManager.h +14 -0
  203. package/ios/MicrophonePermissionManager.m +35 -0
  204. package/ios/NetInfo/RNCConnectionState.h +42 -0
  205. package/ios/NetInfo/RNCConnectionState.m +119 -0
  206. package/ios/NetInfo/RNCConnectionStateWatcher.h +31 -0
  207. package/ios/NetInfo/RNCConnectionStateWatcher.m +136 -0
  208. package/ios/NetInfo/RNCNetInfo.h +13 -0
  209. package/ios/NetInfo/RNCNetInfo.m +269 -0
  210. package/ios/RecordScreen/ShakebugSDKRecordScreen.h +31 -0
  211. package/ios/RecordScreen/ShakebugSDKRecordScreen.m +309 -0
  212. package/ios/ScreenShot/ShakebugSDKRNViewShot.h +6 -0
  213. package/ios/ScreenShot/ShakebugSDKRNViewShot.m +186 -0
  214. package/ios/ScreenshotDetector/ScreenShotDetector.h +12 -0
  215. package/ios/ScreenshotDetector/ScreenShotDetector.m +37 -0
  216. package/ios/Senors/RNSensorsAccelerometer.h +22 -0
  217. package/ios/Senors/RNSensorsAccelerometer.m +162 -0
  218. package/ios/Senors/RNSensorsBarometer.h +22 -0
  219. package/ios/Senors/RNSensorsBarometer.m +141 -0
  220. package/ios/Senors/RNSensorsGravity.h +22 -0
  221. package/ios/Senors/RNSensorsGravity.m +165 -0
  222. package/ios/Senors/RNSensorsGyroscope.h +22 -0
  223. package/ios/Senors/RNSensorsGyroscope.m +160 -0
  224. package/ios/Senors/RNSensorsMagnetometer.h +22 -0
  225. package/ios/Senors/RNSensorsMagnetometer.m +163 -0
  226. package/ios/Senors/RNSensorsOrientation.h +22 -0
  227. package/ios/Senors/RNSensorsOrientation.m +189 -0
  228. package/ios/Senors/RNSensorsUtils.h +7 -0
  229. package/ios/Senors/RNSensorsUtils.m +9 -0
  230. package/ios/Shakebug.h +7 -0
  231. package/ios/Shakebug.m +16 -0
  232. package/ios/Shakebug.xcodeproj/project.pbxproj +872 -0
  233. package/ios/Shakebug.xcodeproj/xcshareddata/xcschemes/Shakebug.xcscheme +66 -0
  234. package/ios/Shakebug.xcworkspace/contents.xcworkspacedata +10 -0
  235. package/ios/Shakebug.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  236. package/ios/SketchCanvas/DrawingView.h +18 -0
  237. package/ios/SketchCanvas/DrawingView.m +96 -0
  238. package/ios/SketchCanvas/DrawingViewManager.h +12 -0
  239. package/ios/SketchCanvas/DrawingViewManager.m +35 -0
  240. package/ios/Storage/SharedPreferencesModule.h +13 -0
  241. package/ios/Storage/SharedPreferencesModule.m +35 -0
  242. package/ios/Thumbnaill/VideoThumbnailManager.h +12 -0
  243. package/ios/Thumbnaill/VideoThumbnailManager.m +73 -0
  244. package/ios/TrimVideo/ShakebugSDKVideoTrim.swift +372 -0
  245. package/ios/TrimVideo/VideoTrim-Bridging-Header.h +10 -0
  246. package/ios/TrimVideo/VideoTrim.m +23 -0
  247. package/ios/TrimVideo/VideoTrimmer.swift +810 -0
  248. package/ios/TrimVideo/VideoTrimmerThumb.swift +119 -0
  249. package/ios/TrimVideo/VideoTrimmerViewController.swift +301 -0
  250. package/ios/VideoPlayer/VideoPlayerModule.h +14 -0
  251. package/ios/VideoPlayer/VideoPlayerModule.m +29 -0
  252. package/ios/VideoPlayer/VideoPlayerViewController.h +18 -0
  253. package/ios/VideoPlayer/VideoPlayerViewController.m +29 -0
  254. package/package.json +45 -0
  255. package/shakebug-react-native.podspec +50 -0
  256. package/src/APIs/AddIssue.js +70 -0
  257. package/src/APIs/EndSession.js +32 -0
  258. package/src/APIs/Event.js +39 -0
  259. package/src/APIs/MatchKey.js +40 -0
  260. package/src/APIs/StartSession.js +84 -0
  261. package/src/Assets/images/OpenSketch.png +0 -0
  262. package/src/Assets/images/Push.png +0 -0
  263. package/src/Assets/images/RemoveTextView.png +0 -0
  264. package/src/Assets/images/black.png +0 -0
  265. package/src/Assets/images/blue.png +0 -0
  266. package/src/Assets/images/borderdBlack.png +0 -0
  267. package/src/Assets/images/borderdBlue.png +0 -0
  268. package/src/Assets/images/borderdGreen.png +0 -0
  269. package/src/Assets/images/borderdRed.png +0 -0
  270. package/src/Assets/images/borderdYellow.png +0 -0
  271. package/src/Assets/images/clear.png +0 -0
  272. package/src/Assets/images/close.png +0 -0
  273. package/src/Assets/images/green.png +0 -0
  274. package/src/Assets/images/next.png +0 -0
  275. package/src/Assets/images/play.png +0 -0
  276. package/src/Assets/images/red.png +0 -0
  277. package/src/Assets/images/shake.png +0 -0
  278. package/src/Assets/images/shakebugLogo.png +0 -0
  279. package/src/Assets/images/stopButton.png +0 -0
  280. package/src/Assets/images/text_icon.png +0 -0
  281. package/src/Assets/images/yellow.png +0 -0
  282. package/src/Componanats/CustomAlert.js +80 -0
  283. package/src/Componanats/ErrorHandler.js +80 -0
  284. package/src/Componanats/GlobalStateContext.js +22 -0
  285. package/src/Componanats/KeyboardAvoidingWrapper.js +43 -0
  286. package/src/Componanats/NavigationContext.js +42 -0
  287. package/src/Componanats/ShakeFunction.js +562 -0
  288. package/src/Componanats/localization.js +482 -0
  289. package/src/Screens/AddDetailsScreen.js +462 -0
  290. package/src/Screens/FirstScreen.js +629 -0
  291. package/src/Screens/Shakebug.js +487 -0
  292. package/src/Screens/StrockView.js +20 -0
  293. package/src/Screens/TrimVideoScreen.js +81 -0
  294. package/src/Screens/TutorialScreen.js +36 -0
  295. package/src/index.tsx +117 -0
  296. package/trimVideo/src/index.tsx +141 -0
@@ -0,0 +1,479 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+ import fetchMock from 'jest-fetch-mock';
11
+ import NetInfo from '../index';
12
+ import NativeInterface from '../internal/nativeInterface';
13
+ import {NetInfoStateType, NetInfoCellularGeneration} from '../internal/types';
14
+ import {DEVICE_CONNECTIVITY_EVENT} from '../internal/privateTypes';
15
+
16
+ // Mock modules
17
+ fetchMock.enableMocks();
18
+ jest.mock('../internal/nativeModule');
19
+ const mockNativeModule = jest.requireMock('../internal/nativeModule').default;
20
+
21
+ beforeEach(() => {
22
+ mockNativeModule.getCurrentState.mockReset();
23
+ });
24
+
25
+ describe('@react-native-community/netinfo fetch', () => {
26
+ describe('with cellular data types', () => {
27
+ describe('5g cellular generation', () => {
28
+ function dataProvider() {
29
+ return [
30
+ {
31
+ description:
32
+ 'should resolve the promise correctly with expected 5g settings',
33
+ expectedConnectionInfo: {
34
+ type: NetInfoStateType.cellular,
35
+ isConnected: true,
36
+ isInternetReachable: true,
37
+ details: {
38
+ isConnectionExpensive: true,
39
+ cellularGeneration: NetInfoCellularGeneration['5g'],
40
+ },
41
+ },
42
+ },
43
+ {
44
+ description:
45
+ 'should resolve the promise correctly when 5g returns not connected',
46
+ expectedConnectionInfo: {
47
+ type: NetInfoStateType.cellular,
48
+ isConnected: false,
49
+ isInternetReachable: true,
50
+ details: {
51
+ isConnectionExpensive: true,
52
+ cellularGeneration: NetInfoCellularGeneration['5g'],
53
+ },
54
+ },
55
+ },
56
+ {
57
+ description:
58
+ 'should resolve the promise correctly when 5g returns internet not reachable',
59
+ expectedConnectionInfo: {
60
+ type: NetInfoStateType.cellular,
61
+ isConnected: true,
62
+ isInternetReachable: false,
63
+ details: {
64
+ isConnectionExpensive: true,
65
+ cellularGeneration: NetInfoCellularGeneration['5g'],
66
+ },
67
+ },
68
+ },
69
+ ];
70
+ }
71
+
72
+ dataProvider().forEach(testCase => {
73
+ it(testCase.description, () => {
74
+ mockNativeModule.getCurrentState.mockResolvedValue(
75
+ testCase.expectedConnectionInfo,
76
+ );
77
+
78
+ NativeInterface.eventEmitter.emit(
79
+ DEVICE_CONNECTIVITY_EVENT,
80
+ testCase.expectedConnectionInfo,
81
+ );
82
+ expect(NetInfo.fetch()).resolves.toEqual(
83
+ testCase.expectedConnectionInfo,
84
+ );
85
+ });
86
+ });
87
+ });
88
+
89
+ describe('4g cellular generation', () => {
90
+ function dataProvider() {
91
+ return [
92
+ {
93
+ description:
94
+ 'should resolve the promise correctly with expected 4g settings',
95
+ expectedConnectionInfo: {
96
+ type: NetInfoStateType.cellular,
97
+ isConnected: true,
98
+ isInternetReachable: true,
99
+ details: {
100
+ isConnectionExpensive: true,
101
+ cellularGeneration: NetInfoCellularGeneration['4g'],
102
+ },
103
+ },
104
+ },
105
+ {
106
+ description:
107
+ 'should resolve the promise correctly when 4g returns not connected',
108
+ expectedConnectionInfo: {
109
+ type: NetInfoStateType.cellular,
110
+ isConnected: false,
111
+ isInternetReachable: true,
112
+ details: {
113
+ isConnectionExpensive: true,
114
+ cellularGeneration: NetInfoCellularGeneration['4g'],
115
+ },
116
+ },
117
+ },
118
+ {
119
+ description:
120
+ 'should resolve the promise correctly when 4g returns internet not reachable',
121
+ expectedConnectionInfo: {
122
+ type: NetInfoStateType.cellular,
123
+ isConnected: true,
124
+ isInternetReachable: false,
125
+ details: {
126
+ isConnectionExpensive: true,
127
+ cellularGeneration: NetInfoCellularGeneration['4g'],
128
+ },
129
+ },
130
+ },
131
+ ];
132
+ }
133
+
134
+ dataProvider().forEach(testCase => {
135
+ it(testCase.description, () => {
136
+ mockNativeModule.getCurrentState.mockResolvedValue(
137
+ testCase.expectedConnectionInfo,
138
+ );
139
+
140
+ NativeInterface.eventEmitter.emit(
141
+ DEVICE_CONNECTIVITY_EVENT,
142
+ testCase.expectedConnectionInfo,
143
+ );
144
+ expect(NetInfo.fetch()).resolves.toEqual(
145
+ testCase.expectedConnectionInfo,
146
+ );
147
+ });
148
+ });
149
+ });
150
+
151
+ describe('3g cellular generation', () => {
152
+ function dataProvider() {
153
+ return [
154
+ {
155
+ description:
156
+ 'should resolve the promise correctly with expected settings',
157
+ expectedConnectionInfo: {
158
+ type: NetInfoStateType.cellular,
159
+ isConnected: true,
160
+ isInternetReachable: true,
161
+ details: {
162
+ isConnectionExpensive: true,
163
+ cellularGeneration: NetInfoCellularGeneration['3g'],
164
+ },
165
+ },
166
+ },
167
+ {
168
+ description:
169
+ 'should resolve the promise correctly when not connected',
170
+ expectedConnectionInfo: {
171
+ type: NetInfoStateType.cellular,
172
+ isConnected: false,
173
+ isInternetReachable: true,
174
+ details: {
175
+ isConnectionExpensive: true,
176
+ cellularGeneration: NetInfoCellularGeneration['3g'],
177
+ },
178
+ },
179
+ },
180
+ {
181
+ description:
182
+ 'should resolve the promise correctly when internet is not reachable',
183
+ expectedConnectionInfo: {
184
+ type: NetInfoStateType.cellular,
185
+ isConnected: true,
186
+ isInternetReachable: false,
187
+ details: {
188
+ isConnectionExpensive: true,
189
+ cellularGeneration: NetInfoCellularGeneration['3g'],
190
+ },
191
+ },
192
+ },
193
+ ];
194
+ }
195
+
196
+ dataProvider().forEach(testCase => {
197
+ it(testCase.description, () => {
198
+ mockNativeModule.getCurrentState.mockResolvedValue(
199
+ testCase.expectedConnectionInfo,
200
+ );
201
+
202
+ NativeInterface.eventEmitter.emit(
203
+ DEVICE_CONNECTIVITY_EVENT,
204
+ testCase.expectedConnectionInfo,
205
+ );
206
+ expect(NetInfo.fetch()).resolves.toEqual(
207
+ testCase.expectedConnectionInfo,
208
+ );
209
+ });
210
+ });
211
+ });
212
+
213
+ describe('2g cellular generation', () => {
214
+ function dataProvider() {
215
+ return [
216
+ {
217
+ description:
218
+ 'should resolve the promise correctly with expected settings',
219
+ expectedConnectionInfo: {
220
+ type: NetInfoStateType.cellular,
221
+ isConnected: true,
222
+ isInternetReachable: true,
223
+ details: {
224
+ isConnectionExpensive: true,
225
+ cellularGeneration: NetInfoCellularGeneration['2g'],
226
+ },
227
+ },
228
+ },
229
+ {
230
+ description:
231
+ 'should resolve the promise correctly when not connected',
232
+ expectedConnectionInfo: {
233
+ type: NetInfoStateType.cellular,
234
+ isConnected: false,
235
+ isInternetReachable: true,
236
+ details: {
237
+ isConnectionExpensive: true,
238
+ cellularGeneration: NetInfoCellularGeneration['2g'],
239
+ },
240
+ },
241
+ },
242
+ {
243
+ description:
244
+ 'should resolve the promise correctly when internet is not reachable',
245
+ expectedConnectionInfo: {
246
+ type: NetInfoStateType.cellular,
247
+ isConnected: true,
248
+ isInternetReachable: false,
249
+ details: {
250
+ isConnectionExpensive: true,
251
+ cellularGeneration: NetInfoCellularGeneration['2g'],
252
+ },
253
+ },
254
+ },
255
+ ];
256
+ }
257
+
258
+ dataProvider().forEach(testCase => {
259
+ it(testCase.description, () => {
260
+ mockNativeModule.getCurrentState.mockResolvedValue(
261
+ testCase.expectedConnectionInfo,
262
+ );
263
+
264
+ NativeInterface.eventEmitter.emit(
265
+ DEVICE_CONNECTIVITY_EVENT,
266
+ testCase.expectedConnectionInfo,
267
+ );
268
+ expect(NetInfo.fetch()).resolves.toEqual(
269
+ testCase.expectedConnectionInfo,
270
+ );
271
+ });
272
+ });
273
+ });
274
+
275
+ describe('null cellular generation', () => {
276
+ function dataProvider() {
277
+ return [
278
+ {
279
+ description:
280
+ 'should resolve the promise correctly with expected settings',
281
+ expectedConnectionInfo: {
282
+ type: NetInfoStateType.cellular,
283
+ isConnected: true,
284
+ isInternetReachable: true,
285
+ details: {
286
+ isConnectionExpensive: true,
287
+ cellularGeneration: null,
288
+ },
289
+ },
290
+ },
291
+ {
292
+ description:
293
+ 'should resolve the promise correctly when not connected',
294
+ expectedConnectionInfo: {
295
+ type: NetInfoStateType.cellular,
296
+ isConnected: false,
297
+ isInternetReachable: true,
298
+ details: {
299
+ isConnectionExpensive: true,
300
+ cellularGeneration: null,
301
+ },
302
+ },
303
+ },
304
+ {
305
+ description:
306
+ 'should resolve the promise correctly when internet is not reachable',
307
+ expectedConnectionInfo: {
308
+ type: NetInfoStateType.cellular,
309
+ isConnected: true,
310
+ isInternetReachable: false,
311
+ details: {
312
+ isConnectionExpensive: true,
313
+ cellularGeneration: null,
314
+ },
315
+ },
316
+ },
317
+ ];
318
+ }
319
+
320
+ dataProvider().forEach(testCase => {
321
+ it(testCase.description, () => {
322
+ mockNativeModule.getCurrentState.mockResolvedValue(
323
+ testCase.expectedConnectionInfo,
324
+ );
325
+
326
+ NativeInterface.eventEmitter.emit(
327
+ DEVICE_CONNECTIVITY_EVENT,
328
+ testCase.expectedConnectionInfo,
329
+ );
330
+ expect(NetInfo.fetch()).resolves.toEqual(
331
+ testCase.expectedConnectionInfo,
332
+ );
333
+ });
334
+ });
335
+ });
336
+ });
337
+
338
+ describe('with unknown and no connection data types', () => {
339
+ function dataProvider() {
340
+ return [
341
+ {
342
+ description:
343
+ 'should resolve the promise correctly when no connection is established (airplane mode)',
344
+ expectedConnectionInfo: {
345
+ type: NetInfoStateType.none,
346
+ isConnected: false,
347
+ isInternetReachable: true,
348
+ details: null,
349
+ },
350
+ },
351
+ {
352
+ description:
353
+ 'should resolve the promise correctly when connection type cannot be determined',
354
+ expectedConnectionInfo: {
355
+ type: NetInfoStateType.unknown,
356
+ isConnected: false,
357
+ isInternetReachable: true,
358
+ details: null,
359
+ },
360
+ },
361
+ ];
362
+ }
363
+
364
+ dataProvider().forEach(testCase => {
365
+ it(testCase.description, () => {
366
+ mockNativeModule.getCurrentState.mockResolvedValue(
367
+ testCase.expectedConnectionInfo,
368
+ );
369
+
370
+ NativeInterface.eventEmitter.emit(
371
+ DEVICE_CONNECTIVITY_EVENT,
372
+ testCase.expectedConnectionInfo,
373
+ );
374
+ expect(NetInfo.fetch()).resolves.toEqual(
375
+ testCase.expectedConnectionInfo,
376
+ );
377
+ });
378
+ });
379
+ });
380
+
381
+ describe('rejected promises are handled', () => {
382
+ it('will properly reject a promise if the connection request cannot be resolved', async () => {
383
+ const rejectionMessage = 'nope, no connection info for you';
384
+
385
+ // Mock `_fetchCurrentState` in the State constructor.
386
+ mockNativeModule.getCurrentState.mockResolvedValueOnce({
387
+ type: NetInfoStateType.cellular,
388
+ isConnected: true,
389
+ isInternetReachable: true,
390
+ details: {
391
+ isConnectionExpensive: true,
392
+ cellularGeneration: NetInfoCellularGeneration['4g'],
393
+ },
394
+ });
395
+
396
+ mockNativeModule.getCurrentState.mockRejectedValue(
397
+ new Error(rejectionMessage),
398
+ );
399
+
400
+ try {
401
+ await NetInfo.fetch();
402
+ } catch (error) {
403
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
404
+ // @ts-ignore
405
+ expect(error.message).toMatch(rejectionMessage);
406
+ }
407
+ });
408
+ });
409
+
410
+ describe('with configuration options', () => {
411
+ beforeAll(() => {
412
+ // Prevent `_checkInternetReachability` from rescheduling.
413
+ jest.useFakeTimers();
414
+ });
415
+
416
+ beforeEach(() => {
417
+ fetchMock.resetMocks();
418
+ });
419
+
420
+ describe('reachabilityShouldRun', () => {
421
+ function dataProvider() {
422
+ return [
423
+ {
424
+ description: 'reachabilityShouldRun returns true',
425
+ configuration: {
426
+ reachabilityShouldRun: () => true,
427
+ },
428
+ expectedConnectionInfo: {
429
+ type: 'wifi',
430
+ isConnected: true,
431
+ details: {
432
+ isConnectionExpensive: true,
433
+ cellularGeneration: 'unknown',
434
+ },
435
+ },
436
+ expectedIsInternetReachable: null,
437
+ expectFetchToBeCalled: true,
438
+ },
439
+ {
440
+ description: 'reachabilityShouldRun returns false',
441
+ configuration: {
442
+ reachabilityShouldRun: () => false,
443
+ },
444
+ expectedConnectionInfo: {
445
+ type: 'wifi',
446
+ isConnected: true,
447
+ details: {
448
+ isConnectionExpensive: true,
449
+ cellularGeneration: 'unknown',
450
+ },
451
+ },
452
+ expectedIsInternetReachable: false,
453
+ expectFetchToBeCalled: false,
454
+ },
455
+ ];
456
+ }
457
+
458
+ dataProvider().forEach(testCase => {
459
+ it(testCase.description, async () => {
460
+ mockNativeModule.getCurrentState.mockResolvedValue(
461
+ testCase.expectedConnectionInfo,
462
+ );
463
+
464
+ // Configure NetInfo.
465
+ NetInfo.configure(testCase.configuration);
466
+
467
+ await expect(NetInfo.fetch()).resolves.toEqual({
468
+ ...testCase.expectedConnectionInfo,
469
+ isInternetReachable: testCase.expectedIsInternetReachable,
470
+ });
471
+
472
+ testCase.expectFetchToBeCalled
473
+ ? expect(fetchMock).toHaveBeenCalled()
474
+ : expect(fetchMock).not.toHaveBeenCalled();
475
+ });
476
+ });
477
+ });
478
+ });
479
+ });
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+ import {useState, useEffect, useCallback} from 'react';
11
+ import {Platform} from 'react-native';
12
+ import DEFAULT_CONFIGURATION from './internal/defaultConfiguration';
13
+ import NativeInterface from './internal/nativeInterface';
14
+ import State from './internal/state';
15
+ import * as Types from './internal/types';
16
+
17
+ // Stores the currently used configuration
18
+ let _configuration = DEFAULT_CONFIGURATION;
19
+
20
+ // Stores the singleton reference to the state manager
21
+ let _state: State | null = null;
22
+ const createState = (): State => {
23
+ return new State(_configuration);
24
+ };
25
+
26
+ /**
27
+ * Configures the library with the given configuration. Note that calling this will stop all
28
+ * previously added listeners from being called again. It is best to call this right when your
29
+ * application is started to avoid issues. The configuration sets up a global singleton instance.
30
+ *
31
+ * @param configuration The new configuration to set.
32
+ */
33
+ export function configure(
34
+ configuration: Partial<Types.NetInfoConfiguration>,
35
+ ): void {
36
+ _configuration = {
37
+ ...DEFAULT_CONFIGURATION,
38
+ ...configuration,
39
+ };
40
+
41
+ if (_state) {
42
+ _state.tearDown();
43
+ _state = createState();
44
+ }
45
+
46
+ if (Platform.OS === 'ios') {
47
+ NativeInterface.configure(configuration);
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Returns a `Promise` that resolves to a `NetInfoState` object.
53
+ * This function operates on the global singleton instance configured using `configure()`
54
+ *
55
+ * @param [requestedInterface] interface from which to obtain the information
56
+ *
57
+ * @returns A Promise which contains the current connection state.
58
+ */
59
+ export function fetch(
60
+ requestedInterface?: string,
61
+ ): Promise<Types.NetInfoState> {
62
+ if (!_state) {
63
+ _state = createState();
64
+ }
65
+ return _state.latest(requestedInterface);
66
+ }
67
+
68
+ /**
69
+ * Force-refreshes the internal state of the global singleton managed by this library.
70
+ *
71
+ * @returns A Promise which contains the updated connection state.
72
+ */
73
+ export function refresh(): Promise<Types.NetInfoState> {
74
+ if (!_state) {
75
+ _state = createState();
76
+ }
77
+ return _state._fetchCurrentState();
78
+ }
79
+
80
+ /**
81
+ * Subscribe to the global singleton's connection information. The callback is called with a parameter of type
82
+ * [`NetInfoState`](README.md#netinfostate) whenever the connection state changes. Your listener
83
+ * will be called with the latest information soon after you subscribe and then with any
84
+ * subsequent changes afterwards. You should not assume that the listener is called in the same
85
+ * way across devices or platforms.
86
+ *
87
+ * @param listener The listener which is called when the network state changes.
88
+ *
89
+ * @returns A function which can be called to unsubscribe.
90
+ */
91
+ export function addEventListener(
92
+ listener: Types.NetInfoChangeHandler,
93
+ ): Types.NetInfoSubscription {
94
+ if (!_state) {
95
+ _state = createState();
96
+ }
97
+
98
+ _state.add(listener);
99
+ return (): void => {
100
+ _state && _state.remove(listener);
101
+ };
102
+ }
103
+
104
+ /**
105
+ * A React Hook into this library's singleton which updates when the connection state changes.
106
+ *
107
+ * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook
108
+ *
109
+ * @returns The connection state.
110
+ */
111
+ export function useNetInfo(
112
+ configuration?: Partial<Types.NetInfoConfiguration>,
113
+ ): Types.NetInfoState {
114
+ if (configuration) {
115
+ configure(configuration);
116
+ }
117
+
118
+ const [netInfo, setNetInfo] = useState<Types.NetInfoState>({
119
+ type: Types.NetInfoStateType.unknown,
120
+ isConnected: null,
121
+ isInternetReachable: null,
122
+ details: null,
123
+ });
124
+
125
+ useEffect((): (() => void) => {
126
+ return addEventListener(setNetInfo);
127
+ }, []);
128
+
129
+ return netInfo;
130
+ }
131
+
132
+ /**
133
+ * A React Hook which manages an isolated instance of the network info manager.
134
+ * This is not a hook into a singleton shared state. NetInfo.configure, NetInfo.addEventListener,
135
+ * NetInfo.fetch, NetInfo.refresh are performed on a global singleton and have no affect on this hook.
136
+ * @param {boolean} isPaused - Pause the internal network checks.
137
+ * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook
138
+ *
139
+ * @returns the netInfo state and a refresh function
140
+ */
141
+ export function useNetInfoInstance(
142
+ isPaused = false,
143
+ configuration?: Partial<Types.NetInfoConfiguration>,
144
+ ) {
145
+ const [networkInfoManager, setNetworkInfoManager] = useState<State>();
146
+ const [netInfo, setNetInfo] = useState<Types.NetInfoState>({
147
+ type: Types.NetInfoStateType.unknown,
148
+ isConnected: null,
149
+ isInternetReachable: null,
150
+ details: null,
151
+ });
152
+
153
+ useEffect(() => {
154
+ if (isPaused) {
155
+ return;
156
+ }
157
+ const config = {
158
+ ...DEFAULT_CONFIGURATION,
159
+ ...configuration,
160
+ };
161
+ const state = new State(config);
162
+ setNetworkInfoManager(state);
163
+ state.add(setNetInfo);
164
+ return state.tearDown;
165
+ }, [isPaused, configuration]);
166
+
167
+ const refresh = useCallback(() => {
168
+ networkInfoManager && networkInfoManager._fetchCurrentState();
169
+ }, [networkInfoManager]);
170
+
171
+ return {
172
+ netInfo,
173
+ refresh,
174
+ };
175
+ }
176
+
177
+ export * from './internal/types';
178
+
179
+ export default {
180
+ configure,
181
+ fetch,
182
+ refresh,
183
+ addEventListener,
184
+ useNetInfo,
185
+ useNetInfoInstance,
186
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @format
3
+ */
4
+ /* eslint-env jest */
5
+
6
+ const RNCNetInfoMock = {
7
+ configure: jest.fn(),
8
+ getCurrentState: jest.fn(),
9
+ addListener: jest.fn(),
10
+ removeListeners: jest.fn(),
11
+ };
12
+
13
+ export default RNCNetInfoMock;
@@ -0,0 +1,17 @@
1
+ import * as Types from './types';
2
+
3
+ const DEFAULT_CONFIGURATION: Types.NetInfoConfiguration = {
4
+ reachabilityUrl: 'https://clients3.google.com/generate_204',
5
+ reachabilityMethod: 'HEAD',
6
+ reachabilityHeaders: {},
7
+ reachabilityTest: (response: Response): Promise<boolean> =>
8
+ Promise.resolve(response.status === 204),
9
+ reachabilityShortTimeout: 5 * 1000, // 5s
10
+ reachabilityLongTimeout: 60 * 1000, // 60s
11
+ reachabilityRequestTimeout: 15 * 1000, // 15s
12
+ reachabilityShouldRun: (): boolean => true,
13
+ shouldFetchWiFiSSID: false,
14
+ useNativeReachability: true
15
+ };
16
+
17
+ export default DEFAULT_CONFIGURATION;
@@ -0,0 +1,17 @@
1
+ import * as Types from './types';
2
+
3
+ const DEFAULT_CONFIGURATION: Types.NetInfoConfiguration = {
4
+ reachabilityUrl: '/',
5
+ reachabilityMethod: "HEAD",
6
+ reachabilityHeaders: {},
7
+ reachabilityTest: (response: Response): Promise<boolean> =>
8
+ Promise.resolve(response.status === 200),
9
+ reachabilityShortTimeout: 5 * 1000, // 5s
10
+ reachabilityLongTimeout: 60 * 1000, // 60s
11
+ reachabilityRequestTimeout: 15 * 1000, // 15s
12
+ reachabilityShouldRun: (): boolean => true,
13
+ shouldFetchWiFiSSID: true,
14
+ useNativeReachability: true
15
+ };
16
+
17
+ export default DEFAULT_CONFIGURATION