1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Disable auto session capture until analytics is disabled

This commit is contained in:
Allan Wang 2019-07-27 21:50:56 -07:00
parent d746e687b2
commit 1796aa0ee6
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
4 changed files with 41 additions and 20 deletions

View File

@ -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)

View File

@ -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)
}
}
}
}

View File

@ -1,4 +1,5 @@
v2.3.2
* Disable auto feed refresh by default and add setting to re-enable it
* Update theme
* Update theme
* Disable bugsnag completely when opting out of analytics

View File

@ -3,6 +3,7 @@
## v2.3.2
* Disable auto feed refresh by default and add setting to re-enable it
* Update theme
* Disable bugsnag completely when opting out of analytics
## v2.3.1
* Hide all story panels if enabled