summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-03-13 17:41:01 +0530
committerGitHub <noreply@github.com>2022-03-13 12:11:01 +0000
commit861ca58a58675e5f063072b7f31e8cefeaaeaed5 (patch)
tree1f886ec49d4742be01747d8590aa7d3edd4a7499 /app/src/main
parent20725219bdc482480ad7130cd2b3829ae24384a8 (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/src/main')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/Application.kt13
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/features/Feature.kt5
2 files changed, 18 insertions, 0 deletions
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()
+ }
}