Skip to content

Commit

Permalink
tmp: comment out internal to test android tester ci
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Jul 13, 2023
1 parent a864fff commit 35e8aba
Showing 1 changed file with 12 additions and 31 deletions.
43 changes: 12 additions & 31 deletions android/src/main/java/io/sentry/react/RNSentryModuleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,25 @@
import com.facebook.react.bridge.WritableNativeArray;
import com.facebook.react.bridge.WritableNativeMap;

import org.jetbrains.annotations.NotNull;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import io.sentry.Breadcrumb;
import io.sentry.DateUtils;
import io.sentry.EnvelopeReader;
import io.sentry.Hub;
import io.sentry.HubAdapter;
import io.sentry.IEnvelopeReader;
import io.sentry.ILogger;
import io.sentry.ISerializer;
import io.sentry.Integration;
import io.sentry.InternalSentrySdk;
import io.sentry.Scope;
import io.sentry.Sentry;
import io.sentry.SentryDate;
import io.sentry.SentryEnvelope;
import io.sentry.SentryEvent;
import io.sentry.SentryLevel;
import io.sentry.UncaughtExceptionHandlerIntegration;
Expand All @@ -66,6 +54,7 @@
import io.sentry.android.core.CurrentActivityHolder;
import io.sentry.android.core.NdkIntegration;
import io.sentry.android.core.SentryAndroid;
import io.sentry.android.core.SentryAndroidOptions;
import io.sentry.android.core.ViewHierarchyEventProcessor;
import io.sentry.protocol.SdkVersion;
import io.sentry.protocol.SentryException;
Expand Down Expand Up @@ -344,18 +333,10 @@ public void captureEnvelope(ReadableArray rawBytes, ReadableMap options, Promise
bytes[i] = (byte) rawBytes.getInt(i);
}

final HubAdapter hubAdapter = HubAdapter.getInstance();
IEnvelopeReader envelopeReader = hubAdapter.getOptions().getEnvelopeReader();
try (final InputStream byteStream = new ByteArrayInputStream(bytes)) {
final SentryEnvelope sentryEnvelope = envelopeReader.read(byteStream);
if (sentryEnvelope != null) {
hubAdapter.captureEnvelope(sentryEnvelope);
} else {
logger.log(SentryLevel.ERROR, "Sentry Envelope Reader returned null after reading envelopes bytes");
promise.resolve(false);
}
} catch (IOException e) {
logger.log(SentryLevel.ERROR, "Error while reading envelope bytes");
try {
//InternalSentrySdk.captureEnvelope(bytes);
} catch (Throwable e) {
logger.log(SentryLevel.ERROR, "Error while capturing envelope");
promise.resolve(false);
}
promise.resolve(true);
Expand Down Expand Up @@ -626,13 +607,13 @@ public void disableNativeFramesTracking() {
}

public void fetchNativeDeviceContexts(Promise promise) {
// Temp work around until sorted out this API in sentry-java.
// TODO: If the callback isn't executed the promise wouldn't be resolved.
HubAdapter.getInstance().withScope((@NotNull final Scope scope) -> {
final Map<String, Object> serialized = InternalSentrySdk.serializeScope(scope);
final Object deviceContext = MapConverter.convertToWritable(serialized);
promise.resolve(deviceContext);
});
// final Scope currentScope = InternalSentrySdk.getCurrentScope();
// final Map<String, Object> serialized = InternalSentrySdk.serializeScope(
// this.getReactApplicationContext().getApplicationContext(),
// (SentryAndroidOptions) HubAdapter.getInstance().getOptions(),
// currentScope);
// final Object deviceContext = MapConverter.convertToWritable(serialized);
// promise.resolve(deviceContext);
}

public void fetchNativeSdkInfo(Promise promise) {
Expand Down

0 comments on commit 35e8aba

Please sign in to comment.