diff options
author | Allan Wang <me@allanwang.ca> | 2019-07-27 21:50:56 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-07-27 21:50:56 -0700 |
commit | 1796aa0ee637c3fd65eb58392a287ea0abdd6e70 (patch) | |
tree | e2ddcb376d37eeff4ad857e179eff92d8200ae36 /app | |
parent | d746e687b217d03c7b03beed3763e7503358de74 (diff) | |
download | frost-1796aa0ee637c3fd65eb58392a287ea0abdd6e70.tar.gz frost-1796aa0ee637c3fd65eb58392a287ea0abdd6e70.tar.bz2 frost-1796aa0ee637c3fd65eb58392a287ea0abdd6e70.zip |
Disable auto session capture until analytics is disabled
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt | 36 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt | 21 | ||||
-rw-r--r-- | app/src/main/play/en-US/whatsnew | 3 |
3 files changed, 40 insertions, 20 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt index 0c762b41..65f7f495 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt @@ -25,6 +25,7 @@ import android.widget.ImageView import ca.allanwang.kau.logging.KL import ca.allanwang.kau.utils.buildIsLollipopAndUp import com.bugsnag.android.Bugsnag +import com.bugsnag.android.Configuration import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.signature.ApplicationVersionSignature import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader @@ -92,8 +93,12 @@ class FrostApp : Application() { Prefs.verboseLogging = false L.i { "Begin Frost for Facebook" } FrostPglAdBlock.init(this) - if (Prefs.installDate == -1L) Prefs.installDate = System.currentTimeMillis() - if (Prefs.identifier == -1) Prefs.identifier = Random().nextInt(Int.MAX_VALUE) + if (Prefs.installDate == -1L) { + Prefs.installDate = System.currentTimeMillis() + } + if (Prefs.identifier == -1) { + Prefs.identifier = Random().nextInt(Int.MAX_VALUE) + } Prefs.lastLaunch = System.currentTimeMillis() super.onCreate() @@ -137,25 +142,32 @@ class FrostApp : Application() { } }) startKoin { - if (BuildConfig.DEBUG) + if (BuildConfig.DEBUG) { androidLogger() + } androidContext(this@FrostApp) modules(FrostDatabase.module(this@FrostApp)) } } private fun initBugsnag() { - if (BuildConfig.DEBUG) return - Bugsnag.init(this) - Bugsnag.disableExceptionHandler() - if (!BuildConfig.APPLICATION_ID.startsWith("com.pitchedapps.frost")) return + if (BuildConfig.DEBUG) { + return + } + if (!BuildConfig.APPLICATION_ID.startsWith("com.pitchedapps.frost")) { + return + } val version = BuildUtils.match(BuildConfig.VERSION_NAME) ?: return L.d { "Bugsnag disabled for ${BuildConfig.VERSION_NAME}" } - Bugsnag.enableExceptionHandler() - Bugsnag.setNotifyReleaseStages(*BuildUtils.getAllStages()) - Bugsnag.setAppVersion(version.versionName) - Bugsnag.setReleaseStage(BuildUtils.getStage(BuildConfig.BUILD_TYPE)) - Bugsnag.setAutoCaptureSessions(true) + val config = Configuration("83cf680ed01a6fda10fe497d1c0962bb").apply { + enableExceptionHandler = true + appVersion = version.versionName + releaseStage = BuildUtils.getStage(BuildConfig.BUILD_TYPE) + notifyReleaseStages = BuildUtils.getAllStages() + autoCaptureSessions = Prefs.analytics + } + Bugsnag.init(this, config) + L.bugsnagInit = true Bugsnag.setUserId(Prefs.frostId) Bugsnag.addToTab("Build", "Application", BuildConfig.APPLICATION_ID) Bugsnag.addToTab("Build", "Version", BuildConfig.VERSION_NAME) 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 7c8c1895..6da4f598 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/L.kt @@ -41,28 +41,35 @@ object L : KauLogger("Frost", { } inline fun _i(message: () -> Any?) { - if (BuildConfig.DEBUG) + if (BuildConfig.DEBUG) { i(message) + } } inline fun _d(message: () -> Any?) { - if (BuildConfig.DEBUG) + if (BuildConfig.DEBUG) { d(message) + } } inline fun _e(e: Throwable?, message: () -> Any?) { - if (BuildConfig.DEBUG) + if (BuildConfig.DEBUG) { e(e, message) + } } + var bugsnagInit = false + override fun logImpl(priority: Int, message: String?, t: Throwable?) { - if (BuildConfig.DEBUG) + if (BuildConfig.DEBUG || !bugsnagInit || Prefs.analytics) { super.logImpl(priority, message, t) - else { - if (message != null) + } else { + if (message != null) { Bugsnag.leaveBreadcrumb(message) - if (t != null) + } + if (t != null) { Bugsnag.notify(t) + } } } } diff --git a/app/src/main/play/en-US/whatsnew b/app/src/main/play/en-US/whatsnew index 765565f1..d2b73404 100644 --- a/app/src/main/play/en-US/whatsnew +++ b/app/src/main/play/en-US/whatsnew @@ -1,4 +1,5 @@ v2.3.2 * Disable auto feed refresh by default and add setting to re-enable it -* Update theme
\ No newline at end of file +* Update theme +* Disable bugsnag completely when opting out of analytics
\ No newline at end of file |