Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel

plugins {
id "io.sentry.android.gradle" version "6.17.0"
id "io.sentry.android.gradle" version "6.23.0"
id 'com.android.application'
id 'kotlin-android'
id 'com.ydq.android.gradle.native-aar.import'
Expand Down Expand Up @@ -83,7 +83,7 @@ android {

dependencies {
// This should be included by default in the Android SDK, but it seems to be a problem with v8+ of the SDK, so we have to manually add it
implementation 'io.sentry:sentry-native-ndk:0.16.0'
implementation 'io.sentry:sentry-native-ndk:0.16.6'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation group: 'androidx.constraintlayout', name: 'constraintlayout', version: '1.1.3'
implementation 'com.google.android.material:material:1.0.0'
Expand Down Expand Up @@ -142,7 +142,7 @@ tasks.withType(Test) {

sentry {
autoInstallation {
sentryVersion.set("8.51.0")
sentryVersion.set("8.58.0")
}
autoUpload = true
uploadNativeSymbols = true
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/example/vu/android/MyApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public void onCreate() {
options.getSessionReplay().setSessionSampleRate(1.0);
options.getLogs().setEnabled(true);

options.getDataCollection().setUserInfo(true);
options.getDataCollection().setDatabaseQueryData(true);
options.getDataCollection().setFilePaths(true);

options.setBeforeSend((event, hint) -> {

//Remove PII
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ public void checkout() {
Sentry.setAttribute("checkout.cart_size", selectedStoreItems.size());
Sentry.setAttribute("checkout.step", "initiate");

Sentry.feedback().disableOnShake();
Sentry.replay().flush();

ITransaction checkoutTransaction = Sentry.startTransaction("checkout [android]", "http.client");
checkoutTransaction.setOperation("http");
Sentry.configureScope(scope -> scope.setTransaction(checkoutTransaction));
Expand Down Expand Up @@ -365,6 +368,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
progressDialog.dismiss();
boolean success = response.isSuccessful();
response.close();
Sentry.feedback().enableOnShake();
if (!success) {
Log.w("checkout", "response failed");
runOnUiThread(new Runnable() {
Expand All @@ -383,6 +387,7 @@ public void run() {
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
progressDialog.dismiss();
Sentry.feedback().enableOnShake();
Sentry.captureException(e);

processDeliveryItem(checkoutTransaction);
Expand Down Expand Up @@ -496,4 +501,4 @@ private void runOnUiThread(Runnable action) {
action.run();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
Expand All @@ -31,6 +32,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.rememberAsyncImagePainter
import io.sentry.Sentry
import io.sentry.compose.LocalSentrySpan
import io.sentry.compose.SentryModifier.sentryTag
import io.sentry.compose.SentryTraced

Expand All @@ -48,12 +50,23 @@ class StoreItemDetailActivity : ComponentActivity() {
Sentry.setAttribute("item.sku", storeItem.sku)
Sentry.metrics().count("product.viewed")

val activitySpan = Sentry.getSpan()

setContent {
MaterialTheme {
StoreItemDetailScreen(
storeItem = storeItem,
onBack = { finish() }
)
if (activitySpan != null) {
CompositionLocalProvider(LocalSentrySpan provides activitySpan) {
StoreItemDetailScreen(
storeItem = storeItem,
onBack = { finish() }
)
}
} else {
StoreItemDetailScreen(
storeItem = storeItem,
onBack = { finish() }
)
}
}
}
}
Expand Down
Loading