Skip to content

Commit

Permalink
Merge pull request #8 from middleware-labs/init-fix
Browse files Browse the repository at this point in the history
fix: 🐛 for throwing NPE during initializing middleware android sdk
  • Loading branch information
Archish27 committed Apr 29, 2024
2 parents b143a45 + 44f9fdc commit 1c1ce3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependencies {
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation ('io.github.middleware-labs:android-sdk:2.0.4')
implementation ('io.github.middleware-labs:android-sdk:2.0.5')
implementation 'io.opentelemetry.android:instrumentation:+'
implementation 'io.opentelemetry:opentelemetry-sdk:+'
runtimeOnly 'io.opentelemetry:opentelemetry-semconv:1.30.1-alpha'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public void initialize(ReadableMap configMap, Promise promise) {
.setGlobalAttributes(attributesFromMap(globalAttributes))
.setDeploymentEnvironment(deploymentEnvironment)
.disableActivityLifecycleMonitoring()
.build(Objects.requireNonNull(getReactApplicationContext().getCurrentActivity()).getApplication());
.build((Application) getReactApplicationContext().getApplicationContext());

if("true".equals(sessionRecording)) {
if (Boolean.TRUE.toString().equals(sessionRecording)) {
Middleware middleware = Middleware.getInstance();
middleware.startNativeRecording(getCurrentActivity());
}
Expand All @@ -103,7 +103,8 @@ public void nativeCrash() {
new Thread(() -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {}
} catch (InterruptedException e) {
}
throw new RuntimeException("test crash");
}).start();
}
Expand Down Expand Up @@ -242,7 +243,7 @@ private ReactSpanProperties propertiesFromMap(SpanMapReader mapReader) {

final ReadableArray readerEvents = mapReader.getEvents();
final List<EventData> newEvents = new ArrayList<>();
for(int index = 0; index < readerEvents.size(); index++) {
for (int index = 0; index < readerEvents.size(); index++) {
final ReadableMap readableMap = readerEvents.getMap(index);
final EventData eventData = EventData.create(
Long.parseLong(Objects.requireNonNull(readableMap.getString("time"))),
Expand Down

0 comments on commit 1c1ce3a

Please sign in to comment.