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.
- package/DeviceInfo/index.js.flow +177 -0
- package/DeviceInfo/index.ts +1034 -0
- package/DeviceInfo/internal/asyncHookWrappers.ts +59 -0
- package/DeviceInfo/internal/devicesWithDynamicIsland.ts +30 -0
- package/DeviceInfo/internal/devicesWithNotch.ts +374 -0
- package/DeviceInfo/internal/nativeInterface.ts +28 -0
- package/DeviceInfo/internal/privateTypes.ts +231 -0
- package/DeviceInfo/internal/supported-platform-info.ts +97 -0
- package/DeviceInfo/internal/types.ts +19 -0
- package/DeviceInfo/web/index.js +223 -0
- package/GetLocals/src/NativeRNLocalize.ts +18 -0
- package/GetLocals/src/constants.ts +269 -0
- package/GetLocals/src/index.ts +56 -0
- package/GetLocals/src/module.ts +51 -0
- package/GetLocals/src/module.web.ts +148 -0
- package/GetLocals/src/types.ts +31 -0
- package/GetLocation/LocationError.ts +20 -0
- package/GetLocation/index.ts +46 -0
- package/GetLocation/utils.ts +89 -0
- package/ImageOrVedioPicker/src/index.ts +28 -0
- package/ImageOrVedioPicker/src/platforms/NativeImagePicker.ts +10 -0
- package/ImageOrVedioPicker/src/platforms/native.ts +61 -0
- package/ImageOrVedioPicker/src/platforms/web.ts +159 -0
- package/ImageOrVedioPicker/src/types.ts +74 -0
- package/NetInfo/src/__tests__/eventListenerCallbacks.spec.ts +332 -0
- package/NetInfo/src/__tests__/fetch.spec.ts +479 -0
- package/NetInfo/src/index.ts +186 -0
- package/NetInfo/src/internal/__mocks__/nativeModule.ts +13 -0
- package/NetInfo/src/internal/defaultConfiguration.ts +17 -0
- package/NetInfo/src/internal/defaultConfiguration.web.ts +17 -0
- package/NetInfo/src/internal/internetReachability.ts +180 -0
- package/NetInfo/src/internal/nativeInterface.ts +43 -0
- package/NetInfo/src/internal/nativeInterface.web.ts +27 -0
- package/NetInfo/src/internal/nativeModule.ts +15 -0
- package/NetInfo/src/internal/nativeModule.web.ts +306 -0
- package/NetInfo/src/internal/privateTypes.ts +41 -0
- package/NetInfo/src/internal/state.ts +137 -0
- package/NetInfo/src/internal/types.ts +128 -0
- package/README.md +246 -0
- package/RecordScreen/src/index.tsx +75 -0
- package/ScreenShot/src/RNViewShot.js +3 -0
- package/ScreenShot/src/RNViewShot.web.js +42 -0
- package/ScreenShot/src/index.js +308 -0
- package/Sensor/src/index.js +14 -0
- package/Sensor/src/rnsensors.js +57 -0
- package/Sensor/src/sensors.js +97 -0
- package/VideoPlayer/PlayVideo.tsx +51 -0
- package/VideoPlayer/index.js +69 -0
- package/android/README.md +14 -0
- package/android/build/generated/source/buildConfig/debug/com/shakebug/BuildConfig.java +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +42 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +6 -0
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +47 -0
- package/android/build/intermediates/compiled_local_resources/debug/out/xml_imagepicker_provider_paths.xml.flat +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +12 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/CustomMediaMetadataRetriever.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ImageMetadata.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ImagePickerProvider.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/Metadata.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/Options.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/RecordScreenModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/RecordScreenModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/Shakebug.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ShakebugPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/Utility.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/Utils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/VideoMetadata.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$Formats.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$Results.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot$ReusableByteArrayOutputStream.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/shakebug/ViewShot.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +49 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +82 -0
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +42 -0
- package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
- package/android/build/intermediates/packaged_res/debug/values/values.xml +25 -0
- package/android/build/intermediates/packaged_res/debug/xml/imagepicker_provider_paths.xml +4 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/CustomMediaMetadataRetriever.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ImageMetadata.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ImagePickerProvider.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Metadata.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Options.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/RecordScreenModule$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/RecordScreenModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Shakebug.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ShakebugPackage.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Utility.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/Utils.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/VideoMetadata.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$Formats.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$Results.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot$ReusableByteArrayOutputStream.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/com/shakebug/ViewShot.class +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +48 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +97 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +235 -0
- package/android/src/main/AndroidManifest.xml +40 -0
- package/android/src/main/java/com/shakebug/AmazonFireDeviceConnectivityPoller.java +170 -0
- package/android/src/main/java/com/shakebug/BaseUtils.java +33 -0
- package/android/src/main/java/com/shakebug/BroadcastReceiverConnectivityReceiver.java +131 -0
- package/android/src/main/java/com/shakebug/ConnectivityReceiver.java +318 -0
- package/android/src/main/java/com/shakebug/CrashLoggerModule.java +48 -0
- package/android/src/main/java/com/shakebug/DateUtil.java +64 -0
- package/android/src/main/java/com/shakebug/DeviceType.java +18 -0
- package/android/src/main/java/com/shakebug/DeviceUtil.java +46 -0
- package/android/src/main/java/com/shakebug/DrawingView.java +90 -0
- package/android/src/main/java/com/shakebug/DrawingViewManager.java +38 -0
- package/android/src/main/java/com/shakebug/GetLocation.java +147 -0
- package/android/src/main/java/com/shakebug/ImageMetadata.java +42 -0
- package/android/src/main/java/com/shakebug/ImagePickerProvider.java +8 -0
- package/android/src/main/java/com/shakebug/Metadata.java +46 -0
- package/android/src/main/java/com/shakebug/NetInfoModule.java +79 -0
- package/android/src/main/java/com/shakebug/NetInfoUtils.java +50 -0
- package/android/src/main/java/com/shakebug/NetworkCallbackConnectivityReceiver.java +209 -0
- package/android/src/main/java/com/shakebug/Options.java +42 -0
- package/android/src/main/java/com/shakebug/RNDeviceModule.java +1036 -0
- package/android/src/main/java/com/shakebug/RNInstallReferrerClient.java +124 -0
- package/android/src/main/java/com/shakebug/RNLocalizeModule.java +79 -0
- package/android/src/main/java/com/shakebug/RNLocalizeModuleImpl.java +258 -0
- package/android/src/main/java/com/shakebug/ReactNativeGetLocationModule.java +95 -0
- package/android/src/main/java/com/shakebug/RecordScreenModule.java +202 -0
- package/android/src/main/java/com/shakebug/ScreenshotDetectorModule.java +63 -0
- package/android/src/main/java/com/shakebug/SettingsUtil.java +44 -0
- package/android/src/main/java/com/shakebug/Shakebug.java +181 -0
- package/android/src/main/java/com/shakebug/ShakebugPackage.java +75 -0
- package/android/src/main/java/com/shakebug/ShakebugSDKImagePickerModule.java +56 -0
- package/android/src/main/java/com/shakebug/ShakebugSDKImagePickerModuleImpl.java +230 -0
- package/android/src/main/java/com/shakebug/ShakebugSDKScreenShotModule.java +196 -0
- package/android/src/main/java/com/shakebug/SharedPreferencesModule.java +39 -0
- package/android/src/main/java/com/shakebug/UnitConverter.java +48 -0
- package/android/src/main/java/com/shakebug/Utility.java +29 -0
- package/android/src/main/java/com/shakebug/Utils.java +593 -0
- package/android/src/main/java/com/shakebug/VideoMetadata.java +91 -0
- package/android/src/main/java/com/shakebug/VideoPlayerModule.java +199 -0
- package/android/src/main/java/com/shakebug/VideoThumbnailModule.java +215 -0
- package/android/src/main/java/com/shakebug/VideoTrimModule.java +372 -0
- package/android/src/main/java/com/shakebug/ViewShot.java +627 -0
- package/android/src/main/java/com/shakebug/adapters/VideoTrimmerAdapter.java +54 -0
- package/android/src/main/java/com/shakebug/callback/SingleCallback.java +11 -0
- package/android/src/main/java/com/shakebug/interfaces/IVideoTrimmerView.java +5 -0
- package/android/src/main/java/com/shakebug/interfaces/VideoPlayerListner.java +5 -0
- package/android/src/main/java/com/shakebug/interfaces/VideoTrimListener.java +10 -0
- package/android/src/main/java/com/shakebug/resolver/DeviceIdResolver.java +87 -0
- package/android/src/main/java/com/shakebug/resolver/DeviceTypeResolver.java +94 -0
- package/android/src/main/java/com/shakebug/thread/BackgroundExecutor.java +246 -0
- package/android/src/main/java/com/shakebug/thread/UiThreadExecutor.java +120 -0
- package/android/src/main/java/com/shakebug/types/CellularGeneration.java +60 -0
- package/android/src/main/java/com/shakebug/types/ConnectionType.java +26 -0
- package/android/src/main/java/com/shakebug/utils/StorageUtil.java +139 -0
- package/android/src/main/java/com/shakebug/utils/VideoTrimmerUtil.java +89 -0
- package/android/src/main/java/com/shakebug/widgets/RangeSeekBarView.java +534 -0
- package/android/src/main/java/com/shakebug/widgets/SpacesItemDecoration2.java +32 -0
- package/android/src/main/java/com/shakebug/widgets/VideoPlayerView.java +429 -0
- package/android/src/main/java/com/shakebug/widgets/VideoTrimmerView.java +477 -0
- package/android/src/main/java/com/shakebug/widgets/ZVideoView.java +48 -0
- package/android/src/main/res/drawable/custom_progress.xml +16 -0
- package/android/src/main/res/drawable/custom_thumb.xml +4 -0
- package/android/src/main/res/drawable/ic_close_button.xml +10 -0
- package/android/src/main/res/drawable/ic_video_pause_black.png +0 -0
- package/android/src/main/res/drawable/ic_video_play_black.png +0 -0
- package/android/src/main/res/drawable/ic_video_thumb_handle.png +0 -0
- package/android/src/main/res/drawable/icon_seek_bar.png +0 -0
- package/android/src/main/res/layout/video_player_view.xml +121 -0
- package/android/src/main/res/layout/video_thumb_item_layout.xml +16 -0
- package/android/src/main/res/layout/video_trimmer_view.xml +148 -0
- package/android/src/main/res/values/colors.xml +17 -0
- package/android/src/main/res/values/strings.xml +14 -0
- package/android/src/main/res/xml/imagepicker_provider_paths.xml +4 -0
- package/ios/CammeraPermission/RNCameraPermission.h +16 -0
- package/ios/CammeraPermission/RNCameraPermission.m +46 -0
- package/ios/DeviceInfo/DeviceUID.h +14 -0
- package/ios/DeviceInfo/DeviceUID.m +202 -0
- package/ios/DeviceInfo/EnvironmentUtil.h +41 -0
- package/ios/DeviceInfo/EnvironmentUtil.m +56 -0
- package/ios/DeviceInfo/RNDeviceInfo.h +22 -0
- package/ios/DeviceInfo/RNDeviceInfo.m +918 -0
- package/ios/GetLocals/ShakebugSDKRNLocalize.h +21 -0
- package/ios/GetLocals/ShakebugSDKRNLocalize.m +296 -0
- package/ios/GetLocation/SettingsUtil.h +16 -0
- package/ios/GetLocation/SettingsUtil.m +21 -0
- package/ios/GetLocation/ShakebugSDKLocationModule.h +17 -0
- package/ios/GetLocation/ShakebugSDKLocationModule.m +218 -0
- package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerManager.h +40 -0
- package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerManager.m +588 -0
- package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerUtils.h +26 -0
- package/ios/ImageOrVideoPicker/ShakebugSDKImagePickerUtils.m +194 -0
- package/ios/MicrophonePermissionManager.h +14 -0
- package/ios/MicrophonePermissionManager.m +35 -0
- package/ios/NetInfo/RNCConnectionState.h +42 -0
- package/ios/NetInfo/RNCConnectionState.m +119 -0
- package/ios/NetInfo/RNCConnectionStateWatcher.h +31 -0
- package/ios/NetInfo/RNCConnectionStateWatcher.m +136 -0
- package/ios/NetInfo/RNCNetInfo.h +13 -0
- package/ios/NetInfo/RNCNetInfo.m +269 -0
- package/ios/RecordScreen/ShakebugSDKRecordScreen.h +31 -0
- package/ios/RecordScreen/ShakebugSDKRecordScreen.m +309 -0
- package/ios/ScreenShot/ShakebugSDKRNViewShot.h +6 -0
- package/ios/ScreenShot/ShakebugSDKRNViewShot.m +186 -0
- package/ios/ScreenshotDetector/ScreenShotDetector.h +12 -0
- package/ios/ScreenshotDetector/ScreenShotDetector.m +37 -0
- package/ios/Senors/RNSensorsAccelerometer.h +22 -0
- package/ios/Senors/RNSensorsAccelerometer.m +162 -0
- package/ios/Senors/RNSensorsBarometer.h +22 -0
- package/ios/Senors/RNSensorsBarometer.m +141 -0
- package/ios/Senors/RNSensorsGravity.h +22 -0
- package/ios/Senors/RNSensorsGravity.m +165 -0
- package/ios/Senors/RNSensorsGyroscope.h +22 -0
- package/ios/Senors/RNSensorsGyroscope.m +160 -0
- package/ios/Senors/RNSensorsMagnetometer.h +22 -0
- package/ios/Senors/RNSensorsMagnetometer.m +163 -0
- package/ios/Senors/RNSensorsOrientation.h +22 -0
- package/ios/Senors/RNSensorsOrientation.m +189 -0
- package/ios/Senors/RNSensorsUtils.h +7 -0
- package/ios/Senors/RNSensorsUtils.m +9 -0
- package/ios/Shakebug.h +7 -0
- package/ios/Shakebug.m +16 -0
- package/ios/Shakebug.xcodeproj/project.pbxproj +872 -0
- package/ios/Shakebug.xcodeproj/xcshareddata/xcschemes/Shakebug.xcscheme +66 -0
- package/ios/Shakebug.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/Shakebug.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/SketchCanvas/DrawingView.h +18 -0
- package/ios/SketchCanvas/DrawingView.m +96 -0
- package/ios/SketchCanvas/DrawingViewManager.h +12 -0
- package/ios/SketchCanvas/DrawingViewManager.m +35 -0
- package/ios/Storage/SharedPreferencesModule.h +13 -0
- package/ios/Storage/SharedPreferencesModule.m +35 -0
- package/ios/Thumbnaill/VideoThumbnailManager.h +12 -0
- package/ios/Thumbnaill/VideoThumbnailManager.m +73 -0
- package/ios/TrimVideo/ShakebugSDKVideoTrim.swift +372 -0
- package/ios/TrimVideo/VideoTrim-Bridging-Header.h +10 -0
- package/ios/TrimVideo/VideoTrim.m +23 -0
- package/ios/TrimVideo/VideoTrimmer.swift +810 -0
- package/ios/TrimVideo/VideoTrimmerThumb.swift +119 -0
- package/ios/TrimVideo/VideoTrimmerViewController.swift +301 -0
- package/ios/VideoPlayer/VideoPlayerModule.h +14 -0
- package/ios/VideoPlayer/VideoPlayerModule.m +29 -0
- package/ios/VideoPlayer/VideoPlayerViewController.h +18 -0
- package/ios/VideoPlayer/VideoPlayerViewController.m +29 -0
- package/package.json +45 -0
- package/shakebug-react-native.podspec +50 -0
- package/src/APIs/AddIssue.js +70 -0
- package/src/APIs/EndSession.js +32 -0
- package/src/APIs/Event.js +39 -0
- package/src/APIs/MatchKey.js +40 -0
- package/src/APIs/StartSession.js +84 -0
- package/src/Assets/images/OpenSketch.png +0 -0
- package/src/Assets/images/Push.png +0 -0
- package/src/Assets/images/RemoveTextView.png +0 -0
- package/src/Assets/images/black.png +0 -0
- package/src/Assets/images/blue.png +0 -0
- package/src/Assets/images/borderdBlack.png +0 -0
- package/src/Assets/images/borderdBlue.png +0 -0
- package/src/Assets/images/borderdGreen.png +0 -0
- package/src/Assets/images/borderdRed.png +0 -0
- package/src/Assets/images/borderdYellow.png +0 -0
- package/src/Assets/images/clear.png +0 -0
- package/src/Assets/images/close.png +0 -0
- package/src/Assets/images/green.png +0 -0
- package/src/Assets/images/next.png +0 -0
- package/src/Assets/images/play.png +0 -0
- package/src/Assets/images/red.png +0 -0
- package/src/Assets/images/shake.png +0 -0
- package/src/Assets/images/shakebugLogo.png +0 -0
- package/src/Assets/images/stopButton.png +0 -0
- package/src/Assets/images/text_icon.png +0 -0
- package/src/Assets/images/yellow.png +0 -0
- package/src/Componanats/CustomAlert.js +80 -0
- package/src/Componanats/ErrorHandler.js +80 -0
- package/src/Componanats/GlobalStateContext.js +22 -0
- package/src/Componanats/KeyboardAvoidingWrapper.js +43 -0
- package/src/Componanats/NavigationContext.js +42 -0
- package/src/Componanats/ShakeFunction.js +562 -0
- package/src/Componanats/localization.js +482 -0
- package/src/Screens/AddDetailsScreen.js +462 -0
- package/src/Screens/FirstScreen.js +629 -0
- package/src/Screens/Shakebug.js +487 -0
- package/src/Screens/StrockView.js +20 -0
- package/src/Screens/TrimVideoScreen.js +81 -0
- package/src/Screens/TutorialScreen.js +36 -0
- package/src/index.tsx +117 -0
- package/trimVideo/src/index.tsx +141 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
package com.shakebug;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.app.Application;
|
|
5
|
+
import android.content.Context;
|
|
6
|
+
import android.content.Intent;
|
|
7
|
+
import android.media.MediaCodecList;
|
|
8
|
+
import android.media.projection.MediaProjectionManager;
|
|
9
|
+
import android.os.Build;
|
|
10
|
+
import android.util.SparseIntArray;
|
|
11
|
+
import android.view.Surface;
|
|
12
|
+
|
|
13
|
+
import androidx.annotation.NonNull;
|
|
14
|
+
import androidx.appcompat.app.AppCompatActivity;
|
|
15
|
+
|
|
16
|
+
import com.facebook.react.bridge.ActivityEventListener;
|
|
17
|
+
import com.facebook.react.bridge.BaseActivityEventListener;
|
|
18
|
+
import com.facebook.react.bridge.Promise;
|
|
19
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
20
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
21
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
22
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
23
|
+
import com.facebook.react.bridge.WritableMap;
|
|
24
|
+
import com.facebook.react.bridge.WritableNativeMap;
|
|
25
|
+
import com.hbisoft.hbrecorder.HBRecorder;
|
|
26
|
+
import com.hbisoft.hbrecorder.HBRecorderListener;
|
|
27
|
+
|
|
28
|
+
import java.io.File;
|
|
29
|
+
import java.io.IOException;
|
|
30
|
+
|
|
31
|
+
public class RecordScreenModule extends ReactContextBaseJavaModule implements HBRecorderListener {
|
|
32
|
+
|
|
33
|
+
private HBRecorder hbRecorder;
|
|
34
|
+
private int screenWidth = 0;
|
|
35
|
+
private int screenHeight = 0;
|
|
36
|
+
private boolean mic = true;
|
|
37
|
+
private String currentVersion;
|
|
38
|
+
private File outputUri;
|
|
39
|
+
private Promise startPromise;
|
|
40
|
+
private Promise stopPromise;
|
|
41
|
+
|
|
42
|
+
private static final SparseIntArray ORIENTATIONS = new SparseIntArray();
|
|
43
|
+
public static final int SCREEN_RECORD_REQUEST_CODE = 1000;
|
|
44
|
+
|
|
45
|
+
static {
|
|
46
|
+
ORIENTATIONS.append(Surface.ROTATION_0, 90);
|
|
47
|
+
ORIENTATIONS.append(Surface.ROTATION_90, 0);
|
|
48
|
+
ORIENTATIONS.append(Surface.ROTATION_180, 270);
|
|
49
|
+
ORIENTATIONS.append(Surface.ROTATION_270, 180);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public RecordScreenModule(ReactApplicationContext reactContext) {
|
|
53
|
+
super(reactContext);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@NonNull
|
|
57
|
+
@Override
|
|
58
|
+
public String getName() {
|
|
59
|
+
return "ShakebugSDKRecordScreen";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private final ActivityEventListener mActivityEventListener = new BaseActivityEventListener() {
|
|
63
|
+
@Override
|
|
64
|
+
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent intent) {
|
|
65
|
+
if (requestCode == SCREEN_RECORD_REQUEST_CODE) {
|
|
66
|
+
if (resultCode == AppCompatActivity.RESULT_OK) {
|
|
67
|
+
hbRecorder.startScreenRecording(intent, resultCode);
|
|
68
|
+
} else {
|
|
69
|
+
if (startPromise != null) {
|
|
70
|
+
startPromise.resolve("permission_error");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
if (startPromise != null) {
|
|
75
|
+
startPromise.reject("404", "cancel!");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (startPromise != null) {
|
|
79
|
+
startPromise.resolve("started");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
@Override
|
|
85
|
+
public void initialize() {
|
|
86
|
+
super.initialize();
|
|
87
|
+
currentVersion = String.valueOf(Build.VERSION.SDK_INT);
|
|
88
|
+
outputUri = getReactApplicationContext().getExternalFilesDir("ReactNativeRecordScreen");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@ReactMethod
|
|
92
|
+
public void setup(ReadableMap readableMap) {
|
|
93
|
+
new Application().onCreate();
|
|
94
|
+
screenWidth = readableMap.hasKey("width") ? (int) Math.ceil(readableMap.getDouble("width")) : 0;
|
|
95
|
+
screenHeight = readableMap.hasKey("height") ? (int) Math.ceil(readableMap.getDouble("height")) : 0;
|
|
96
|
+
mic = readableMap.hasKey("mic") && readableMap.getBoolean("mic");
|
|
97
|
+
|
|
98
|
+
hbRecorder = new HBRecorder(getReactApplicationContext(), this);
|
|
99
|
+
hbRecorder.setOutputPath(outputUri.toString());
|
|
100
|
+
|
|
101
|
+
if (readableMap.hasKey("fps") || readableMap.hasKey("bitrate")) {
|
|
102
|
+
hbRecorder.enableCustomSettings();
|
|
103
|
+
|
|
104
|
+
if (readableMap.hasKey("fps")) {
|
|
105
|
+
int fps = readableMap.getInt("fps");
|
|
106
|
+
hbRecorder.setVideoFrameRate(fps);
|
|
107
|
+
}
|
|
108
|
+
if (readableMap.hasKey("bitrate")) {
|
|
109
|
+
int bitrate = readableMap.getInt("bitrate");
|
|
110
|
+
hbRecorder.setVideoBitrate(bitrate);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (doesSupportEncoder("h264")) {
|
|
115
|
+
hbRecorder.setVideoEncoder("H264");
|
|
116
|
+
} else {
|
|
117
|
+
hbRecorder.setVideoEncoder("DEFAULT");
|
|
118
|
+
}
|
|
119
|
+
hbRecorder.isAudioEnabled(mic);
|
|
120
|
+
getReactApplicationContext().addActivityEventListener(mActivityEventListener);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private void startRecordingScreen() {
|
|
124
|
+
MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getReactApplicationContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
|
|
125
|
+
Intent permissionIntent = mediaProjectionManager.createScreenCaptureIntent();
|
|
126
|
+
getCurrentActivity().startActivityForResult(permissionIntent, SCREEN_RECORD_REQUEST_CODE);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@ReactMethod
|
|
130
|
+
public void startRecording(Promise promise) {
|
|
131
|
+
startPromise = promise;
|
|
132
|
+
try {
|
|
133
|
+
startRecordingScreen();
|
|
134
|
+
System.out.println("startRecording");
|
|
135
|
+
} catch (IllegalStateException e) {
|
|
136
|
+
promise.reject("404", "error!");
|
|
137
|
+
System.out.println(e.toString());
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@ReactMethod
|
|
142
|
+
public void stopRecording(Promise promise) {
|
|
143
|
+
stopPromise = promise;
|
|
144
|
+
hbRecorder.stopScreenRecording();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@ReactMethod
|
|
148
|
+
public void clean(Promise promise) {
|
|
149
|
+
System.out.println("clean!!");
|
|
150
|
+
System.out.println(outputUri);
|
|
151
|
+
if (outputUri != null) {
|
|
152
|
+
outputUri.delete();
|
|
153
|
+
}
|
|
154
|
+
promise.resolve("cleaned");
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@Override
|
|
158
|
+
public void HBRecorderOnStart() {
|
|
159
|
+
System.out.println("HBRecorderOnStart");
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@Override
|
|
163
|
+
public void HBRecorderOnComplete() {
|
|
164
|
+
System.out.println("HBRecorderOnComplete");
|
|
165
|
+
if (stopPromise != null) {
|
|
166
|
+
String uri = hbRecorder.getFilePath();
|
|
167
|
+
WritableMap response = new WritableNativeMap();
|
|
168
|
+
WritableMap result = new WritableNativeMap();
|
|
169
|
+
result.putString("outputURL", uri);
|
|
170
|
+
response.putString("status", "success");
|
|
171
|
+
response.putMap("result", result);
|
|
172
|
+
stopPromise.resolve(response);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@Override
|
|
177
|
+
public void HBRecorderOnError(int errorCode, String reason) {
|
|
178
|
+
System.out.println("HBRecorderOnError");
|
|
179
|
+
System.out.println("errorCode: " + errorCode);
|
|
180
|
+
System.out.println("reason: " + reason);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@Override
|
|
184
|
+
public void HBRecorderOnPause() {
|
|
185
|
+
System.out.println("HBRecorderOnPause");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@Override
|
|
189
|
+
public void HBRecorderOnResume() {
|
|
190
|
+
System.out.println("HBRecorderOnResume");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private boolean doesSupportEncoder(String encoder) {
|
|
194
|
+
MediaCodecList list = new MediaCodecList(MediaCodecList.ALL_CODECS);
|
|
195
|
+
for (int i = 0; i < list.getCodecInfos().length; i++) {
|
|
196
|
+
if (list.getCodecInfos()[i].isEncoder() && list.getCodecInfos()[i].getName().contains(encoder)) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
package com.shakebug;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.database.ContentObserver;
|
|
5
|
+
import android.os.Handler;
|
|
6
|
+
import android.provider.MediaStore;
|
|
7
|
+
import androidx.annotation.NonNull;
|
|
8
|
+
|
|
9
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
12
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
13
|
+
|
|
14
|
+
public class ScreenshotDetectorModule extends ReactContextBaseJavaModule {
|
|
15
|
+
|
|
16
|
+
private final ReactApplicationContext reactContext;
|
|
17
|
+
private ContentObserver screenShotObserver;
|
|
18
|
+
|
|
19
|
+
public ScreenshotDetectorModule(ReactApplicationContext reactContext) {
|
|
20
|
+
super(reactContext);
|
|
21
|
+
this.reactContext = reactContext;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@NonNull
|
|
25
|
+
@Override
|
|
26
|
+
public String getName() {
|
|
27
|
+
return "ShakebugSDKScreenShotDetector";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ReactMethod
|
|
31
|
+
public void startObserving() {
|
|
32
|
+
if (screenShotObserver == null) {
|
|
33
|
+
screenShotObserver = new ContentObserver(new Handler()) {
|
|
34
|
+
@Override
|
|
35
|
+
public void onChange(boolean selfChange) {
|
|
36
|
+
super.onChange(selfChange);
|
|
37
|
+
sendScreenShotEvent();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
reactContext.getContentResolver().registerContentObserver(
|
|
41
|
+
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
|
42
|
+
true,
|
|
43
|
+
screenShotObserver
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@ReactMethod
|
|
49
|
+
public void stopObserving() {
|
|
50
|
+
if (screenShotObserver != null) {
|
|
51
|
+
reactContext.getContentResolver().unregisterContentObserver(screenShotObserver);
|
|
52
|
+
screenShotObserver = null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private void sendScreenShotEvent() {
|
|
57
|
+
if (reactContext.hasActiveCatalystInstance()) {
|
|
58
|
+
reactContext
|
|
59
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
60
|
+
.emit("ScreenshotTaken", null);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.shakebug;
|
|
2
|
+
|
|
3
|
+
import android.content.ComponentName;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
import android.net.Uri;
|
|
7
|
+
import android.provider.Settings;
|
|
8
|
+
|
|
9
|
+
public final class SettingsUtil {
|
|
10
|
+
|
|
11
|
+
private SettingsUtil() {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public static void openWifiSettings(final Context context) {
|
|
15
|
+
Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
|
|
16
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
17
|
+
context.startActivity(intent);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public static void openCelularSettings(final Context context) {
|
|
21
|
+
Intent intent = new Intent(Intent.ACTION_MAIN);
|
|
22
|
+
intent.setComponent(new ComponentName("com.android.settings",
|
|
23
|
+
"com.android.settings.Settings$DataUsageSummaryActivity"));
|
|
24
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
25
|
+
context.startActivity(intent);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static void openGpsSettings(final Context context) {
|
|
29
|
+
final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;
|
|
30
|
+
Intent intent = new Intent(action);
|
|
31
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
32
|
+
context.startActivity(intent);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static void openAppSettings(final Context context) {
|
|
36
|
+
Intent intent = new Intent();
|
|
37
|
+
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
38
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
39
|
+
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
|
40
|
+
intent.setData(uri);
|
|
41
|
+
context.startActivity(intent);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
package com.shakebug;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import android.hardware.Sensor;
|
|
6
|
+
import android.hardware.SensorEvent;
|
|
7
|
+
import android.hardware.SensorEventListener;
|
|
8
|
+
import android.hardware.SensorListener;
|
|
9
|
+
import android.hardware.SensorManager;
|
|
10
|
+
import android.os.SystemClock;
|
|
11
|
+
import androidx.annotation.Nullable;
|
|
12
|
+
import android.util.Log;
|
|
13
|
+
|
|
14
|
+
import com.facebook.react.bridge.Arguments;
|
|
15
|
+
import com.facebook.react.bridge.Promise;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
20
|
+
import com.facebook.react.bridge.WritableMap;
|
|
21
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
22
|
+
|
|
23
|
+
@ReactModule(name = Shakebug.NAME)
|
|
24
|
+
|
|
25
|
+
public class Shakebug extends ReactContextBaseJavaModule implements SensorEventListener {
|
|
26
|
+
public static final String NAME = "AwesomeLibrary";
|
|
27
|
+
private final ReactApplicationContext reactContext;
|
|
28
|
+
private final SensorManager sensorManager;
|
|
29
|
+
private final Sensor sensor;
|
|
30
|
+
private double lastReading = (double) System.currentTimeMillis();
|
|
31
|
+
private int interval;
|
|
32
|
+
private Arguments arguments;
|
|
33
|
+
private int logLevel = 0;
|
|
34
|
+
private String sensorName;
|
|
35
|
+
private int sensorType;
|
|
36
|
+
private float[] rotation = new float[9];
|
|
37
|
+
private float[] orientation = new float[3];
|
|
38
|
+
private float[] quaternion = new float[4];
|
|
39
|
+
|
|
40
|
+
private Boolean isBeingObserved = false;
|
|
41
|
+
public Shakebug(ReactApplicationContext reactContext, String sensorName, int sensorType) {
|
|
42
|
+
super(reactContext);
|
|
43
|
+
this.reactContext = reactContext;
|
|
44
|
+
this.sensorType = sensorType;
|
|
45
|
+
this.sensorName = sensorName;
|
|
46
|
+
this.sensorManager = (SensorManager)reactContext.getSystemService(reactContext.SENSOR_SERVICE);
|
|
47
|
+
this.sensor = this.sensorManager.getDefaultSensor(this.sensorType);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// @Override
|
|
51
|
+
// @NonNull
|
|
52
|
+
// public String getName() {
|
|
53
|
+
// return NAME;
|
|
54
|
+
// }
|
|
55
|
+
|
|
56
|
+
// RN Methods
|
|
57
|
+
@ReactMethod
|
|
58
|
+
public void isAvailable(Promise promise) {
|
|
59
|
+
if (this.sensor == null) {
|
|
60
|
+
// No sensor found, throw error
|
|
61
|
+
promise.reject(new RuntimeException("No " + this.sensorName + " found"));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
promise.resolve(null);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@ReactMethod
|
|
68
|
+
public void setUpdateInterval(int newInterval) {
|
|
69
|
+
this.interval = newInterval;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@ReactMethod
|
|
73
|
+
public void setLogLevel(int newLevel) {
|
|
74
|
+
this.logLevel = newLevel;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@ReactMethod
|
|
78
|
+
public void startUpdates() {
|
|
79
|
+
// Milliseconds to Microseconds conversion
|
|
80
|
+
sensorManager.registerListener((SensorEventListener) this, sensor, this.interval * 1000);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@ReactMethod
|
|
84
|
+
public void stopUpdates() {
|
|
85
|
+
sensorManager.unregisterListener((SensorEventListener) this);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@Override
|
|
89
|
+
public String getName() {
|
|
90
|
+
return this.sensorName;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private static double sensorTimestampToEpochMilliseconds(long elapsedTime) {
|
|
94
|
+
// elapsedTime = The time in nanoseconds at which the event happened.
|
|
95
|
+
return System.currentTimeMillis() + ((elapsedTime-SystemClock.elapsedRealtimeNanos())/1000000L);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// SensorEventListener Interface
|
|
99
|
+
private void sendEvent(String eventName, @Nullable WritableMap params) {
|
|
100
|
+
try {
|
|
101
|
+
this.reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
102
|
+
.emit(eventName, params);
|
|
103
|
+
} catch (RuntimeException e) {
|
|
104
|
+
Log.e("ERROR", "java.lang.RuntimeException: Trying to invoke Javascript before CatalystInstance has been set!");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public void onSensorChanged(SensorEvent sensorEvent) {
|
|
109
|
+
if(!isBeingObserved) {
|
|
110
|
+
return; // avoid all the computation if there are no observers
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
int currentType = sensorEvent.sensor.getType();
|
|
114
|
+
if(currentType != this.sensorType) { // not for the current Sensor
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
double tempMs = (double) System.currentTimeMillis();
|
|
119
|
+
if (tempMs - lastReading >= interval) {
|
|
120
|
+
lastReading = tempMs;
|
|
121
|
+
WritableMap map = this.arguments.createMap();
|
|
122
|
+
|
|
123
|
+
switch (currentType)
|
|
124
|
+
{
|
|
125
|
+
case Sensor.TYPE_ACCELEROMETER:
|
|
126
|
+
case Sensor.TYPE_GRAVITY:
|
|
127
|
+
case Sensor.TYPE_GYROSCOPE:
|
|
128
|
+
case Sensor.TYPE_MAGNETIC_FIELD:
|
|
129
|
+
map.putDouble("x", sensorEvent.values[0]);
|
|
130
|
+
map.putDouble("y", sensorEvent.values[1]);
|
|
131
|
+
map.putDouble("z", sensorEvent.values[2]);
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
case Sensor.TYPE_PRESSURE:
|
|
135
|
+
map.putDouble("pressure", sensorEvent.values[0]);
|
|
136
|
+
break;
|
|
137
|
+
|
|
138
|
+
case Sensor.TYPE_ROTATION_VECTOR:
|
|
139
|
+
SensorManager.getQuaternionFromVector(quaternion, sensorEvent.values);
|
|
140
|
+
SensorManager.getRotationMatrixFromVector(rotation, sensorEvent.values);
|
|
141
|
+
SensorManager.getOrientation(rotation, orientation);
|
|
142
|
+
|
|
143
|
+
map.putDouble("qw", quaternion[0]);
|
|
144
|
+
map.putDouble("qx", quaternion[1]);
|
|
145
|
+
map.putDouble("qy", quaternion[2]);
|
|
146
|
+
map.putDouble("qz", quaternion[3]);
|
|
147
|
+
|
|
148
|
+
map.putDouble("yaw", orientation[0]);
|
|
149
|
+
map.putDouble("pitch", orientation[1]);
|
|
150
|
+
map.putDouble("roll", orientation[2]);
|
|
151
|
+
break;
|
|
152
|
+
|
|
153
|
+
default:
|
|
154
|
+
Log.e("ERROR", "Sensor type '" + currentType + "' not implemented!");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// timestamp is added to all events
|
|
159
|
+
map.putDouble("timestamp", this.sensorTimestampToEpochMilliseconds(sensorEvent.timestamp));
|
|
160
|
+
this.sendEvent(this.sensorName, map);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// this is called by RN when the first listener is registered
|
|
168
|
+
// not implementing this method will cause a warning on RN 0.65 onwards
|
|
169
|
+
@ReactMethod
|
|
170
|
+
public void addListener(String eventName) {
|
|
171
|
+
isBeingObserved = true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// this is called by RN when the last listener is deregistered
|
|
175
|
+
// not implementing this method will cause a warning on RN 0.65 onwards
|
|
176
|
+
@ReactMethod
|
|
177
|
+
public void removeListeners(Integer count) {
|
|
178
|
+
isBeingObserved = false;
|
|
179
|
+
stopUpdates(); // maybe only calling `stopUpdates()` is enough
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
package com.shakebug;
|
|
2
|
+
|
|
3
|
+
import android.hardware.Sensor;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.view.WindowManager; // Add import statement for WindowManager
|
|
6
|
+
|
|
7
|
+
import com.facebook.react.ReactPackage;
|
|
8
|
+
import com.facebook.react.bridge.JavaScriptModule;
|
|
9
|
+
import com.facebook.react.bridge.NativeModule;
|
|
10
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
11
|
+
import com.facebook.react.module.model.ReactModuleInfo;
|
|
12
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
13
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
14
|
+
|
|
15
|
+
import java.util.Arrays;
|
|
16
|
+
import java.util.Collections;
|
|
17
|
+
import java.util.HashMap;
|
|
18
|
+
import java.util.List;
|
|
19
|
+
import java.util.Map;
|
|
20
|
+
public class ShakebugPackage implements ReactPackage {
|
|
21
|
+
|
|
22
|
+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
23
|
+
|
|
24
|
+
return Arrays.<NativeModule>asList(
|
|
25
|
+
new Shakebug(reactContext, "ShakebugSDKRNSensorsGyroscope", Sensor.TYPE_GYROSCOPE),
|
|
26
|
+
new Shakebug(reactContext, "ShakebugSDKRNSensorsAccelerometer", Sensor.TYPE_ACCELEROMETER),
|
|
27
|
+
new Shakebug(reactContext, "ShakebugSDKRNSensorsGravity", Sensor.TYPE_GRAVITY),
|
|
28
|
+
new Shakebug(reactContext, "ShakebugSDKRNSensorsMagnetometer", Sensor.TYPE_MAGNETIC_FIELD),
|
|
29
|
+
new Shakebug(reactContext, "ShakebugSDKRNSensorsBarometer", Sensor.TYPE_PRESSURE),
|
|
30
|
+
new Shakebug(reactContext, "ShakebugSDKRNSensorsOrientation", Sensor.TYPE_ROTATION_VECTOR),
|
|
31
|
+
new ShakebugSDKScreenShotModule(reactContext),
|
|
32
|
+
new ShakebugSDKImagePickerModule(reactContext),
|
|
33
|
+
new RecordScreenModule(reactContext),
|
|
34
|
+
new RNDeviceModule(reactContext),
|
|
35
|
+
new CrashLoggerModule(reactContext),
|
|
36
|
+
new ReactNativeGetLocationModule(reactContext),
|
|
37
|
+
new NetInfoModule(reactContext),
|
|
38
|
+
new RNLocalizeModule(reactContext),
|
|
39
|
+
new SharedPreferencesModule(reactContext),
|
|
40
|
+
new VideoPlayerModule(reactContext),
|
|
41
|
+
new VideoThumbnailModule(reactContext),
|
|
42
|
+
new VideoTrimModule(reactContext),
|
|
43
|
+
new ScreenshotDetectorModule(reactContext)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
48
|
+
return Collections.emptyList();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
52
|
+
return () -> {
|
|
53
|
+
final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
|
|
54
|
+
boolean isTurboModule = false;
|
|
55
|
+
moduleInfos.put(
|
|
56
|
+
ShakebugSDKImagePickerModuleImpl.NAME,
|
|
57
|
+
new ReactModuleInfo(
|
|
58
|
+
ShakebugSDKImagePickerModuleImpl.NAME,
|
|
59
|
+
ShakebugSDKImagePickerModuleImpl.NAME,
|
|
60
|
+
false, // canOverrideExistingModule
|
|
61
|
+
false, // needsEagerInit
|
|
62
|
+
true, // hasConstants
|
|
63
|
+
false, // isCxxModule
|
|
64
|
+
isTurboModule // isTurboModule,
|
|
65
|
+
));
|
|
66
|
+
return moduleInfos;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
71
|
+
return Arrays.<ViewManager>asList(
|
|
72
|
+
new DrawingViewManager()
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package com.shakebug;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.NativeModule;
|
|
4
|
+
import com.facebook.react.bridge.Promise;
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.react.bridge.ReactContext;
|
|
7
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
9
|
+
import com.facebook.react.bridge.Callback;
|
|
10
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
11
|
+
|
|
12
|
+
import java.util.Map;
|
|
13
|
+
import java.util.HashMap;
|
|
14
|
+
|
|
15
|
+
public class ShakebugSDKImagePickerModule extends ReactContextBaseJavaModule {
|
|
16
|
+
|
|
17
|
+
final ShakebugSDKImagePickerModuleImpl ShakebugSDKImagePickerModuleImpl;
|
|
18
|
+
|
|
19
|
+
ShakebugSDKImagePickerModule(ReactApplicationContext context) {
|
|
20
|
+
super(context);
|
|
21
|
+
ShakebugSDKImagePickerModuleImpl = new ShakebugSDKImagePickerModuleImpl(context);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
public String getName() {
|
|
26
|
+
return ShakebugSDKImagePickerModuleImpl.NAME;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@ReactMethod
|
|
30
|
+
public void launchCamera(final ReadableMap options, final Callback callback) {
|
|
31
|
+
ShakebugSDKImagePickerModuleImpl.launchCamera(options, new Callback() {
|
|
32
|
+
@Override
|
|
33
|
+
public void invoke(Object... args) {
|
|
34
|
+
if (args.length > 0 && args[0] != null) {
|
|
35
|
+
callback.invoke(args);
|
|
36
|
+
} else {
|
|
37
|
+
callback.invoke();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@ReactMethod
|
|
44
|
+
public void launchImageLibrary(final ReadableMap options, final Callback callback) {
|
|
45
|
+
ShakebugSDKImagePickerModuleImpl.launchImageLibrary(options, new Callback() {
|
|
46
|
+
@Override
|
|
47
|
+
public void invoke(Object... args) {
|
|
48
|
+
if (args.length > 0 && args[0] != null) {
|
|
49
|
+
callback.invoke(args);
|
|
50
|
+
} else {
|
|
51
|
+
callback.invoke();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|