aboutsummaryrefslogtreecommitdiff
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
parent89673894356e29ac48ebaba5bd75d03690da1d66 (diff)
downloadfrost-68358b43505347f987e2c690595810b806a66c2e.tar.gz
frost-68358b43505347f987e2c690595810b806a66c2e.tar.bz2
frost-68358b43505347f987e2c690595810b806a66c2e.zip
Add random user identifier
-rw-r--r--.idea/misc.xml2
-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
3 files changed, 16 insertions, 5 deletions
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 8449ce70..7e0fe393 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -121,7 +121,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
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] }