aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-20 22:51:30 -0700
committerAllan Wang <me@allanwang.ca>2017-06-20 22:51:30 -0700
commit68358b43505347f987e2c690595810b806a66c2e (patch)
tree8e68134f47140938b60b56ab2f7c07489cb2e281 /app/src/main/kotlin/com
parent89673894356e29ac48ebaba5bd75d03690da1d66 (diff)
downloadfrost-68358b43505347f987e2c690595810b806a66c2e.tar.gz
frost-68358b43505347f987e2c690595810b806a66c2e.tar.bz2
frost-68358b43505347f987e2c690595810b806a66c2e.zip
Add random user identifier
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt6
2 files changed, 15 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
index dc9f0c11..d21915e7 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
@@ -20,6 +20,7 @@ import com.raizlabs.android.dbflow.config.FlowManager
import io.fabric.sdk.android.Fabric
import timber.log.Timber
import timber.log.Timber.DebugTree
+import java.util.*
/**
@@ -34,18 +35,24 @@ class FrostApp : Application() {
// lateinit var refWatcher: RefWatcher
override fun onCreate() {
+ FlowManager.init(FlowConfig.Builder(this).build())
+ Prefs.initialize(this, "${BuildConfig.APPLICATION_ID}.prefs")
+ FbCookie()
+ if (Prefs.installDate == -1L) {
+ Prefs.installDate = System.currentTimeMillis()
+ Prefs.identifier = Random().nextInt(Int.MAX_VALUE)
+ }
// if (LeakCanary.isInAnalyzerProcess(this)) return
// refWatcher = LeakCanary.install(this)
if (BuildConfig.DEBUG) {
Timber.plant(DebugTree())
// LeakCanary.enableDisplayLeakActivity(this)
} else {
+ Crashlytics.setUserIdentifier("${Prefs.installDate}-${Prefs.identifier}")
Fabric.with(this, Crashlytics(), Answers())
Timber.plant(CrashReportingTree())
}
- FlowManager.init(FlowConfig.Builder(this).build())
- Prefs.initialize(this, "${BuildConfig.APPLICATION_ID}.prefs")
- FbCookie()
+
super.onCreate()
//Drawer profile loading logic
DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
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 cda259b2..9f37ff2e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -33,7 +33,11 @@ object Prefs : KPref() {
var notificationFreq: Long by kpref("notification_freq", -1L)
- var versionCode:Int by kpref("version_code", -1)
+ var versionCode: Int by kpref("version_code", -1)
+
+ var installDate: Long by kpref("install_date", -1L)
+
+ var identifier: Int by kpref("indentifier", -1)
private val loader = lazyResettable { Theme.values[Prefs.theme] }