From 4cc41eccb3695d97c450d6cfb158d1a00e993226 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Mon, 25 Jan 2021 03:47:59 +0800 Subject: [PATCH] Skip download notes when loading notes url --- .../magisk/ui/install/InstallViewModel.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt index b7bed34ba..42faaf998 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt @@ -67,12 +67,14 @@ class InstallViewModel( try { val context = get() 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) {