From 25c64db0a137d503bbccf18d5f1401981ae05643 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 24 Oct 2019 03:54:16 -0400 Subject: [PATCH] Treat outdated stub as outdated manager --- .../com/topjohnwu/magisk/ui/home/HomeViewModel.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt index 6db20f535..4c6f7e32b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt @@ -216,7 +216,7 @@ class HomeViewModel( private fun updateSelf() { magiskState.value = when (Info.env.magiskVersionCode) { in Int.MIN_VALUE until 0 -> MagiskState.NOT_INSTALLED - !in Info.remote.magisk.versionCode..Int.MAX_VALUE -> MagiskState.OBSOLETE + in 1 until (Info.remote.magisk.versionCode - 1) -> MagiskState.OBSOLETE else -> MagiskState.UP_TO_DATE } @@ -225,8 +225,13 @@ class HomeViewModel( _managerState.value = when (Info.remote.app.versionCode) { in Int.MIN_VALUE until 0 -> MagiskState.NOT_INSTALLED //wrong update channel - in (BuildConfig.VERSION_CODE + 1)..Int.MAX_VALUE -> MagiskState.OBSOLETE - else -> MagiskState.UP_TO_DATE + in (BuildConfig.VERSION_CODE + 1) until Int.MAX_VALUE -> MagiskState.OBSOLETE + else -> { + if (isRunningAsStub && ClassMap.data!!.version < Info.remote.stub.versionCode) + MagiskState.OBSOLETE + else + MagiskState.UP_TO_DATE + } } managerLatestVersion.value = MGR_VER_FMT