@sentry/react-native 8.4.0 → 8.6.0
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/RNSentry.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/expo-handler/build.gradle +20 -0
- package/android/expo-handler/src/main/java/io/sentry/react/expo/SentryExpoPackage.java +22 -0
- package/android/expo-handler/src/main/java/io/sentry/react/expo/SentryReactNativeHostHandler.java +48 -0
- package/android/expo-stubs/README.md +7 -0
- package/android/expo-stubs/build.gradle +23 -0
- package/android/expo-stubs/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/expo-stubs/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/expo-stubs/gradlew +251 -0
- package/android/expo-stubs/gradlew.bat +94 -0
- package/android/expo-stubs/settings.gradle +1 -0
- package/android/expo-stubs/src/main/java/expo/modules/core/interfaces/Package.java +11 -0
- package/android/expo-stubs/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +7 -0
- package/android/libs/expo-stubs.jar +0 -0
- package/android/libs/replay-stubs.jar +0 -0
- package/android/replay-stubs/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +71 -15
- package/android/src/main/java/io/sentry/react/RNSentryStart.java +3 -0
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +10 -0
- package/dist/js/NativeLogListener.js.map +1 -1
- package/dist/js/NativeRNSentry.d.ts +2 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/RNSentryReplayMaskNativeComponent.d.ts.map +1 -1
- package/dist/js/RNSentryReplayUnmaskNativeComponent.d.ts.map +1 -1
- package/dist/js/breadcrumb.js.map +1 -1
- package/dist/js/client.js.map +1 -1
- package/dist/js/feedback/FeedbackButton.js.map +1 -1
- package/dist/js/feedback/FeedbackWidget.js +6 -6
- package/dist/js/feedback/FeedbackWidget.js.map +1 -1
- package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidgetManager.d.ts +3 -1
- package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidgetManager.js +15 -1
- package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
- package/dist/js/feedback/FeedbackWidgetProvider.d.ts +3 -2
- package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidgetProvider.js +12 -4
- package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -1
- package/dist/js/feedback/ScreenshotButton.d.ts +1 -1
- package/dist/js/feedback/ScreenshotButton.js.map +1 -1
- package/dist/js/feedback/ShakeToReportBug.d.ts +27 -0
- package/dist/js/feedback/ShakeToReportBug.d.ts.map +1 -0
- package/dist/js/feedback/ShakeToReportBug.js +83 -0
- package/dist/js/feedback/ShakeToReportBug.js.map +1 -0
- package/dist/js/feedback/defaults.js.map +1 -1
- package/dist/js/feedback/integration.d.ts +13 -2
- package/dist/js/feedback/integration.d.ts.map +1 -1
- package/dist/js/feedback/integration.js +7 -1
- package/dist/js/feedback/integration.js.map +1 -1
- package/dist/js/feedback/lazy.js.map +1 -1
- package/dist/js/feedback/utils.d.ts.map +1 -1
- package/dist/js/feedback/utils.js.map +1 -1
- package/dist/js/index.d.ts +1 -1
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/appRegistry.d.ts.map +1 -1
- package/dist/js/integrations/appRegistry.js.map +1 -1
- package/dist/js/integrations/breadcrumbs.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +6 -4
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +3 -2
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.js +1 -1
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/expoconstants.js.map +1 -1
- package/dist/js/integrations/expocontext.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +1 -0
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +1 -0
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/expoupdateslistener.d.ts +38 -0
- package/dist/js/integrations/expoupdateslistener.d.ts.map +1 -0
- package/dist/js/integrations/expoupdateslistener.js +130 -0
- package/dist/js/integrations/expoupdateslistener.js.map +1 -0
- package/dist/js/integrations/logEnricherIntegration.js +1 -1
- package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js +1 -0
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/integrations/primitiveTagIntegration.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/integrations/release.js +1 -1
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/rewriteframes.js.map +1 -1
- package/dist/js/integrations/screenshot.js +1 -1
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.js +1 -1
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/misc.js +2 -2
- package/dist/js/misc.js.map +1 -1
- package/dist/js/options.d.ts +13 -1
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/playground/examples.js.map +1 -1
- package/dist/js/playground/modal.d.ts +2 -2
- package/dist/js/playground/modal.d.ts.map +1 -1
- package/dist/js/playground/modal.js +6 -6
- package/dist/js/playground/modal.js.map +1 -1
- package/dist/js/profiling/cache.js.map +1 -1
- package/dist/js/profiling/convertHermesProfile.js.map +1 -1
- package/dist/js/profiling/debugid.js.map +1 -1
- package/dist/js/profiling/integration.d.ts.map +1 -1
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/profiling/utils.js.map +1 -1
- package/dist/js/replay/CustomMask.d.ts.map +1 -1
- package/dist/js/replay/CustomMask.js.map +1 -1
- package/dist/js/replay/CustomMask.web.d.ts.map +1 -1
- package/dist/js/replay/browserReplay.d.ts.map +1 -1
- package/dist/js/replay/browserReplay.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +21 -2
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/replay/networkUtils.d.ts +0 -1
- package/dist/js/replay/networkUtils.d.ts.map +1 -1
- package/dist/js/replay/networkUtils.js.map +1 -1
- package/dist/js/replay/xhrUtils.js.map +1 -1
- package/dist/js/scopeSync.js.map +1 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +4 -2
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/ModulesCollector.js.map +1 -1
- package/dist/js/tools/easBuildHooks.js +13 -14
- package/dist/js/tools/easBuildHooks.js.map +1 -1
- package/dist/js/tools/enableLogger.js +1 -2
- package/dist/js/tools/enableLogger.js.map +1 -1
- package/dist/js/tools/metroMiddleware.d.ts.map +1 -1
- package/dist/js/tools/metroMiddleware.js.map +1 -1
- package/dist/js/tools/metroconfig.js +6 -7
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js +7 -7
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +2 -2
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tools/sentryOptionsSerializer.js +1 -2
- package/dist/js/tools/sentryOptionsSerializer.js.map +1 -1
- package/dist/js/tools/sentryReleaseInjector.d.ts +1 -1
- package/dist/js/tools/sentryReleaseInjector.d.ts.map +1 -1
- package/dist/js/tools/sentryReleaseInjector.js.map +1 -1
- package/dist/js/tools/utils.d.ts.map +1 -1
- package/dist/js/tools/utils.js +9 -10
- package/dist/js/tools/utils.js.map +1 -1
- package/dist/js/tools/vendor/metro/countLines.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.js.map +1 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +2 -0
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/expoAsset.js.map +1 -1
- package/dist/js/tracing/expoImage.js.map +1 -1
- package/dist/js/tracing/expoRouter.js.map +1 -1
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts +9 -1
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +61 -12
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.js +35 -22
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
- package/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
- package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
- package/dist/js/tracing/integrations/stalltracking.js +4 -1
- package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js +15 -14
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.js +20 -13
- package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js +1 -1
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +3 -0
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +7 -3
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/span.d.ts +2 -17
- package/dist/js/tracing/span.d.ts.map +1 -1
- package/dist/js/tracing/span.js.map +1 -1
- package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplaynative.js.map +1 -1
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/transports/encodePolyfill.d.ts +1 -1
- package/dist/js/transports/encodePolyfill.d.ts.map +1 -1
- package/dist/js/transports/encodePolyfill.js.map +1 -1
- package/dist/js/transports/native.js.map +1 -1
- package/dist/js/utils/AsyncExpiringMap.js.map +1 -1
- package/dist/js/utils/encode.js.map +1 -1
- package/dist/js/utils/environment.js.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.js +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -1
- package/dist/js/utils/normalize.js.map +1 -1
- package/dist/js/utils/outcome.js.map +1 -1
- package/dist/js/utils/primitiveConverter.js.map +1 -1
- package/dist/js/utils/release.js.map +1 -1
- package/dist/js/utils/rnlibraries.js.map +1 -1
- package/dist/js/utils/safe.d.ts +1 -1
- package/dist/js/utils/safe.d.ts.map +1 -1
- package/dist/js/utils/safe.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +0 -1
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/xhr.d.ts +0 -1
- package/dist/js/utils/xhr.d.ts.map +1 -1
- package/dist/js/utils/xhr.js.map +1 -1
- package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
- package/dist/js/vendor/buffer/utf8ToBytes.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +5 -6
- package/dist/js/wrapper.js.map +1 -1
- package/expo-module.config.json +7 -0
- package/ios/RNSentry.mm +47 -1
- package/ios/RNSentryEvents.h +1 -0
- package/ios/RNSentryEvents.m +1 -0
- package/ios/RNSentryStart.m +4 -1
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +15 -15
- package/plugin/build/withSentry.js +1 -1
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
- package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
- package/scripts/sentry-xcode.sh +14 -0
- package/sentry.gradle +13 -0
- package/src/js/NativeRNSentry.ts +2 -0
- package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
- package/ts3.8/dist/js/feedback/FeedbackWidgetManager.d.ts +3 -1
- package/ts3.8/dist/js/feedback/FeedbackWidgetProvider.d.ts +3 -2
- package/ts3.8/dist/js/feedback/ScreenshotButton.d.ts +1 -1
- package/ts3.8/dist/js/feedback/ShakeToReportBug.d.ts +27 -0
- package/ts3.8/dist/js/feedback/integration.d.ts +13 -2
- package/ts3.8/dist/js/index.d.ts +1 -1
- package/ts3.8/dist/js/integrations/exports.d.ts +1 -0
- package/ts3.8/dist/js/integrations/expoupdateslistener.d.ts +38 -0
- package/ts3.8/dist/js/options.d.ts +13 -1
- package/ts3.8/dist/js/playground/modal.d.ts +2 -2
- package/ts3.8/dist/js/replay/networkUtils.d.ts +0 -1
- package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +9 -1
- package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
- package/ts3.8/dist/js/tracing/reactnavigation.d.ts +3 -0
- package/ts3.8/dist/js/tracing/span.d.ts +2 -17
- package/ts3.8/dist/js/transports/encodePolyfill.d.ts +1 -1
- package/ts3.8/dist/js/utils/safe.d.ts +1 -1
- package/ts3.8/dist/js/utils/worldwide.d.ts +0 -1
- package/ts3.8/dist/js/utils/xhr.d.ts +0 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
package/RNSentry.podspec
CHANGED
|
@@ -51,7 +51,7 @@ Pod::Spec.new do |s|
|
|
|
51
51
|
'HEADER_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}/Sentry/Sources/Sentry" "${PODS_ROOT}/Sentry/Sources/Sentry/include"'
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
s.dependency 'Sentry', '9.
|
|
54
|
+
s.dependency 'Sentry', '9.8.0'
|
|
55
55
|
|
|
56
56
|
if defined? install_modules_dependencies
|
|
57
57
|
# Default React Native dependencies for 0.71 and above (new and legacy architecture)
|
package/android/build.gradle
CHANGED
|
@@ -55,6 +55,6 @@ android {
|
|
|
55
55
|
dependencies {
|
|
56
56
|
compileOnly files('libs/replay-stubs.jar')
|
|
57
57
|
implementation 'com.facebook.react:react-native:+'
|
|
58
|
-
api 'io.sentry:sentry-android:8.
|
|
59
|
-
debugImplementation 'io.sentry:sentry-spotlight:8.
|
|
58
|
+
api 'io.sentry:sentry-android:8.36.0'
|
|
59
|
+
debugImplementation 'io.sentry:sentry-spotlight:8.36.0'
|
|
60
60
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
|
|
3
|
+
android {
|
|
4
|
+
compileSdkVersion 31
|
|
5
|
+
namespace = "io.sentry.react.expo"
|
|
6
|
+
|
|
7
|
+
defaultConfig {
|
|
8
|
+
minSdkVersion 21
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
compileOptions {
|
|
12
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
13
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
dependencies {
|
|
18
|
+
compileOnly project(':expo-modules-core')
|
|
19
|
+
compileOnly 'io.sentry:sentry-android:8.36.0'
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package io.sentry.react.expo;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import expo.modules.core.interfaces.Package;
|
|
5
|
+
import expo.modules.core.interfaces.ReactNativeHostHandler;
|
|
6
|
+
import java.util.Collections;
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Expo package that registers {@link SentryReactNativeHostHandler} to capture native exceptions
|
|
11
|
+
* swallowed by Expo's bridgeless error handling.
|
|
12
|
+
*
|
|
13
|
+
* <p>This package is auto-discovered by Expo's autolinking system when {@code @sentry/react-native}
|
|
14
|
+
* is installed in an Expo project. It is not used in non-Expo React Native projects.
|
|
15
|
+
*/
|
|
16
|
+
public class SentryExpoPackage implements Package {
|
|
17
|
+
|
|
18
|
+
@Override
|
|
19
|
+
public List<? extends ReactNativeHostHandler> createReactNativeHostHandlers(Context context) {
|
|
20
|
+
return Collections.singletonList(new SentryReactNativeHostHandler());
|
|
21
|
+
}
|
|
22
|
+
}
|
package/android/expo-handler/src/main/java/io/sentry/react/expo/SentryReactNativeHostHandler.java
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package io.sentry.react.expo;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import expo.modules.core.interfaces.ReactNativeHostHandler;
|
|
5
|
+
import io.sentry.Sentry;
|
|
6
|
+
import io.sentry.exception.ExceptionMechanismException;
|
|
7
|
+
import io.sentry.protocol.Mechanism;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Captures native Android exceptions that are routed through Expo's {@code
|
|
11
|
+
* ExpoReactHostDelegate.handleInstanceException}.
|
|
12
|
+
*
|
|
13
|
+
* <p>On Expo SDK 53+, certain native exceptions (e.g., IllegalStateException from Fabric's
|
|
14
|
+
* SurfaceMountingManager) are caught by React Native and routed to {@code handleInstanceException}.
|
|
15
|
+
* Expo's implementation iterates registered host handlers but does not rethrow, so the exception
|
|
16
|
+
* never reaches Java's {@code UncaughtExceptionHandler} which Sentry relies on for crash capture.
|
|
17
|
+
*
|
|
18
|
+
* <p>This handler captures those exceptions directly via {@code Sentry.captureException} with an
|
|
19
|
+
* unhandled mechanism, ensuring they appear as crashes in Sentry.
|
|
20
|
+
*/
|
|
21
|
+
public class SentryReactNativeHostHandler implements ReactNativeHostHandler {
|
|
22
|
+
|
|
23
|
+
private static final String MECHANISM_TYPE = "expoReactHost";
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
public void onReactInstanceException(boolean useDeveloperSupport, @NonNull Exception exception) {
|
|
27
|
+
if (useDeveloperSupport) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!Sentry.isEnabled()) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try { // NOPMD - We don't want to crash in any case
|
|
36
|
+
final Mechanism mechanism = new Mechanism();
|
|
37
|
+
mechanism.setType(MECHANISM_TYPE);
|
|
38
|
+
mechanism.setHandled(false);
|
|
39
|
+
|
|
40
|
+
final ExceptionMechanismException mechanismException =
|
|
41
|
+
new ExceptionMechanismException(mechanism, exception, Thread.currentThread());
|
|
42
|
+
|
|
43
|
+
Sentry.captureException(mechanismException);
|
|
44
|
+
} catch (Throwable ignored) { // NOPMD - We don't want to crash in any case
|
|
45
|
+
// ignore
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
This module provides stubs for `expo-modules-core` interfaces (`Package` and `ReactNativeHostHandler`) needed to compile the Expo handler tests in `RNSentryAndroidTester`.
|
|
2
|
+
|
|
3
|
+
The Expo handler (`android/expo-handler/`) registers a `ReactNativeHostHandler` that captures native exceptions swallowed by Expo's bridgeless error handling (`ExpoReactHostDelegate.handleInstanceException`). In Expo projects, the handler is compiled against the real `expo-modules-core` project. For unit testing in `RNSentryAndroidTester` (which doesn't have Expo), these stubs provide the interfaces at compile time.
|
|
4
|
+
|
|
5
|
+
## Updating the stubs
|
|
6
|
+
|
|
7
|
+
To update the stubs, just run `yarn build` from the root of the repo and it will recompile the classes and put them under `packages/core/android/libs/expo-stubs.jar`. Check this newly generated `.jar` in and push.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
allprojects {
|
|
2
|
+
repositories {
|
|
3
|
+
mavenCentral()
|
|
4
|
+
google()
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
apply plugin: 'java-library'
|
|
9
|
+
|
|
10
|
+
java {
|
|
11
|
+
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
12
|
+
targetCompatibility = JavaVersion.VERSION_1_8
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
tasks.named('jar', Jar) {
|
|
16
|
+
archiveBaseName.set('expo-stubs')
|
|
17
|
+
archiveVersion.set('')
|
|
18
|
+
destinationDirectory.set(file("$rootDir/../libs"))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
dependencies {
|
|
22
|
+
compileOnly 'com.google.android:android:4.1.1.4'
|
|
23
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Copyright © 2015-2021 the original authors.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
19
|
+
#
|
|
20
|
+
|
|
21
|
+
##############################################################################
|
|
22
|
+
#
|
|
23
|
+
# Gradle start up script for POSIX generated by Gradle.
|
|
24
|
+
#
|
|
25
|
+
# Important for running:
|
|
26
|
+
#
|
|
27
|
+
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
28
|
+
# noncompliant, but you have some other compliant shell such as ksh or
|
|
29
|
+
# bash, then to run this script, type that shell name before the whole
|
|
30
|
+
# command line, like:
|
|
31
|
+
#
|
|
32
|
+
# ksh Gradle
|
|
33
|
+
#
|
|
34
|
+
# Busybox and similar reduced shells will NOT work, because this script
|
|
35
|
+
# requires all of these POSIX shell features:
|
|
36
|
+
# * functions;
|
|
37
|
+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
38
|
+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
39
|
+
# * compound commands having a testable exit status, especially «case»;
|
|
40
|
+
# * various built-in commands including «command», «set», and «ulimit».
|
|
41
|
+
#
|
|
42
|
+
# Important for patching:
|
|
43
|
+
#
|
|
44
|
+
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
45
|
+
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
46
|
+
#
|
|
47
|
+
# The "traditional" practice of packing multiple parameters into a
|
|
48
|
+
# space-separated string is a well documented source of bugs and security
|
|
49
|
+
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
50
|
+
# options in "$@", and eventually passing that to Java.
|
|
51
|
+
#
|
|
52
|
+
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
53
|
+
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
54
|
+
# see the in-line comments for details.
|
|
55
|
+
#
|
|
56
|
+
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
57
|
+
# Darwin, MinGW, and NonStop.
|
|
58
|
+
#
|
|
59
|
+
# (3) This script is generated from the Groovy template
|
|
60
|
+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
61
|
+
# within the Gradle project.
|
|
62
|
+
#
|
|
63
|
+
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
64
|
+
#
|
|
65
|
+
##############################################################################
|
|
66
|
+
|
|
67
|
+
# Attempt to set APP_HOME
|
|
68
|
+
|
|
69
|
+
# Resolve links: $0 may be a link
|
|
70
|
+
app_path=$0
|
|
71
|
+
|
|
72
|
+
# Need this for daisy-chained symlinks.
|
|
73
|
+
while
|
|
74
|
+
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
75
|
+
[ -h "$app_path" ]
|
|
76
|
+
do
|
|
77
|
+
ls=$( ls -ld "$app_path" )
|
|
78
|
+
link=${ls#*' -> '}
|
|
79
|
+
case $link in #(
|
|
80
|
+
/*) app_path=$link ;; #(
|
|
81
|
+
*) app_path=$APP_HOME$link ;;
|
|
82
|
+
esac
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
# This is normally unused
|
|
86
|
+
# shellcheck disable=SC2034
|
|
87
|
+
APP_BASE_NAME=${0##*/}
|
|
88
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
89
|
+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
|
90
|
+
|
|
91
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
92
|
+
MAX_FD=maximum
|
|
93
|
+
|
|
94
|
+
warn () {
|
|
95
|
+
echo "$*"
|
|
96
|
+
} >&2
|
|
97
|
+
|
|
98
|
+
die () {
|
|
99
|
+
echo
|
|
100
|
+
echo "$*"
|
|
101
|
+
echo
|
|
102
|
+
exit 1
|
|
103
|
+
} >&2
|
|
104
|
+
|
|
105
|
+
# OS specific support (must be 'true' or 'false').
|
|
106
|
+
cygwin=false
|
|
107
|
+
msys=false
|
|
108
|
+
darwin=false
|
|
109
|
+
nonstop=false
|
|
110
|
+
case "$( uname )" in #(
|
|
111
|
+
CYGWIN* ) cygwin=true ;; #(
|
|
112
|
+
Darwin* ) darwin=true ;; #(
|
|
113
|
+
MSYS* | MINGW* ) msys=true ;; #(
|
|
114
|
+
NONSTOP* ) nonstop=true ;;
|
|
115
|
+
esac
|
|
116
|
+
|
|
117
|
+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# Determine the Java command to use to start the JVM.
|
|
121
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
122
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
123
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
124
|
+
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
125
|
+
else
|
|
126
|
+
JAVACMD=$JAVA_HOME/bin/java
|
|
127
|
+
fi
|
|
128
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
129
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
130
|
+
|
|
131
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
132
|
+
location of your Java installation."
|
|
133
|
+
fi
|
|
134
|
+
else
|
|
135
|
+
JAVACMD=java
|
|
136
|
+
if ! command -v java >/dev/null 2>&1
|
|
137
|
+
then
|
|
138
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
139
|
+
|
|
140
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
141
|
+
location of your Java installation."
|
|
142
|
+
fi
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# Increase the maximum file descriptors if we can.
|
|
146
|
+
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
147
|
+
case $MAX_FD in #(
|
|
148
|
+
max*)
|
|
149
|
+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
150
|
+
# shellcheck disable=SC2039,SC3045
|
|
151
|
+
MAX_FD=$( ulimit -H -n ) ||
|
|
152
|
+
warn "Could not query maximum file descriptor limit"
|
|
153
|
+
esac
|
|
154
|
+
case $MAX_FD in #(
|
|
155
|
+
'' | soft) :;; #(
|
|
156
|
+
*)
|
|
157
|
+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
158
|
+
# shellcheck disable=SC2039,SC3045
|
|
159
|
+
ulimit -n "$MAX_FD" ||
|
|
160
|
+
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
161
|
+
esac
|
|
162
|
+
fi
|
|
163
|
+
|
|
164
|
+
# Collect all arguments for the java command, stacking in reverse order:
|
|
165
|
+
# * args from the command line
|
|
166
|
+
# * the main class name
|
|
167
|
+
# * -classpath
|
|
168
|
+
# * -D...appname settings
|
|
169
|
+
# * --module-path (only if needed)
|
|
170
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
171
|
+
|
|
172
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
173
|
+
if "$cygwin" || "$msys" ; then
|
|
174
|
+
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
175
|
+
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
176
|
+
|
|
177
|
+
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
178
|
+
|
|
179
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
180
|
+
for arg do
|
|
181
|
+
if
|
|
182
|
+
case $arg in #(
|
|
183
|
+
-*) false ;; # don't mess with options #(
|
|
184
|
+
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
185
|
+
[ -e "$t" ] ;; #(
|
|
186
|
+
*) false ;;
|
|
187
|
+
esac
|
|
188
|
+
then
|
|
189
|
+
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
190
|
+
fi
|
|
191
|
+
# Roll the args list around exactly as many times as the number of
|
|
192
|
+
# args, so each arg winds up back in the position where it started, but
|
|
193
|
+
# possibly modified.
|
|
194
|
+
#
|
|
195
|
+
# NB: a `for` loop captures its iteration list before it begins, so
|
|
196
|
+
# changing the positional parameters here affects neither the number of
|
|
197
|
+
# iterations, nor the values presented in `arg`.
|
|
198
|
+
shift # remove old arg
|
|
199
|
+
set -- "$@" "$arg" # push replacement arg
|
|
200
|
+
done
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
205
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
206
|
+
|
|
207
|
+
# Collect all arguments for the java command:
|
|
208
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
209
|
+
# and any embedded shellness will be escaped.
|
|
210
|
+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
211
|
+
# treated as '${Hostname}' itself on the command line.
|
|
212
|
+
|
|
213
|
+
set -- \
|
|
214
|
+
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
215
|
+
-classpath "$CLASSPATH" \
|
|
216
|
+
org.gradle.wrapper.GradleWrapperMain \
|
|
217
|
+
"$@"
|
|
218
|
+
|
|
219
|
+
# Stop when "xargs" is not available.
|
|
220
|
+
if ! command -v xargs >/dev/null 2>&1
|
|
221
|
+
then
|
|
222
|
+
die "xargs is not available"
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
# Use "xargs" to parse quoted args.
|
|
226
|
+
#
|
|
227
|
+
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
228
|
+
#
|
|
229
|
+
# In Bash we could simply go:
|
|
230
|
+
#
|
|
231
|
+
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
232
|
+
# set -- "${ARGS[@]}" "$@"
|
|
233
|
+
#
|
|
234
|
+
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
235
|
+
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
236
|
+
# character that might be a shell metacharacter, then use eval to reverse
|
|
237
|
+
# that process (while maintaining the separation between arguments), and wrap
|
|
238
|
+
# the whole thing up as a single "set" statement.
|
|
239
|
+
#
|
|
240
|
+
# This will of course break if any of these variables contains a newline or
|
|
241
|
+
# an unmatched quote.
|
|
242
|
+
#
|
|
243
|
+
|
|
244
|
+
eval "set -- $(
|
|
245
|
+
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
246
|
+
xargs -n1 |
|
|
247
|
+
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
248
|
+
tr '\n' ' '
|
|
249
|
+
)" '"$@"'
|
|
250
|
+
|
|
251
|
+
exec "$JAVACMD" "$@"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
@rem SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
@rem
|
|
18
|
+
|
|
19
|
+
@if "%DEBUG%"=="" @echo off
|
|
20
|
+
@rem ##########################################################################
|
|
21
|
+
@rem
|
|
22
|
+
@rem Gradle startup script for Windows
|
|
23
|
+
@rem
|
|
24
|
+
@rem ##########################################################################
|
|
25
|
+
|
|
26
|
+
@rem Set local scope for the variables with windows NT shell
|
|
27
|
+
if "%OS%"=="Windows_NT" setlocal
|
|
28
|
+
|
|
29
|
+
set DIRNAME=%~dp0
|
|
30
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
31
|
+
@rem This is normally unused
|
|
32
|
+
set APP_BASE_NAME=%~n0
|
|
33
|
+
set APP_HOME=%DIRNAME%
|
|
34
|
+
|
|
35
|
+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
36
|
+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
37
|
+
|
|
38
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
39
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
40
|
+
|
|
41
|
+
@rem Find java.exe
|
|
42
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
43
|
+
|
|
44
|
+
set JAVA_EXE=java.exe
|
|
45
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
46
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
47
|
+
|
|
48
|
+
echo. 1>&2
|
|
49
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
50
|
+
echo. 1>&2
|
|
51
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
52
|
+
echo location of your Java installation. 1>&2
|
|
53
|
+
|
|
54
|
+
goto fail
|
|
55
|
+
|
|
56
|
+
:findJavaFromJavaHome
|
|
57
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
58
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
59
|
+
|
|
60
|
+
if exist "%JAVA_EXE%" goto execute
|
|
61
|
+
|
|
62
|
+
echo. 1>&2
|
|
63
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
64
|
+
echo. 1>&2
|
|
65
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
66
|
+
echo location of your Java installation. 1>&2
|
|
67
|
+
|
|
68
|
+
goto fail
|
|
69
|
+
|
|
70
|
+
:execute
|
|
71
|
+
@rem Setup the command line
|
|
72
|
+
|
|
73
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@rem Execute Gradle
|
|
77
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
78
|
+
|
|
79
|
+
:end
|
|
80
|
+
@rem End local scope for the variables with windows NT shell
|
|
81
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
82
|
+
|
|
83
|
+
:fail
|
|
84
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
85
|
+
rem the _cmd.exe /c_ return code!
|
|
86
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
87
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
88
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
89
|
+
exit /b %EXIT_CODE%
|
|
90
|
+
|
|
91
|
+
:mainEnd
|
|
92
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
93
|
+
|
|
94
|
+
:omega
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rootProject.name = 'expo-stubs'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package expo.modules.core.interfaces;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import java.util.Collections;
|
|
5
|
+
import java.util.List;
|
|
6
|
+
|
|
7
|
+
public interface Package {
|
|
8
|
+
default List<? extends ReactNativeHostHandler> createReactNativeHostHandlers(Context context) {
|
|
9
|
+
return Collections.emptyList();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -28,7 +28,6 @@ import com.facebook.react.bridge.WritableArray;
|
|
|
28
28
|
import com.facebook.react.bridge.WritableMap;
|
|
29
29
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
30
30
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
31
|
-
import io.sentry.Breadcrumb;
|
|
32
31
|
import io.sentry.ILogger;
|
|
33
32
|
import io.sentry.IScope;
|
|
34
33
|
import io.sentry.ISentryExecutorService;
|
|
@@ -45,6 +44,7 @@ import io.sentry.android.core.BuildInfoProvider;
|
|
|
45
44
|
import io.sentry.android.core.InternalSentrySdk;
|
|
46
45
|
import io.sentry.android.core.SentryAndroidDateProvider;
|
|
47
46
|
import io.sentry.android.core.SentryAndroidOptions;
|
|
47
|
+
import io.sentry.android.core.SentryShakeDetector;
|
|
48
48
|
import io.sentry.android.core.ViewHierarchyEventProcessor;
|
|
49
49
|
import io.sentry.android.core.internal.debugmeta.AssetsDebugMetaLoader;
|
|
50
50
|
import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
|
|
@@ -72,7 +72,6 @@ import java.net.URISyntaxException;
|
|
|
72
72
|
import java.nio.charset.Charset;
|
|
73
73
|
import java.util.ArrayList;
|
|
74
74
|
import java.util.HashMap;
|
|
75
|
-
import java.util.Iterator;
|
|
76
75
|
import java.util.List;
|
|
77
76
|
import java.util.Map;
|
|
78
77
|
import java.util.Properties;
|
|
@@ -122,6 +121,9 @@ public class RNSentryModuleImpl {
|
|
|
122
121
|
|
|
123
122
|
private final @NotNull Runnable emitNewFrameEvent;
|
|
124
123
|
|
|
124
|
+
private static final String ON_SHAKE_EVENT = "rn_sentry_on_shake";
|
|
125
|
+
private @Nullable SentryShakeDetector shakeDetector;
|
|
126
|
+
|
|
125
127
|
/** Max trace file size in bytes. */
|
|
126
128
|
private long maxTraceFileSize = 5 * 1024 * 1024;
|
|
127
129
|
|
|
@@ -208,10 +210,58 @@ public class RNSentryModuleImpl {
|
|
|
208
210
|
}
|
|
209
211
|
|
|
210
212
|
public void removeListeners(double id) {
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
// removeListeners does not carry event-type information, so it cannot be used
|
|
214
|
+
// to track shake listeners selectively. Shake detection is managed exclusively
|
|
215
|
+
// via enableShakeDetection / disableShakeDetection.
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private void startShakeDetection() {
|
|
219
|
+
if (shakeDetector != null) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
try { // NOPMD - We don't want to crash in any case
|
|
224
|
+
final ReactApplicationContext context = getReactApplicationContext();
|
|
225
|
+
shakeDetector = new SentryShakeDetector(logger);
|
|
226
|
+
shakeDetector.start(
|
|
227
|
+
context,
|
|
228
|
+
() -> {
|
|
229
|
+
try { // NOPMD - We don't want to crash in any case
|
|
230
|
+
final ReactApplicationContext ctx = getReactApplicationContext();
|
|
231
|
+
if (ctx.hasActiveReactInstance()) {
|
|
232
|
+
ctx.getJSModule(
|
|
233
|
+
com.facebook.react.modules.core.DeviceEventManagerModule
|
|
234
|
+
.RCTDeviceEventEmitter.class)
|
|
235
|
+
.emit(ON_SHAKE_EVENT, null);
|
|
236
|
+
}
|
|
237
|
+
} catch (Throwable e) { // NOPMD - We don't want to crash in any case
|
|
238
|
+
logger.log(SentryLevel.WARNING, "Failed to emit shake event.", e);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
} catch (Throwable e) { // NOPMD - We don't want to crash in any case
|
|
242
|
+
logger.log(SentryLevel.WARNING, "Failed to start shake detection.", e);
|
|
243
|
+
shakeDetector = null;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private void stopShakeDetection() {
|
|
248
|
+
try { // NOPMD - We don't want to crash in any case
|
|
249
|
+
if (shakeDetector != null) {
|
|
250
|
+
shakeDetector.stop();
|
|
251
|
+
shakeDetector = null;
|
|
252
|
+
}
|
|
253
|
+
} catch (Throwable e) { // NOPMD - We don't want to crash in any case
|
|
254
|
+
logger.log(SentryLevel.WARNING, "Failed to stop shake detection.", e);
|
|
255
|
+
shakeDetector = null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
public void enableShakeDetection() {
|
|
260
|
+
startShakeDetection();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public void disableShakeDetection() {
|
|
264
|
+
stopShakeDetection();
|
|
215
265
|
}
|
|
216
266
|
|
|
217
267
|
public void fetchModules(Promise promise) {
|
|
@@ -814,19 +864,25 @@ public class RNSentryModuleImpl {
|
|
|
814
864
|
promise.resolve(null);
|
|
815
865
|
return;
|
|
816
866
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
867
|
+
|
|
868
|
+
final @NotNull Map<String, Object> serialized =
|
|
869
|
+
InternalSentrySdk.serializeScope(context, (SentryAndroidOptions) options, currentScope);
|
|
870
|
+
|
|
871
|
+
final @Nullable Object serializedBreadcrumbs = serialized.get("breadcrumbs");
|
|
872
|
+
if (serializedBreadcrumbs instanceof List) {
|
|
873
|
+
final List<?> breadcrumbs = (List<?>) serializedBreadcrumbs;
|
|
874
|
+
List<Map<?, ?>> filtered = new ArrayList<>();
|
|
875
|
+
for (Object o : breadcrumbs) {
|
|
876
|
+
if (o instanceof Map) {
|
|
877
|
+
final Map<?, ?> breadcrumb = (Map<?, ?>) o;
|
|
878
|
+
if (!"react-native".equals(breadcrumb.get("origin"))) {
|
|
879
|
+
filtered.add(breadcrumb);
|
|
880
|
+
}
|
|
824
881
|
}
|
|
825
882
|
}
|
|
883
|
+
serialized.put("breadcrumbs", filtered);
|
|
826
884
|
}
|
|
827
885
|
|
|
828
|
-
final @NotNull Map<String, Object> serialized =
|
|
829
|
-
InternalSentrySdk.serializeScope(context, (SentryAndroidOptions) options, currentScope);
|
|
830
886
|
final @Nullable Object deviceContext = RNSentryMapConverter.convertToWritable(serialized);
|
|
831
887
|
promise.resolve(deviceContext);
|
|
832
888
|
}
|