Skip to content

Commit 44759b7

Browse files
authored
feat: Remove react application parameter (#427)
1 parent 8a097de commit 44759b7

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

android/src/main/java/io/sentry/RNSentryModule.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import android.content.pm.PackageManager;
66
import android.support.annotation.NonNull;
77

8-
import com.facebook.react.ReactApplication;
98
import com.facebook.react.bridge.Arguments;
109
import com.facebook.react.bridge.Promise;
1110
import com.facebook.react.bridge.ReactApplicationContext;
@@ -52,11 +51,10 @@
5251
public class RNSentryModule extends ReactContextBaseJavaModule {
5352

5453
private static final Pattern mJsModuleIdPattern = Pattern.compile("(?:^|[/\\\\])(\\d+\\.js)$");
55-
private static final String versionString = "0.37.1";
54+
private static final String versionString = "0.35.4";
5655
private static final String sdkName = "sentry-react-native";
5756

5857
private final ReactApplicationContext reactContext;
59-
private final ReactApplication reactApplication;
6058

6159
private static AndroidEventBuilderHelper androidHelper;
6260
private static PackageInfo packageInfo;
@@ -65,18 +63,13 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
6563
private static ReadableMap tags;
6664
private static SentryClient sentryClient;
6765

68-
public RNSentryModule(ReactApplicationContext reactContext, ReactApplication reactApplication) {
66+
public RNSentryModule(ReactApplicationContext reactContext) {
6967
super(reactContext);
7068
this.reactContext = reactContext;
71-
this.reactApplication = reactApplication;
7269
RNSentryModule.extra = new WritableNativeMap();
7370
RNSentryModule.packageInfo = getPackageInfo(reactContext);
7471
}
7572

76-
public ReactApplication getReactApplication() {
77-
return reactApplication;
78-
}
79-
8073
@Override
8174
public String getName() {
8275
return "RNSentry";
@@ -109,9 +102,8 @@ public void startWithDsnString(String dsnString, final ReadableMap options, Prom
109102
sentryClient.addEventSendCallback(new EventSendCallback() {
110103
@Override
111104
public void onFailure(Event event, Exception exception) {
112-
// This needs to be there, otherwise in case of no internet the users app will not
113-
// crash since we do not propagate the error further. The system needs to be
114-
// overhauled to remove this "hack".
105+
// This needs to be there, otherwise in case of not internet the users app will not
106+
// crash since we do not propagate the error further.
115107
RNSentryEventEmitter.sendEvent(reactContext, RNSentryEventEmitter.SENTRY_EVENT_STORED, new WritableNativeMap());
116108
RNSentryEventEmitter.sendEvent(reactContext, RNSentryEventEmitter.SENTRY_EVENT_SENT_SUCCESSFULLY, new WritableNativeMap());
117109
}

android/src/main/java/io/sentry/RNSentryPackage.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,16 @@
55
import java.util.Collections;
66
import java.util.List;
77

8-
import com.facebook.react.ReactApplication;
98
import com.facebook.react.ReactPackage;
109
import com.facebook.react.bridge.NativeModule;
1110
import com.facebook.react.bridge.ReactApplicationContext;
1211
import com.facebook.react.uimanager.ViewManager;
1312
import com.facebook.react.bridge.JavaScriptModule;
1413

1514
public class RNSentryPackage implements ReactPackage {
16-
17-
private final ReactApplication reactApplication;
18-
19-
public RNSentryPackage(ReactApplication reactApplication) {
20-
this.reactApplication = reactApplication;
21-
}
22-
23-
public ReactApplication getReactApplication() {
24-
return reactApplication;
25-
}
26-
2715
@Override
2816
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
29-
return Arrays.<NativeModule>asList(new RNSentryModule(reactContext, this.getReactApplication()), new RNSentryEventEmitter(reactContext));
17+
return Arrays.<NativeModule>asList(new RNSentryModule(reactContext), new RNSentryEventEmitter(reactContext));
3018
}
3119

3220
public List<Class<? extends JavaScriptModule>> createJSModules() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"postunlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall"
3838
},
3939
"android": {
40-
"packageInstance": "new RNSentryPackage(MainApplication.this)"
40+
"packageInstance": "new RNSentryPackage()"
4141
},
4242
"ios": {
4343
"sharedLibraries": [

0 commit comments

Comments
 (0)