@sentry/react-native 6.12.0 → 6.13.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 CHANGED
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
37
37
 
38
38
  s.compiler_flags = other_cflags
39
39
 
40
- s.dependency 'Sentry/HybridSDK', '8.49.1'
40
+ s.dependency 'Sentry/HybridSDK', '8.49.2'
41
41
 
42
42
  if defined? install_modules_dependencies
43
43
  # Default React Native dependencies for 0.71 and above (new and legacy architecture)
@@ -90,6 +90,7 @@ import java.util.Properties;
90
90
  import java.util.concurrent.CountDownLatch;
91
91
  import org.jetbrains.annotations.NotNull;
92
92
  import org.jetbrains.annotations.Nullable;
93
+ import org.jetbrains.annotations.TestOnly;
93
94
 
94
95
  public class RNSentryModuleImpl {
95
96
 
@@ -177,12 +178,22 @@ public class RNSentryModuleImpl {
177
178
 
178
179
  public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
179
180
  SentryAndroid.init(
180
- this.getReactApplicationContext(),
181
- options -> getSentryAndroidOptions(options, rnOptions, logger));
181
+ getApplicationContext(), options -> getSentryAndroidOptions(options, rnOptions, logger));
182
182
 
183
183
  promise.resolve(true);
184
184
  }
185
185
 
186
+ @TestOnly
187
+ protected Context getApplicationContext() {
188
+ final Context context = this.getReactApplicationContext().getApplicationContext();
189
+ if (context == null) {
190
+ logger.log(
191
+ SentryLevel.ERROR, "ApplicationContext is null, using ReactApplicationContext fallback.");
192
+ return this.getReactApplicationContext();
193
+ }
194
+ return context;
195
+ }
196
+
186
197
  protected void getSentryAndroidOptions(
187
198
  @NotNull SentryAndroidOptions options, @NotNull ReadableMap rnOptions, ILogger logger) {
188
199
  @Nullable SdkVersion sdkVersion = options.getSdkVersion();
@@ -14,6 +14,7 @@ import io.sentry.android.core.AndroidLogger;
14
14
  import io.sentry.android.core.BuildInfoProvider;
15
15
  import io.sentry.android.core.SentryAndroidDateProvider;
16
16
  import io.sentry.android.core.internal.util.FirstDrawDoneListener;
17
+ import io.sentry.react.utils.RNSentryActivityUtils;
17
18
  import java.util.Objects;
18
19
  import org.jetbrains.annotations.NotNull;
19
20
  import org.jetbrains.annotations.Nullable;
@@ -151,11 +152,12 @@ public class RNSentryOnDrawReporterManager
151
152
  return;
152
153
  }
153
154
 
154
- @Nullable Activity activity = reactContext.getCurrentActivity();
155
+ final @Nullable Activity activity =
156
+ RNSentryActivityUtils.getCurrentActivity(reactContext, logger);
155
157
  if (activity == null) {
156
158
  logger.log(
157
159
  SentryLevel.ERROR,
158
- "[TimeToDisplay] Won't emit next frame drawn event, reactContext is null.");
160
+ "[TimeToDisplay] Won't emit next frame drawn event, activity is null.");
159
161
  return;
160
162
  }
161
163
 
@@ -2,7 +2,7 @@ package io.sentry.react;
2
2
 
3
3
  class RNSentryVersion {
4
4
  static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5
- static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.12.0";
5
+ static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.13.0";
6
6
  static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
7
7
  static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
8
8
  static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
@@ -0,0 +1,31 @@
1
+ package io.sentry.react.utils;
2
+
3
+ import android.app.Activity;
4
+ import com.facebook.react.bridge.ReactApplicationContext;
5
+ import io.sentry.ILogger;
6
+ import io.sentry.SentryLevel;
7
+ import io.sentry.android.core.CurrentActivityHolder;
8
+ import org.jetbrains.annotations.NotNull;
9
+ import org.jetbrains.annotations.Nullable;
10
+
11
+ /** Utility class for React Native Activity related functionality. */
12
+ public final class RNSentryActivityUtils {
13
+
14
+ private RNSentryActivityUtils() {
15
+ // Prevent instantiation
16
+ }
17
+
18
+ public static @Nullable Activity getCurrentActivity(
19
+ final @NotNull ReactApplicationContext reactContext, final @NotNull ILogger logger) {
20
+ final Activity activity = reactContext.getCurrentActivity();
21
+ if (activity != null) {
22
+ return activity;
23
+ }
24
+
25
+ logger.log(
26
+ SentryLevel.DEBUG,
27
+ "[RNSentryActivityUtils] Given ReactApplicationContext has no activity attached, using"
28
+ + " CurrentActivityHolder as a fallback.");
29
+ return CurrentActivityHolder.getInstance().getActivity();
30
+ }
31
+ }
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "6.12.0";
3
+ export declare const SDK_VERSION = "6.13.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '6.12.0';
3
+ export const SDK_VERSION = '6.13.0';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '6.12.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '6.13.0';\n"]}
@@ -3,4 +3,4 @@
3
3
  NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
4
4
  NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
5
5
  NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
6
- NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.12.0";
6
+ NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.13.0";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "6.12.0",
5
+ "version": "6.13.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -5,7 +5,10 @@
5
5
  # print commands before executing them
6
6
  set -x
7
7
 
8
- [ -z "$WITH_ENVIRONMENT" ] && WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
8
+ # REACT_NATIVE_PATH first used in RN 0.74.0 Template https://github.com/facebook/react-native/commit/289e78388a87408e215a25108cb02511a05f5c80
9
+ LOCAL_REACT_NATIVE_PATH="${REACT_NATIVE_PATH:-"../node_modules/react-native"}"
10
+
11
+ [ -z "$WITH_ENVIRONMENT" ] && WITH_ENVIRONMENT="${LOCAL_REACT_NATIVE_PATH}/scripts/xcode/with-environment.sh"
9
12
 
10
13
  if [ -f "$WITH_ENVIRONMENT" ]; then
11
14
  # load envs if loader file exists (since rn 0.68)
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "6.12.0";
3
+ export declare const SDK_VERSION = "6.13.0";
4
4
  //# sourceMappingURL=version.d.ts.map