Fixed not showing current version

Current version was not displaying under circumstances that involve loss of connection. Versions are displayed whether the device is connected or not.
This commit is contained in:
Viktor De Pasquale 2019-08-07 07:23:29 +02:00 committed by John Wu
parent 870efc49ea
commit 3c7ece1605

View File

@ -160,6 +160,15 @@ class HomeViewModel(
}
fun refresh() {
magiskCurrentVersion.value = if (magiskState.value != MagiskState.NOT_INSTALLED) {
version.format(Info.magiskVersionString, Info.magiskVersionCode)
} else {
""
}
managerCurrentVersion.value = version
.format(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)
magiskRepo.fetchUpdate()
.applyViewModel(this)
.doOnSubscribeUi {
@ -185,12 +194,6 @@ class HomeViewModel(
else -> MagiskState.UP_TO_DATE
}
magiskCurrentVersion.value = if (magiskState.value != MagiskState.NOT_INSTALLED) {
version.format(Info.magiskVersionString, Info.magiskVersionCode)
} else {
""
}
magiskLatestVersion.value = version
.format(Info.remote.magisk.version, Info.remote.magisk.versionCode)
@ -200,9 +203,6 @@ class HomeViewModel(
else -> MagiskState.UP_TO_DATE
}
managerCurrentVersion.value = version
.format(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)
managerLatestVersion.value = version
.format(Info.remote.app.version, Info.remote.app.versionCode)
}