feat: fix Sentry disabling logic again

This commit is contained in:
Harsh Shandilya 2023-05-04 14:09:05 +05:30
parent 70ee848a41
commit b498cf4b62
No known key found for this signature in database
4 changed files with 18 additions and 22 deletions

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${sentryDsn}" />
</application>
</manifest>

View file

@ -163,5 +163,14 @@
<action android:name="androidx.profileinstaller.action.BENCHMARK_OPERATION" />
</intent-filter>
</receiver>
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${sentryDsn}" />
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="${enableSentry}" />
<meta-data android:name="io.sentry.breadcrumbs.user-interaction" android:value="${enableSentry}" />
<!-- enable screenshot for crashes -->
<meta-data android:name="io.sentry.attach-screenshot" android:value="${enableSentry}" />
<!-- enable view hierarchy for crashes -->
<meta-data android:name="io.sentry.attach-view-hierarchy" android:value="${enableSentry}" />
</application>
</manifest>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${sentryDsn}" />
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />
<meta-data android:name="io.sentry.breadcrumbs.user-interaction" android:value="true" />
<!-- enable screenshot for crashes -->
<meta-data android:name="io.sentry.attach-screenshot" android:value="true" />
<!-- enable view hierarchy for crashes -->
<meta-data android:name="io.sentry.attach-view-hierarchy" android:value="true" />
</application>
</manifest>

View file

@ -29,6 +29,15 @@ class SentryPlugin : Plugin<Project> {
val sentryDsn = project.providers.environmentVariable(SENTRY_DSN_PROPERTY)
variant.manifestPlaceholders.put("sentryDsn", sentryDsn.getOrElse(""))
}
onVariants(selector().withBuildType("benchmark")) { variant ->
variant.manifestPlaceholders.put("enableSentry", "false")
}
onVariants(selector().withBuildType("debug")) { variant ->
variant.manifestPlaceholders.put("enableSentry", "false")
}
onVariants(selector().withBuildType("release")) { variant ->
variant.manifestPlaceholders.put("enableSentry", "true")
}
}
project.plugins.apply(io.sentry.android.gradle.SentryPlugin::class)
project.extensions.configure<SentryPluginExtension> {