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,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNLocalize.h
|
|
3
|
+
// Shakebug
|
|
4
|
+
//
|
|
5
|
+
// Created by ideveloper2 on 06/03/24.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
|
+
|
|
11
|
+
#import <RNLocalizeSpec/RNLocalizeSpec.h>
|
|
12
|
+
@interface ShakebugSDKRNLocalize : NSObject <NativeRNLocalizeSpec>
|
|
13
|
+
|
|
14
|
+
#else
|
|
15
|
+
|
|
16
|
+
#import <React/RCTBridgeModule.h>
|
|
17
|
+
@interface ShakebugSDKRNLocalize : NSObject <RCTBridgeModule>
|
|
18
|
+
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNLocalize.m
|
|
3
|
+
// Shakebug
|
|
4
|
+
//
|
|
5
|
+
// Created by ideveloper2 on 06/03/24.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "ShakebugSDKRNLocalize.h"
|
|
10
|
+
|
|
11
|
+
@implementation ShakebugSDKRNLocalize
|
|
12
|
+
|
|
13
|
+
RCT_EXPORT_MODULE();
|
|
14
|
+
|
|
15
|
+
// Internal
|
|
16
|
+
|
|
17
|
+
- (NSString * _Nullable)getCountryCodeForLocale:(NSLocale *)locale {
|
|
18
|
+
NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
|
|
19
|
+
|
|
20
|
+
if ([countryCode isEqualToString:@"419"])
|
|
21
|
+
return @"UN";
|
|
22
|
+
|
|
23
|
+
return countryCode != nil ? [countryCode uppercaseString] : nil;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (NSString * _Nullable)getCurrencyCodeForLocale:(NSLocale *)locale {
|
|
27
|
+
NSString *currencyCode = [locale objectForKey:NSLocaleCurrencyCode];
|
|
28
|
+
return currencyCode != nil ? [currencyCode uppercaseString] : nil;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (NSString *)getLanguageTagForLanguageCode:(NSString *)languageCode
|
|
32
|
+
scriptCode:(NSString * _Nullable)scriptCode
|
|
33
|
+
countryCode:(NSString *)countryCode {
|
|
34
|
+
NSString *languageTag = [languageCode copy];
|
|
35
|
+
|
|
36
|
+
if (scriptCode != nil)
|
|
37
|
+
languageTag = [languageTag stringByAppendingFormat:@"-%@", scriptCode];
|
|
38
|
+
|
|
39
|
+
return [languageTag stringByAppendingFormat:@"-%@", countryCode];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Implementation
|
|
43
|
+
|
|
44
|
+
- (NSString *)getCalendarImpl {
|
|
45
|
+
NSLocale *currentLocale = [NSLocale currentLocale];
|
|
46
|
+
NSString *calendar = [[currentLocale objectForKey:NSLocaleCalendar] calendarIdentifier];
|
|
47
|
+
|
|
48
|
+
if ([calendar isEqualToString:NSCalendarIdentifierGregorian])
|
|
49
|
+
return @"gregorian";
|
|
50
|
+
if ([calendar isEqualToString:NSCalendarIdentifierBuddhist])
|
|
51
|
+
return @"buddhist";
|
|
52
|
+
if ([calendar isEqualToString:NSCalendarIdentifierCoptic])
|
|
53
|
+
return @"coptic";
|
|
54
|
+
if ([calendar isEqualToString:NSCalendarIdentifierEthiopicAmeteMihret])
|
|
55
|
+
return @"ethiopic";
|
|
56
|
+
if ([calendar isEqualToString:NSCalendarIdentifierEthiopicAmeteAlem])
|
|
57
|
+
return @"ethiopic-amete-alem";
|
|
58
|
+
if ([calendar isEqualToString:NSCalendarIdentifierHebrew])
|
|
59
|
+
return @"hebrew";
|
|
60
|
+
if ([calendar isEqualToString:NSCalendarIdentifierIndian])
|
|
61
|
+
return @"indian";
|
|
62
|
+
if ([calendar isEqualToString:NSCalendarIdentifierIslamic])
|
|
63
|
+
return @"islamic";
|
|
64
|
+
if ([calendar isEqualToString:NSCalendarIdentifierIslamicUmmAlQura])
|
|
65
|
+
return @"islamic-umm-al-qura";
|
|
66
|
+
if ([calendar isEqualToString:NSCalendarIdentifierIslamicCivil])
|
|
67
|
+
return @"islamic-civil";
|
|
68
|
+
if ([calendar isEqualToString:NSCalendarIdentifierIslamicTabular])
|
|
69
|
+
return @"islamic-tabular";
|
|
70
|
+
if ([calendar isEqualToString:NSCalendarIdentifierISO8601])
|
|
71
|
+
return @"iso8601";
|
|
72
|
+
if ([calendar isEqualToString:NSCalendarIdentifierJapanese])
|
|
73
|
+
return @"japanese";
|
|
74
|
+
if ([calendar isEqualToString:NSCalendarIdentifierPersian])
|
|
75
|
+
return @"persian";
|
|
76
|
+
|
|
77
|
+
return @"gregorian";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
- (NSString *)getCountryImpl {
|
|
81
|
+
NSLocale *currentLocale = [NSLocale currentLocale];
|
|
82
|
+
NSString *currentCountryCode = [self getCountryCodeForLocale:currentLocale];
|
|
83
|
+
|
|
84
|
+
if (currentCountryCode == nil)
|
|
85
|
+
return @"US"; // Only happen in the simulator
|
|
86
|
+
|
|
87
|
+
return currentCountryCode;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (NSArray *)getCurrenciesImpl {
|
|
91
|
+
NSMutableArray<NSString *> *currencies = [NSMutableArray array];
|
|
92
|
+
NSString *currentCurrencyCode = [self getCurrencyCodeForLocale:[NSLocale currentLocale]];
|
|
93
|
+
|
|
94
|
+
if (currentCurrencyCode != nil)
|
|
95
|
+
[currencies addObject:currentCurrencyCode];
|
|
96
|
+
|
|
97
|
+
for (NSString *identifier in [NSLocale preferredLanguages]) {
|
|
98
|
+
NSLocale *systemLocale = [[NSLocale alloc] initWithLocaleIdentifier:identifier];
|
|
99
|
+
NSString *currencyCode = [self getCurrencyCodeForLocale:systemLocale];
|
|
100
|
+
|
|
101
|
+
if (currencyCode != nil && ![currencies containsObject:currencyCode])
|
|
102
|
+
[currencies addObject:currencyCode];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ([currencies count] == 0)
|
|
106
|
+
[currencies addObject:@"USD"];
|
|
107
|
+
|
|
108
|
+
return currencies;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
- (NSArray *)getLocalesImpl {
|
|
112
|
+
NSMutableArray<NSString *> *languageTags = [NSMutableArray array];
|
|
113
|
+
NSMutableArray<NSDictionary *> *locales = [NSMutableArray array];
|
|
114
|
+
|
|
115
|
+
for (NSString *identifier in [NSLocale preferredLanguages]) {
|
|
116
|
+
NSLocale *systemLocale = [[NSLocale alloc] initWithLocaleIdentifier:identifier];
|
|
117
|
+
NSString *systemLanguageCode = [systemLocale objectForKey:NSLocaleLanguageCode];
|
|
118
|
+
|
|
119
|
+
NSString *languageCode = [systemLanguageCode lowercaseString];
|
|
120
|
+
NSString *scriptCode = [systemLocale objectForKey:NSLocaleScriptCode];
|
|
121
|
+
NSString *countryCode = [self getCountryCodeForLocale:systemLocale];
|
|
122
|
+
bool isRTL = [NSLocale characterDirectionForLanguage:languageCode] == NSLocaleLanguageDirectionRightToLeft;
|
|
123
|
+
|
|
124
|
+
if (countryCode == nil)
|
|
125
|
+
countryCode = [self getCountryImpl];
|
|
126
|
+
|
|
127
|
+
NSString *languageTag = [self getLanguageTagForLanguageCode:languageCode
|
|
128
|
+
scriptCode:scriptCode
|
|
129
|
+
countryCode:countryCode];
|
|
130
|
+
|
|
131
|
+
NSMutableDictionary *locale = [[NSMutableDictionary alloc] initWithDictionary:@{
|
|
132
|
+
@"languageCode": languageCode,
|
|
133
|
+
@"countryCode": countryCode,
|
|
134
|
+
@"languageTag": languageTag,
|
|
135
|
+
@"isRTL": @(isRTL),
|
|
136
|
+
}];
|
|
137
|
+
|
|
138
|
+
if (scriptCode != nil)
|
|
139
|
+
[locale setObject:scriptCode forKey:@"scriptCode"];
|
|
140
|
+
|
|
141
|
+
if (![languageTags containsObject:languageTag]) {
|
|
142
|
+
[locales addObject:locale];
|
|
143
|
+
[languageTags addObject:languageTag];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return locales;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
- (NSDictionary *)getNumberFormatSettingsImpl {
|
|
151
|
+
NSLocale *currentLocale = [NSLocale currentLocale];
|
|
152
|
+
|
|
153
|
+
return @{
|
|
154
|
+
@"decimalSeparator": [currentLocale objectForKey:NSLocaleDecimalSeparator],
|
|
155
|
+
@"groupingSeparator": [currentLocale objectForKey:NSLocaleGroupingSeparator],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
- (NSString *)getTemperatureUnitImpl {
|
|
160
|
+
NSLocale *currentLocale = [NSLocale currentLocale];
|
|
161
|
+
NSMeasurementFormatter *formatter = [NSMeasurementFormatter new];
|
|
162
|
+
|
|
163
|
+
[formatter setLocale:currentLocale];
|
|
164
|
+
|
|
165
|
+
NSMeasurement *temperature = [[NSMeasurement alloc] initWithDoubleValue:42.0 unit:[NSUnitTemperature celsius]];
|
|
166
|
+
NSString *formatted = [formatter stringFromMeasurement:temperature];
|
|
167
|
+
NSString *unitCharacter = [formatted substringFromIndex:[formatted length] - 1];
|
|
168
|
+
|
|
169
|
+
return [unitCharacter isEqualToString:@"C"] ? @"celsius" : @"fahrenheit";
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
- (NSString *)getTimeZoneImpl {
|
|
173
|
+
return [[NSTimeZone localTimeZone] name];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (bool)uses24HourClockImpl {
|
|
177
|
+
NSLocale *currentLocale = [NSLocale currentLocale];
|
|
178
|
+
NSDateFormatter* formatter = [NSDateFormatter new];
|
|
179
|
+
|
|
180
|
+
[formatter setLocale:currentLocale];
|
|
181
|
+
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
|
|
182
|
+
[formatter setDateStyle:NSDateFormatterNoStyle];
|
|
183
|
+
[formatter setTimeStyle:NSDateFormatterShortStyle];
|
|
184
|
+
|
|
185
|
+
NSDate *date = [NSDate dateWithTimeIntervalSince1970:72000];
|
|
186
|
+
return [[formatter stringFromDate:date] containsString:@"20"];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
- (bool)usesMetricSystemImpl {
|
|
190
|
+
NSLocale *currentLocale = [NSLocale currentLocale];
|
|
191
|
+
return [[currentLocale objectForKey:NSLocaleUsesMetricSystem] boolValue];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
195
|
+
|
|
196
|
+
// New architecture
|
|
197
|
+
|
|
198
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
199
|
+
return std::make_shared<facebook::react::NativeRNLocalizeSpecJSI>(params);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
- (NSString *)getCalendar {
|
|
203
|
+
return [self getCalendarImpl];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
- (NSString *)getCountry {
|
|
207
|
+
return [self getCountryImpl];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
- (NSArray<NSString *> *)getCurrencies {
|
|
211
|
+
return [self getCurrenciesImpl];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
- (NSArray<NSDictionary *> *)getLocales {
|
|
215
|
+
return [self getLocalesImpl];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
- (NSDictionary *)getNumberFormatSettings {
|
|
219
|
+
return [self getNumberFormatSettingsImpl];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
- (NSString *)getTemperatureUnit {
|
|
223
|
+
return [self getTemperatureUnitImpl];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
- (NSString *)getTimeZone {
|
|
227
|
+
return [self getTimeZoneImpl];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
- (NSNumber *)uses24HourClock {
|
|
231
|
+
return @([self uses24HourClockImpl]);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
- (NSNumber *)usesMetricSystem {
|
|
235
|
+
return @([self usesMetricSystemImpl]);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
- (NSNumber * _Nullable)usesAutoDateAndTime {
|
|
239
|
+
return nil;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
- (NSNumber * _Nullable)usesAutoTimeZone {
|
|
243
|
+
return nil;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
#else
|
|
247
|
+
|
|
248
|
+
// Old architecture
|
|
249
|
+
|
|
250
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getCalendar) {
|
|
251
|
+
return [self getCalendarImpl];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getCountry) {
|
|
255
|
+
return [self getCountryImpl];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getCurrencies) {
|
|
259
|
+
return [self getCurrenciesImpl];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getLocales) {
|
|
263
|
+
return [self getLocalesImpl];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getNumberFormatSettings) {
|
|
267
|
+
return [self getNumberFormatSettingsImpl];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getTemperatureUnit) {
|
|
271
|
+
return [self getTemperatureUnitImpl];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getTimeZone) {
|
|
275
|
+
return [self getTimeZoneImpl];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(uses24HourClock) {
|
|
279
|
+
return @([self uses24HourClockImpl]);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(usesMetricSystem) {
|
|
283
|
+
return @([self usesMetricSystemImpl]);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(usesAutoDateAndTime) {
|
|
287
|
+
return nil;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(usesAutoTimeZone) {
|
|
291
|
+
return nil;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
#endif
|
|
295
|
+
|
|
296
|
+
@end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SettingsUtil.h
|
|
3
|
+
// Shakebug
|
|
4
|
+
//
|
|
5
|
+
// Created by ideveloper2 on 06/03/24.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <UIKit/UIKit.h>
|
|
11
|
+
|
|
12
|
+
@interface SettingsUtil : NSObject
|
|
13
|
+
|
|
14
|
+
+ (void) openAppSettings;
|
|
15
|
+
|
|
16
|
+
@end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SettingsUtil.m
|
|
3
|
+
// Shakebug
|
|
4
|
+
//
|
|
5
|
+
// Created by ideveloper2 on 06/03/24.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "SettingsUtil.h"
|
|
10
|
+
|
|
11
|
+
@implementation SettingsUtil
|
|
12
|
+
|
|
13
|
+
+ (void) openAppSettings {
|
|
14
|
+
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 10.0) {
|
|
15
|
+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
|
|
16
|
+
} else {
|
|
17
|
+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LocationModule.h
|
|
3
|
+
// Shakebug
|
|
4
|
+
//
|
|
5
|
+
// Created by ideveloper2 on 06/03/24.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
#import <React/RCTBridgeModule.h>
|
|
11
|
+
#import <React/RCTConvert.h>
|
|
12
|
+
#import <CoreLocation/CoreLocation.h>
|
|
13
|
+
#import "SettingsUtil.h"
|
|
14
|
+
|
|
15
|
+
@interface ShakebugSDKLocationModule : NSObject <RCTBridgeModule, CLLocationManagerDelegate>
|
|
16
|
+
|
|
17
|
+
@end
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LocationModule.m
|
|
3
|
+
// Shakebug
|
|
4
|
+
//
|
|
5
|
+
// Created by ideveloper2 on 06/03/24.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
#import "ShakebugSDKLocationModule.h"
|
|
11
|
+
#import <React/RCTLog.h>
|
|
12
|
+
|
|
13
|
+
@implementation ShakebugSDKLocationModule
|
|
14
|
+
|
|
15
|
+
RCT_EXPORT_MODULE(ShakebugSDKReactNativeGetLocation);
|
|
16
|
+
|
|
17
|
+
NSTimer* mTimer;
|
|
18
|
+
CLLocationManager* mLocationManager;
|
|
19
|
+
RCTPromiseResolveBlock mResolve;
|
|
20
|
+
RCTPromiseRejectBlock mReject;
|
|
21
|
+
double mTimeout;
|
|
22
|
+
|
|
23
|
+
RCT_EXPORT_METHOD(getCurrentPosition: (NSDictionary*) options
|
|
24
|
+
promise: (RCTPromiseResolveBlock) resolve
|
|
25
|
+
rejecter: (RCTPromiseRejectBlock) reject) {
|
|
26
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
27
|
+
@try {
|
|
28
|
+
[self cancelPreviousRequest];
|
|
29
|
+
|
|
30
|
+
if (@available(iOS 14.0, *)) {
|
|
31
|
+
// should use locationManagerDidChangeAuthorization
|
|
32
|
+
} else {
|
|
33
|
+
if (![CLLocationManager locationServicesEnabled]) {
|
|
34
|
+
[[NSException
|
|
35
|
+
exceptionWithName:@"Unavailable"
|
|
36
|
+
reason:@"Location service is unavailable"
|
|
37
|
+
userInfo:nil]
|
|
38
|
+
raise];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
bool enableHighAccuracy = [RCTConvert BOOL:options[@"enableHighAccuracy"]];
|
|
43
|
+
double timeout = [RCTConvert double:options[@"timeout"]];
|
|
44
|
+
|
|
45
|
+
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
|
|
46
|
+
locationManager.delegate = self;
|
|
47
|
+
locationManager.distanceFilter = kCLDistanceFilterNone;
|
|
48
|
+
locationManager.desiredAccuracy = enableHighAccuracy ? kCLLocationAccuracyBest : kCLLocationAccuracyNearestTenMeters;
|
|
49
|
+
|
|
50
|
+
mResolve = resolve;
|
|
51
|
+
mReject = reject;
|
|
52
|
+
mLocationManager = locationManager;
|
|
53
|
+
mTimeout = timeout;
|
|
54
|
+
|
|
55
|
+
[self startUpdatingLocation];
|
|
56
|
+
}
|
|
57
|
+
@catch (NSException *exception) {
|
|
58
|
+
NSMutableDictionary * info = [NSMutableDictionary dictionary];
|
|
59
|
+
[info setValue:exception.name forKey:@"ExceptionName"];
|
|
60
|
+
[info setValue:exception.reason forKey:@"ExceptionReason"];
|
|
61
|
+
[info setValue:exception.callStackReturnAddresses forKey:@"ExceptionCallStackReturnAddresses"];
|
|
62
|
+
[info setValue:exception.callStackSymbols forKey:@"ExceptionCallStackSymbols"];
|
|
63
|
+
[info setValue:exception.userInfo forKey:@"ExceptionUserInfo"];
|
|
64
|
+
|
|
65
|
+
NSError *error = [[NSError alloc] initWithDomain:@"Location not available." code:1 userInfo:info];
|
|
66
|
+
reject(@"UNAVAILABLE", @"Location not available", error);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
RCT_EXPORT_METHOD(openAppSettings: (RCTPromiseResolveBlock)resolve
|
|
72
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
73
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
74
|
+
@try {
|
|
75
|
+
[SettingsUtil openAppSettings];
|
|
76
|
+
resolve(nil);
|
|
77
|
+
}
|
|
78
|
+
@catch (NSException *exception) {
|
|
79
|
+
NSMutableDictionary * info = [NSMutableDictionary dictionary];
|
|
80
|
+
[info setValue:exception.name forKey:@"ExceptionName"];
|
|
81
|
+
[info setValue:exception.reason forKey:@"ExceptionReason"];
|
|
82
|
+
[info setValue:exception.callStackReturnAddresses forKey:@"ExceptionCallStackReturnAddresses"];
|
|
83
|
+
[info setValue:exception.callStackSymbols forKey:@"ExceptionCallStackSymbols"];
|
|
84
|
+
[info setValue:exception.userInfo forKey:@"ExceptionUserInfo"];
|
|
85
|
+
|
|
86
|
+
NSError *error = [[NSError alloc] initWithDomain:@"openAppSettings" code:0 userInfo:info];
|
|
87
|
+
reject(@"openAppSettings", @"Could not open settings.", error);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
- (void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations {
|
|
93
|
+
if (locations.count > 0 && mResolve != nil) {
|
|
94
|
+
CLLocation* location = locations[0];
|
|
95
|
+
|
|
96
|
+
NSDictionary* locationResult = @{
|
|
97
|
+
@"latitude": @(location.coordinate.latitude),
|
|
98
|
+
@"longitude": @(location.coordinate.longitude),
|
|
99
|
+
@"altitude": @(location.altitude),
|
|
100
|
+
@"speed": @(location.speed),
|
|
101
|
+
@"accuracy": @(location.horizontalAccuracy),
|
|
102
|
+
@"time": @(location.timestamp.timeIntervalSince1970 * 1000),
|
|
103
|
+
@"verticalAccuracy": @(location.verticalAccuracy),
|
|
104
|
+
@"course": @(location.course),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
mResolve(locationResult);
|
|
108
|
+
}
|
|
109
|
+
[self clearReferences];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
- (void) locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
|
|
113
|
+
if (mReject != nil) {
|
|
114
|
+
mReject(@"UNAVAILABLE", @"Location not available", error);
|
|
115
|
+
}
|
|
116
|
+
[self clearReferences];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
- (void) runTimeout:(id)sender {
|
|
120
|
+
if (mReject != nil) {
|
|
121
|
+
mReject(@"TIMEOUT", @"Location timed out", nil);
|
|
122
|
+
}
|
|
123
|
+
[self clearReferences];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
|
|
127
|
+
if ([self isAuthorized]) {
|
|
128
|
+
[self startUpdatingLocation];
|
|
129
|
+
} else if ([self isAuthorizationDenied]) {
|
|
130
|
+
mReject(@"UNAUTHORIZED", @"Authorization denied", nil);
|
|
131
|
+
[self clearReferences];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
- (void) clearReferences {
|
|
136
|
+
if (mTimer != nil) {
|
|
137
|
+
[mTimer invalidate];
|
|
138
|
+
}
|
|
139
|
+
if (mLocationManager != nil) {
|
|
140
|
+
[mLocationManager stopUpdatingLocation];
|
|
141
|
+
}
|
|
142
|
+
mResolve = nil;
|
|
143
|
+
mReject = nil;
|
|
144
|
+
mLocationManager = nil;
|
|
145
|
+
mTimer = nil;
|
|
146
|
+
mTimeout = 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (void) cancelPreviousRequest {
|
|
150
|
+
if (mLocationManager != nil) {
|
|
151
|
+
mReject(@"CANCELLED", @"Location cancelled by another request", nil);
|
|
152
|
+
}
|
|
153
|
+
[self clearReferences];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
- (void) startUpdatingLocation {
|
|
157
|
+
if (![self isAuthorized]) {
|
|
158
|
+
NSLog(@"[locationManager requestWhenInUseAuthorization]");
|
|
159
|
+
// [mLocationManager requestWhenInUseAuthorization];
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
NSLog(@"[locationManager startUpdatingLocation]");
|
|
164
|
+
[mLocationManager startUpdatingLocation];
|
|
165
|
+
|
|
166
|
+
if (mTimeout > 0) {
|
|
167
|
+
NSTimeInterval timeoutInterval = mTimeout / 1000.0;
|
|
168
|
+
mTimer = [NSTimer scheduledTimerWithTimeInterval:timeoutInterval
|
|
169
|
+
target:self
|
|
170
|
+
selector:@selector(runTimeout:)
|
|
171
|
+
userInfo:nil
|
|
172
|
+
repeats:NO];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager {
|
|
177
|
+
if (@available(iOS 14.0, *)) {
|
|
178
|
+
if (![CLLocationManager locationServicesEnabled]) {
|
|
179
|
+
mReject(@"UNAVAILABLE", @"Location not available", nil);
|
|
180
|
+
[self clearReferences];
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
switch ([manager authorizationStatus]) {
|
|
185
|
+
case kCLAuthorizationStatusAuthorizedAlways:
|
|
186
|
+
case kCLAuthorizationStatusAuthorizedWhenInUse: {
|
|
187
|
+
[self startUpdatingLocation];
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case kCLAuthorizationStatusNotDetermined: {
|
|
191
|
+
// do nothing
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
case kCLAuthorizationStatusDenied:
|
|
195
|
+
case kCLAuthorizationStatusRestricted:
|
|
196
|
+
default: {
|
|
197
|
+
mReject(@"UNAUTHORIZED", @"Authorization denied", nil);
|
|
198
|
+
[self clearReferences];
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
- (BOOL) isAuthorizationDenied {
|
|
206
|
+
int authorizationStatus = [CLLocationManager authorizationStatus];
|
|
207
|
+
|
|
208
|
+
return authorizationStatus == kCLAuthorizationStatusDenied;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
- (BOOL) isAuthorized {
|
|
212
|
+
int authorizationStatus = [CLLocationManager authorizationStatus];
|
|
213
|
+
|
|
214
|
+
return authorizationStatus == kCLAuthorizationStatusAuthorizedWhenInUse
|
|
215
|
+
|| authorizationStatus == kCLAuthorizationStatusAuthorizedAlways;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
#import <React/RCTConvert.h>
|
|
4
|
+
|
|
5
|
+
typedef NS_ENUM(NSInteger, RNImagePickerTarget) {
|
|
6
|
+
camera = 1,
|
|
7
|
+
library
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
@implementation RCTConvert(PresentationStyle)
|
|
11
|
+
|
|
12
|
+
// see: https://developer.apple.com/documentation/uikit/uimodalpresentationstyle?language=objc
|
|
13
|
+
RCT_ENUM_CONVERTER(
|
|
14
|
+
UIModalPresentationStyle,
|
|
15
|
+
(@{
|
|
16
|
+
@"currentContext": @(UIModalPresentationCurrentContext),
|
|
17
|
+
@"fullScreen": @(UIModalPresentationFullScreen),
|
|
18
|
+
@"pageSheet": @(UIModalPresentationPageSheet),
|
|
19
|
+
@"formSheet": @(UIModalPresentationFormSheet),
|
|
20
|
+
@"popover": @(UIModalPresentationPopover),
|
|
21
|
+
@"overFullScreen": @(UIModalPresentationOverFullScreen),
|
|
22
|
+
@"overCurrentContext": @(UIModalPresentationOverCurrentContext)
|
|
23
|
+
}),
|
|
24
|
+
UIModalPresentationCurrentContext,
|
|
25
|
+
integerValue)
|
|
26
|
+
|
|
27
|
+
@end
|
|
28
|
+
|
|
29
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
30
|
+
|
|
31
|
+
#import "RNImagePickerSpec.h"
|
|
32
|
+
@interface ShakebugSDKImagePickerManager : NSObject <NativeImagePickerSpec>
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
#else
|
|
36
|
+
|
|
37
|
+
@interface ShakebugSDKImagePickerManager : NSObject <RCTBridgeModule>
|
|
38
|
+
@end
|
|
39
|
+
|
|
40
|
+
#endif
|