diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt | 2 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt | 5 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt index 65f7f495..a465eb7b 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt @@ -160,11 +160,11 @@ class FrostApp : Application() { val version = BuildUtils.match(BuildConfig.VERSION_NAME) ?: return L.d { "Bugsnag disabled for ${BuildConfig.VERSION_NAME}" } val config = Configuration("83cf680ed01a6fda10fe497d1c0962bb").apply { - enableExceptionHandler = true appVersion = version.versionName releaseStage = BuildUtils.getStage(BuildConfig.BUILD_TYPE) notifyReleaseStages = BuildUtils.getAllStages() autoCaptureSessions = Prefs.analytics + enableExceptionHandler = Prefs.analytics } Bugsnag.init(this, config) L.bugsnagInit = true diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt index e5dd30e3..dd8cf594 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt @@ -61,6 +61,11 @@ object L : KauLogger("Frost", { var bugsnagInit = false override fun logImpl(priority: Int, message: String?, t: Throwable?) { + /* + * Debug flag is constant and should help with optimization + * bugsnagInit is changed per application and helps prevent crashes (if calling pre init) + * analytics is changed by the user, and may be toggled throughout the app + */ if (BuildConfig.DEBUG || !bugsnagInit || !Prefs.analytics) { super.logImpl(priority, message, t) } else { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt index c11583d1..0885109a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt @@ -160,8 +160,10 @@ object Prefs : KPref() { var analytics: Boolean by kpref("analytics", false) { if (!BuildConfig.DEBUG) { if (it) { + Bugsnag.setAutoCaptureSessions(true) Bugsnag.enableExceptionHandler() } else { + Bugsnag.setAutoCaptureSessions(false) Bugsnag.disableExceptionHandler() } } |