2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] Fixes https://github.com/mozilla-mobile/fenix/issues/1219: Display crash reporter (without reporting) on all builds

This commit is contained in:
Sawyer Blatz 2019-03-27 11:04:00 -07:00 committed by Colin Lee
parent 2d060abb23
commit c0e546a533
3 changed files with 19 additions and 16 deletions

View File

@ -91,13 +91,6 @@ open class FenixApplication : Application() {
}
private fun setupCrashReporting() {
@Suppress("ConstantConditionIf")
if (!BuildConfig.CRASH_REPORTING || BuildConfig.BUILD_TYPE != "release") {
// Only enable crash reporting if this is a release build and if crash reporting was explicitly enabled
// via a Gradle command line flag.
return
}
components
.analytics
.crashReporter

View File

@ -9,6 +9,7 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import mozilla.components.lib.crash.CrashReporter
import mozilla.components.lib.crash.service.CrashReporterService
import mozilla.components.lib.crash.service.MozillaSocorroService
import mozilla.components.lib.crash.service.SentryService
import org.mozilla.fenix.BuildConfig
@ -28,14 +29,21 @@ class Analytics(
private val context: Context
) {
val crashReporter: CrashReporter by lazy {
val sentryService = SentryService(
context,
BuildConfig.SENTRY_TOKEN,
tags = mapOf("geckoview" to "$MOZ_APP_VERSION-$MOZ_APP_BUILDID"),
sendEventForNativeCrashes = true
)
var services = listOf<CrashReporterService>()
val socorroService = MozillaSocorroService(context, "Fenix")
if (!BuildConfig.SENTRY_TOKEN.isNullOrEmpty()) {
val sentryService = SentryService(
context,
BuildConfig.SENTRY_TOKEN,
tags = mapOf("geckoview" to "$MOZ_APP_VERSION-$MOZ_APP_BUILDID"),
sendEventForNativeCrashes = true
)
services += sentryService
}
val socorroService = MozillaSocorroService(context, context.getString(R.string.app_name))
services += socorroService
val intent = Intent(context, HomeActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
@ -49,7 +57,7 @@ class Analytics(
)
CrashReporter(
services = listOf(sentryService, socorroService),
services = services,
shouldPrompt = CrashReporter.Prompt.ALWAYS,
promptConfiguration = CrashReporter.PromptConfiguration(
appName = context.getString(R.string.app_name),

View File

@ -8,6 +8,7 @@ import android.content.Context
import android.content.SharedPreferences
import android.preference.PreferenceManager
import mozilla.components.feature.sitepermissions.SitePermissionsRules
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.getPreferenceKey
import java.security.InvalidParameterException
@ -42,7 +43,8 @@ class Settings private constructor(context: Context) {
get() = preferences.getString(appContext.getPreferenceKey(R.string.pref_key_search_engine), "") ?: ""
val isCrashReportingEnabled: Boolean
get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_crash_reporter), true)
get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_crash_reporter), true) &&
BuildConfig.CRASH_REPORTING && BuildConfig.BUILD_TYPE == "release"
val isRemoteDebuggingEnabled: Boolean
get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_remote_debugging), false)