forked from github/szkolny
[App] Change companion values to lateinit.
This commit is contained in:
parent
07561c6484
commit
3eb99a4bf5
@ -51,8 +51,8 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
companion object {
|
companion object {
|
||||||
@Volatile
|
@Volatile
|
||||||
lateinit var db: AppDb
|
lateinit var db: AppDb
|
||||||
val config: Config by lazy { Config(db) }
|
lateinit var config: Config
|
||||||
var profile: Profile by mutableLazy { Profile(0, 0, 0, "") }
|
lateinit var profile: Profile
|
||||||
val profileId
|
val profileId
|
||||||
get() = profile.id
|
get() = profile.id
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
.readTimeout(30, TimeUnit.SECONDS)
|
.readTimeout(30, TimeUnit.SECONDS)
|
||||||
builder.installHttpsSupport(this)
|
builder.installHttpsSupport(this)
|
||||||
|
|
||||||
if (devMode || BuildConfig.DEBUG) {
|
if (devMode) {
|
||||||
HyperLog.initialize(this)
|
HyperLog.initialize(this)
|
||||||
HyperLog.setLogLevel(Log.VERBOSE)
|
HyperLog.setLogLevel(Log.VERBOSE)
|
||||||
HyperLog.setLogFormat(DebugLogFormat(this))
|
HyperLog.setLogFormat(DebugLogFormat(this))
|
||||||
@ -158,23 +158,25 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
.errorActivity(CrashActivity::class.java)
|
.errorActivity(CrashActivity::class.java)
|
||||||
.apply()
|
.apply()
|
||||||
Iconics.init(applicationContext)
|
Iconics.init(applicationContext)
|
||||||
|
|
||||||
|
// initialize companion object values
|
||||||
App.db = AppDb(this)
|
App.db = AppDb(this)
|
||||||
Themes.themeInt = config.ui.theme
|
App.config = Config(App.db)
|
||||||
devMode = config.debugMode
|
App.profile = Profile(0, 0, 0, "")
|
||||||
MHttp.instance().customOkHttpClient(http)
|
debugMode = BuildConfig.DEBUG
|
||||||
|
devMode = config.debugMode || debugMode
|
||||||
|
|
||||||
if (!profileLoadById(config.lastProfileId)) {
|
if (!profileLoadById(config.lastProfileId)) {
|
||||||
db.profileDao().firstId?.let { profileLoadById(it) }
|
db.profileDao().firstId?.let { profileLoadById(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MHttp.instance().customOkHttpClient(http)
|
||||||
|
|
||||||
|
Themes.themeInt = config.ui.theme
|
||||||
config.ui.language?.let {
|
config.ui.language?.let {
|
||||||
setLanguage(it)
|
setLanguage(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
debugMode = BuildConfig.DEBUG
|
|
||||||
if (BuildConfig.DEBUG)
|
|
||||||
devMode = true
|
|
||||||
|
|
||||||
Signing.getCert(this)
|
Signing.getCert(this)
|
||||||
|
|
||||||
launch {
|
launch {
|
||||||
@ -183,7 +185,6 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
|
|
||||||
if (config.devModePassword != null)
|
if (config.devModePassword != null)
|
||||||
checkDevModePassword()
|
checkDevModePassword()
|
||||||
devMode = debugMode || config.debugMode
|
|
||||||
|
|
||||||
if (config.sync.enabled)
|
if (config.sync.enabled)
|
||||||
SyncWorker.scheduleNext(this@App, false)
|
SyncWorker.scheduleNext(this@App, false)
|
||||||
|
Loading…
Reference in New Issue
Block a user