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,14 +67,16 @@ 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() -> ""
else -> {
val text = svc.fetchString(Const.Url.CHANGELOG_URL) val text = svc.fetchString(Const.Url.CHANGELOG_URL)
writeText(text) writeText(text)
text text
} }
} }
}
} catch (e: IOException) { } catch (e: IOException) {
Timber.e(e) Timber.e(e)
} }