Skip to content

Commit

Permalink
Update Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
sdsantos committed Nov 13, 2024
1 parent 3dfd248 commit d338137
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ import org.ooni.probe.data.repositories.PreferenceRepository
class CrashMonitoring(
private val preferencesRepository: PreferenceRepository,
) {
private var isEnabled = false

suspend fun setup() {
preferencesRepository.getValueByKey(SettingsKey.SEND_CRASH)
.onEach { sendCrash ->
if (sendCrash == true) {
Sentry.init {
it.dsn = SENTRY_DSN
}
isEnabled = true
} else {
isEnabled = false
Sentry.close()
}
}
Expand All @@ -35,17 +31,17 @@ class CrashMonitoring(
override fun isLoggable(
tag: String,
severity: Severity,
): Boolean = isEnabled && severity != Severity.Verbose
): Boolean = Sentry.isEnabled() && severity != Severity.Verbose

override fun log(
severity: Severity,
message: String,
tag: String,
throwable: Throwable?,
) {
if (!isEnabled) return
if (!Sentry.isEnabled()) return

if (severity == Severity.Error) {
if (severity == Severity.Warn || severity == Severity.Error) {
if (throwable != null) {
addBreadcrumb(severity, message, tag)
Sentry.captureException(throwable)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ kottie = { module = "io.github.alexzhirkevich:compottie", version = "2.0.0-rc01"
moko-permissions = { module ="dev.icerock.moko:permissions-compose", version = "0.18.0" }

# Crash Reporting
sentry = { module = "io.sentry:sentry-kotlin-multiplatform", version = "0.9.0" }
sentry = { module = "io.sentry:sentry-kotlin-multiplatform", version = "0.10.0" }

# Markdown
markdown = { module = "com.mikepenz:multiplatform-markdown-renderer-m3", version = "0.26.0" }
Expand Down

0 comments on commit d338137

Please sign in to comment.