Issues-2: Correct saving Config when not existing

This commit is contained in:
Mathieu Sanchez 2020-04-25 22:15:34 +02:00
parent 5b5a9c28f2
commit d316ede233

View File

@ -31,10 +31,10 @@ class ConfigDao(private val savePath: String) {
_config.value = Gson().fromJson(file.readText(Charsets.UTF_8), Config::class.java) _config.value = Gson().fromJson(file.readText(Charsets.UTF_8), Config::class.java)
_config.value?.versionCode = BuildConfig.VERSION_CODE _config.value?.versionCode = BuildConfig.VERSION_CODE
_config.value?.versionName = BuildConfig.VERSION_NAME _config.value?.versionName = BuildConfig.VERSION_NAME
save()
} else { } else {
_config.value = _config.value =
Config(BuildConfig.DB_VERSION, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE) Config(BuildConfig.DB_VERSION, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)
save()
} }
} }