Files
v2rayNG/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AngApplication.kt
T
2023-01-12 14:35:38 +08:00

29 lines
863 B
Kotlin

package com.v2ray.ang
import androidx.multidex.MultiDexApplication
import androidx.preference.PreferenceManager
import com.tencent.mmkv.MMKV
class AngApplication : MultiDexApplication() {
companion object {
const val PREF_LAST_VERSION = "pref_last_version"
}
var firstRun = false
private set
override fun onCreate() {
super.onCreate()
// LeakCanary.install(this)
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
firstRun = defaultSharedPreferences.getInt(PREF_LAST_VERSION, 0) != BuildConfig.VERSION_CODE
if (firstRun)
defaultSharedPreferences.edit().putInt(PREF_LAST_VERSION, BuildConfig.VERSION_CODE).apply()
//Logger.init().logLevel(if (BuildConfig.DEBUG) LogLevel.FULL else LogLevel.NONE)
MMKV.initialize(this)
}
}