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,59 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
3
|
+
import type { AsyncHookResult } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* simple hook wrapper for async functions for 'on-mount / componentDidMount' that only need to fired once
|
|
7
|
+
* @param asyncGetter async function that 'gets' something
|
|
8
|
+
* @param initialResult -1 | false | 'unknown'
|
|
9
|
+
*/
|
|
10
|
+
export function useOnMount<T>(asyncGetter: () => Promise<T>, initialResult: T): AsyncHookResult<T> {
|
|
11
|
+
const [response, setResponse] = useState<AsyncHookResult<T>>({
|
|
12
|
+
loading: true,
|
|
13
|
+
result: initialResult,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
// async function cuz react complains if useEffect's effect param is an async function
|
|
18
|
+
const getAsync = async () => {
|
|
19
|
+
const result = await asyncGetter();
|
|
20
|
+
setResponse({ loading: false, result });
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
getAsync();
|
|
24
|
+
}, [asyncGetter]);
|
|
25
|
+
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const deviceInfoEmitter = new NativeEventEmitter(NativeModules.ShakebugSDKRNDeviceInfo);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* simple hook wrapper for handling events
|
|
33
|
+
* @param eventName
|
|
34
|
+
* @param initialValueAsyncGetter
|
|
35
|
+
* @param defaultValue
|
|
36
|
+
*/
|
|
37
|
+
export function useOnEvent<T>(
|
|
38
|
+
eventName: string,
|
|
39
|
+
initialValueAsyncGetter: () => Promise<T>,
|
|
40
|
+
defaultValue: T
|
|
41
|
+
): AsyncHookResult<T> {
|
|
42
|
+
const { loading, result: initialResult } = useOnMount(initialValueAsyncGetter, defaultValue);
|
|
43
|
+
const [result, setResult] = useState<T>(defaultValue);
|
|
44
|
+
|
|
45
|
+
// sets the result to what the intial value is on mount
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setResult(initialResult);
|
|
48
|
+
}, [initialResult]);
|
|
49
|
+
|
|
50
|
+
// - set up the event listener to set the result
|
|
51
|
+
// - set up the clean up function to remove subscription on unmount
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const subscription = deviceInfoEmitter.addListener(eventName, setResult);
|
|
54
|
+
return () => subscription.remove();
|
|
55
|
+
}, [eventName]);
|
|
56
|
+
|
|
57
|
+
// loading will only be true while getting the inital value. After that, it will always be false, but a new result may occur
|
|
58
|
+
return useMemo(() => ({ loading, result }), [loading, result]);
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NotchDevice } from './privateTypes';
|
|
2
|
+
|
|
3
|
+
const devicesWithDynamicIsland: NotchDevice[] = [
|
|
4
|
+
{
|
|
5
|
+
brand: 'Apple',
|
|
6
|
+
model: 'iPhone 15',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
brand: 'Apple',
|
|
10
|
+
model: 'iPhone 15 Plus',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
brand: 'Apple',
|
|
14
|
+
model: 'iPhone 15 Pro',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
brand: 'Apple',
|
|
18
|
+
model: 'iPhone 15 Pro Max',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
brand: 'Apple',
|
|
22
|
+
model: 'iPhone 14 Pro',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
brand: 'Apple',
|
|
26
|
+
model: 'iPhone 14 Pro Max',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export default devicesWithDynamicIsland;
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { NotchDevice } from './privateTypes';
|
|
2
|
+
|
|
3
|
+
const devicesWithNotch: NotchDevice[] = [
|
|
4
|
+
{
|
|
5
|
+
brand: 'Apple',
|
|
6
|
+
model: 'iPhone 15',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
brand: 'Apple',
|
|
10
|
+
model: 'iPhone 15 Plus',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
brand: 'Apple',
|
|
14
|
+
model: 'iPhone 15 Pro',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
brand: 'Apple',
|
|
18
|
+
model: 'iPhone 15 Pro Max',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
brand: 'Apple',
|
|
22
|
+
model: 'iPhone 14',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
brand: 'Apple',
|
|
26
|
+
model: 'iPhone 14 Plus',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
brand: 'Apple',
|
|
30
|
+
model: 'iPhone 14 Pro',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
brand: 'Apple',
|
|
34
|
+
model: 'iPhone 14 Pro Max',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
brand: 'Apple',
|
|
38
|
+
model: 'iPhone 13 mini',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
brand: 'Apple',
|
|
42
|
+
model: 'iPhone 13',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
brand: 'Apple',
|
|
46
|
+
model: 'iPhone 13 Pro',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
brand: 'Apple',
|
|
50
|
+
model: 'iPhone 13 Pro Max',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
brand: 'Apple',
|
|
54
|
+
model: 'iPhone 12 mini',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
brand: 'Apple',
|
|
58
|
+
model: 'iPhone 12',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
brand: 'Apple',
|
|
62
|
+
model: 'iPhone 12 Pro',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
brand: 'Apple',
|
|
66
|
+
model: 'iPhone 12 Pro Max',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
brand: 'Apple',
|
|
70
|
+
model: 'iPhone 11',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
brand: 'Apple',
|
|
74
|
+
model: 'iPhone 11 Pro',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
brand: 'Apple',
|
|
78
|
+
model: 'iPhone 11 Pro Max',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
brand: 'Apple',
|
|
82
|
+
model: 'iPhone X',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
brand: 'Apple',
|
|
86
|
+
model: 'iPhone XS',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
brand: 'Apple',
|
|
90
|
+
model: 'iPhone XS Max',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
brand: 'Apple',
|
|
94
|
+
model: 'iPhone XR',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
brand: 'Asus',
|
|
98
|
+
model: 'ZenFone 5',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
brand: 'Asus',
|
|
102
|
+
model: 'ZenFone 5z',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
brand: 'google',
|
|
106
|
+
model: 'Pixel 3 XL',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
brand: 'google',
|
|
110
|
+
model: 'Pixel 4a',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
brand: 'Huawei',
|
|
114
|
+
model: 'P20',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
brand: 'Huawei',
|
|
118
|
+
model: 'P20 Plus',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
brand: 'Huawei',
|
|
122
|
+
model: 'P20 Lite',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
brand: 'Huawei',
|
|
126
|
+
model: 'ANE-LX1',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
brand: 'Huawei',
|
|
130
|
+
model: 'INE-LX1',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
brand: 'Huawei',
|
|
134
|
+
model: 'POT-LX1',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
brand: 'Huawei',
|
|
138
|
+
model: 'Honor Play',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
brand: 'Huawei',
|
|
142
|
+
model: 'Honor 10',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
brand: 'Huawei',
|
|
146
|
+
model: 'Mate 20 Lite',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
brand: 'Huawei',
|
|
150
|
+
model: 'Mate 20 Pro',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
brand: 'Huawei',
|
|
154
|
+
model: 'ELE-L29', // P30
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
brand: 'Huawei',
|
|
158
|
+
model: 'P30 Lite',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
brand: 'Huawei',
|
|
162
|
+
model: 'P30 Pro',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
brand: 'Huawei',
|
|
166
|
+
model: 'JNY-LX1', // P40 Lite
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
brand: 'Huawei',
|
|
170
|
+
model: 'Nova 3',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
brand: 'Huawei',
|
|
174
|
+
model: 'Nova 3i',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
brand: 'Leagoo',
|
|
178
|
+
model: 'S9',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
brand: 'LG',
|
|
182
|
+
model: 'G7',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
brand: 'LG',
|
|
186
|
+
model: 'G7 ThinQ',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
brand: 'LG',
|
|
190
|
+
model: 'G7+ ThinQ',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
brand: 'LG',
|
|
194
|
+
model: 'LM-Q910', //G7 One
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
brand: 'LG',
|
|
198
|
+
model: 'LM-G710', //G7 ThinQ
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
brand: 'LG',
|
|
202
|
+
model: 'LM-V405', //V40 ThinQ
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
brand: 'Motorola',
|
|
206
|
+
model: 'Moto g7 Play',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
brand: 'Motorola',
|
|
210
|
+
model: 'Moto g7 Power',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
brand: 'Motorola',
|
|
214
|
+
model: 'One',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
brand: 'Motorola',
|
|
218
|
+
model: 'Motorola One Vision',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
brand: 'Nokia',
|
|
222
|
+
model: '5.1 Plus',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
brand: 'Nokia',
|
|
226
|
+
model: 'Nokia 6.1 Plus',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
brand: 'Nokia',
|
|
230
|
+
model: '7.1',
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
brand: 'Nokia',
|
|
234
|
+
model: '8.1',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
brand: 'OnePlus',
|
|
238
|
+
model: '6',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
brand: 'OnePlus',
|
|
242
|
+
model: 'A6003',
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
brand: 'ONEPLUS',
|
|
246
|
+
model: 'A6000',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
brand: 'OnePlus',
|
|
250
|
+
model: 'OnePlus A6003',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
brand: 'OnePlus',
|
|
254
|
+
model: 'ONEPLUS A6010',
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
brand: 'OnePlus',
|
|
258
|
+
model: 'ONEPLUS A6013',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
brand: 'OnePlus',
|
|
262
|
+
model: 'ONEPLUS A6000',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
brand: 'Oppo',
|
|
266
|
+
model: 'R15',
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
brand: 'Oppo',
|
|
270
|
+
model: 'R15 Pro',
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
brand: 'Oppo',
|
|
274
|
+
model: 'F7',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
brand: 'Oukitel',
|
|
278
|
+
model: 'U18',
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
brand: 'Redmi',
|
|
282
|
+
model: 'M2004J19C',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
brand: 'Sharp',
|
|
286
|
+
model: 'Aquos S3',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
brand: 'Vivo',
|
|
290
|
+
model: 'V9',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
brand: 'Vivo',
|
|
294
|
+
model: 'X21',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
brand: 'Vivo',
|
|
298
|
+
model: 'X21 UD',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
brand: 'xiaomi',
|
|
302
|
+
model: 'MI 8',
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
brand: 'xiaomi',
|
|
306
|
+
model: 'MI 8 Explorer Edition',
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
brand: 'xiaomi',
|
|
310
|
+
model: 'MI 8 SE',
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
brand: 'xiaomi',
|
|
314
|
+
model: 'MI 8 UD',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
brand: 'xiaomi',
|
|
318
|
+
model: 'MI 8 Lite',
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
brand: 'xiaomi',
|
|
322
|
+
model: 'Mi 9',
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
brand: 'xiaomi',
|
|
326
|
+
model: 'POCO F1',
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
brand: 'xiaomi',
|
|
330
|
+
model: 'POCOPHONE F1',
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
brand: 'xiaomi',
|
|
334
|
+
model: 'Redmi 6 Pro',
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
brand: 'xiaomi',
|
|
338
|
+
model: 'Redmi Note 7',
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
brand: 'xiaomi',
|
|
342
|
+
model: 'Redmi 7',
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
brand: 'xiaomi',
|
|
346
|
+
model: 'Redmi Note 8',
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
brand: 'xiaomi',
|
|
350
|
+
model: 'Redmi Note 8 Pro',
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
brand: 'xiaomi',
|
|
354
|
+
model: 'Mi A2 Lite',
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
brand: 'Blackview',
|
|
358
|
+
model: 'A30',
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
brand: 'Samsung',
|
|
362
|
+
model: 'SM-A202F',
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
brand: 'Samsung',
|
|
366
|
+
model: 'SM-A217F',
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
brand: 'Samsung',
|
|
370
|
+
model: 'SM-A715F',
|
|
371
|
+
},
|
|
372
|
+
];
|
|
373
|
+
|
|
374
|
+
export default devicesWithNotch;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Platform, NativeModules } from 'react-native';
|
|
2
|
+
import { DeviceInfoNativeModule } from './privateTypes';
|
|
3
|
+
|
|
4
|
+
let RNDeviceInfo: DeviceInfoNativeModule | undefined = NativeModules.ShakebugSDKRNDeviceInfo;
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
if (Platform.OS === 'web' || Platform.OS === 'dom') {
|
|
8
|
+
RNDeviceInfo = require('../web');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!RNDeviceInfo) {
|
|
12
|
+
// Produce an error if we don't have the native module
|
|
13
|
+
if (
|
|
14
|
+
Platform.OS === 'android' ||
|
|
15
|
+
Platform.OS === 'ios' ||
|
|
16
|
+
Platform.OS === 'web' ||
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
Platform.OS === 'dom'
|
|
19
|
+
) {
|
|
20
|
+
throw new Error(`react-native-device-info: NativeModule.RNDeviceInfo is null. To fix this issue try these steps:
|
|
21
|
+
• For react-native <= 0.59: Run \`react-native link react-native-device-info\` in the project root.
|
|
22
|
+
• Rebuild and re-run the app.
|
|
23
|
+
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
|
|
24
|
+
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-device-info/react-native-device-info`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default RNDeviceInfo as DeviceInfoNativeModule;
|