2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-05 21:20:45 +00:00

CrashReporter: Set release channel specific sentry project URL.

This commit is contained in:
Sebastian Kaspari 2020-05-20 18:51:56 +02:00 committed by Mihai Adrian
parent 2dfd833941
commit b666fbe3fe

View File

@ -14,8 +14,10 @@ import mozilla.components.lib.crash.service.GleanCrashReporterService
import mozilla.components.lib.crash.service.MozillaSocorroService
import mozilla.components.lib.crash.service.SentryService
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.ReleaseChannel
import org.mozilla.fenix.components.metrics.AdjustMetricsService
import org.mozilla.fenix.components.metrics.GleanMetricsService
import org.mozilla.fenix.components.metrics.LeanplumMetricsService
@ -43,7 +45,8 @@ class Analytics(
BuildConfig.SENTRY_TOKEN,
tags = mapOf("geckoview" to "$MOZ_APP_VERSION-$MOZ_APP_BUILDID"),
environment = BuildConfig.BUILD_TYPE,
sendEventForNativeCrashes = true
sendEventForNativeCrashes = true,
sentryProjectUrl = getSentryProjectUrl()
)
services.add(sentryService)
@ -94,4 +97,17 @@ class Analytics(
}
}
fun isSentryEnabled() = !BuildConfig.SENTRY_TOKEN.isNullOrEmpty()
private fun isSentryEnabled() = !BuildConfig.SENTRY_TOKEN.isNullOrEmpty()
private fun getSentryProjectUrl(): String? {
val baseUrl = "https://sentry.prod.mozaws.net/operations"
return when (Config.channel) {
ReleaseChannel.FenixProduction -> "$baseUrl/fenix"
ReleaseChannel.FenixBeta -> "$baseUrl/fenix-beta"
ReleaseChannel.FenixNightly -> "$baseUrl/fenix-nightly"
ReleaseChannel.FennecProduction -> "$baseUrl/fenix-fennec"
ReleaseChannel.FennecBeta -> "$baseUrl/fenix-fennec-beta"
ReleaseChannel.FennecNightly -> "$baseUrl/fenix-fennec-nightly"
else -> null
}
}