Skip download notes when loading notes url

This commit is contained in:
vvb2060 2021-01-25 03:47:59 +08:00 committed by topjohnwu
parent 8f08ae59ac
commit 4cc41eccb3

View File

@ -67,12 +67,14 @@ class InstallViewModel(
try {
val context = get<Context>()
File(context.cacheDir, "${BuildConfig.VERSION_CODE}.md").run {
notes = if (exists())
readText()
else {
val text = svc.fetchString(Const.Url.CHANGELOG_URL)
writeText(text)
text
notes = when {
exists() -> readText()
Const.Url.CHANGELOG_URL.isEmpty() -> ""
else -> {
val text = svc.fetchString(Const.Url.CHANGELOG_URL)
writeText(text)
text
}
}
}
} catch (e: IOException) {