diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-03-13 17:41:01 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-13 12:11:01 +0000 |
commit | 861ca58a58675e5f063072b7f31e8cefeaaeaed5 (patch) | |
tree | 1f886ec49d4742be01747d8590aa7d3edd4a7499 /app | |
parent | 20725219bdc482480ad7130cd2b3829ae24384a8 (diff) |
Configure Sentry with more information (#1782)
* build-logic: remove error path in Sentry plugin
* gradle: fix UnstableApiUsage warning
* build-logic: configure Sentry Gradle Plugin
* app: set traces sample-rate to 1.0
* sentry-stub: init
* app: populate Sentry user field with feature flags
Diffstat (limited to 'app')
-rw-r--r-- | app/build.gradle.kts | 1 | ||||
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/Application.kt | 13 | ||||
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/util/features/Feature.kt | 5 | ||||
-rw-r--r-- | app/src/nonFree/AndroidManifest.xml | 2 |
4 files changed, 20 insertions, 1 deletions
diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b3414460..ff09a750 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -101,6 +101,7 @@ dependencies { debugImplementation(libs.thirdparty.leakcanary) add("nonFreeImplementation", libs.thirdparty.nonfree.googlePlayAuthApiPhone) add("nonFreeImplementation", libs.thirdparty.nonfree.sentry) + add("freeImplementation", projects.sentryStub) androidTestImplementation(libs.bundles.testDependencies) androidTestImplementation(libs.bundles.androidTestDependencies) diff --git a/app/src/main/java/dev/msfjarvis/aps/Application.kt b/app/src/main/java/dev/msfjarvis/aps/Application.kt index 1a72655b..0c7def1c 100644 --- a/app/src/main/java/dev/msfjarvis/aps/Application.kt +++ b/app/src/main/java/dev/msfjarvis/aps/Application.kt @@ -15,11 +15,15 @@ import dagger.hilt.android.HiltAndroidApp import dev.msfjarvis.aps.injection.context.FilesDirPath import dev.msfjarvis.aps.injection.prefs.SettingsPreferences import dev.msfjarvis.aps.util.extensions.getString +import dev.msfjarvis.aps.util.features.Feature +import dev.msfjarvis.aps.util.features.Features import dev.msfjarvis.aps.util.git.sshj.setUpBouncyCastleForSshj import dev.msfjarvis.aps.util.proxy.ProxyUtils import dev.msfjarvis.aps.util.settings.GitSettings import dev.msfjarvis.aps.util.settings.PreferenceKeys import dev.msfjarvis.aps.util.settings.runMigrations +import io.sentry.Sentry +import io.sentry.protocol.User import javax.inject.Inject import logcat.AndroidLogcatLogger import logcat.LogPriority.DEBUG @@ -33,6 +37,7 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere @Inject @FilesDirPath lateinit var filesDirPath: String @Inject lateinit var proxyUtils: ProxyUtils @Inject lateinit var gitSettings: GitSettings + @Inject lateinit var features: Features override fun onCreate() { super.onCreate() @@ -48,6 +53,14 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere runMigrations(filesDirPath, prefs, gitSettings) proxyUtils.setDefaultProxy() DynamicColors.applyToActivitiesIfAvailable(this) + Sentry.configureScope { scope -> + val user = User() + user.others = + Feature.VALUES.associate { feature -> + "features.${feature.configKey}" to features.isEnabled(feature).toString() + } + scope.user = user + } } override fun onTerminate() { diff --git a/app/src/main/java/dev/msfjarvis/aps/util/features/Feature.kt b/app/src/main/java/dev/msfjarvis/aps/util/features/Feature.kt index 7ae2e642..4eef003d 100644 --- a/app/src/main/java/dev/msfjarvis/aps/util/features/Feature.kt +++ b/app/src/main/java/dev/msfjarvis/aps/util/features/Feature.kt @@ -15,4 +15,9 @@ enum class Feature( /** Opt into the new PGP backend powered by the PGPainless library. */ EnablePGPainlessBackend(false, "enable_pgp_v2_backend"), + ; + + companion object { + @JvmField val VALUES = values() + } } diff --git a/app/src/nonFree/AndroidManifest.xml b/app/src/nonFree/AndroidManifest.xml index 2f8d2746..83103b18 100644 --- a/app/src/nonFree/AndroidManifest.xml +++ b/app/src/nonFree/AndroidManifest.xml @@ -6,6 +6,6 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application> <meta-data android:name="io.sentry.dsn" android:value="${sentryDsn}" /> - <meta-data android:name="io.sentry.traces.sample-rate" android:value="0.0" /> + <meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" /> </application> </manifest> |