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 { try {
val context = get<Context>() val context = get<Context>()
File(context.cacheDir, "${BuildConfig.VERSION_CODE}.md").run { File(context.cacheDir, "${BuildConfig.VERSION_CODE}.md").run {
notes = if (exists()) notes = when {
readText() exists() -> readText()
else { Const.Url.CHANGELOG_URL.isEmpty() -> ""
val text = svc.fetchString(Const.Url.CHANGELOG_URL) else -> {
writeText(text) val text = svc.fetchString(Const.Url.CHANGELOG_URL)
text writeText(text)
text
}
} }
} }
} catch (e: IOException) { } catch (e: IOException) {