From 1d54c5144ed6aa126eb002005c5cba01d6a31199 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 10 Jun 2019 21:25:42 -0700 Subject: [PATCH] Fix background update checks --- .../com/topjohnwu/magisk/model/update/UpdateCheckService.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.kt b/app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.kt index a69d5eef9..4792bb133 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.kt @@ -7,17 +7,20 @@ import com.topjohnwu.magisk.data.repository.MagiskRepository import com.topjohnwu.magisk.model.worker.DelegateWorker import com.topjohnwu.magisk.utils.inject import com.topjohnwu.magisk.view.Notifications +import com.topjohnwu.superuser.Shell class UpdateCheckService : DelegateWorker() { private val magiskRepo: MagiskRepository by inject() override fun doWork(): ListenableWorker.Result { + // Make sure shell initializer was ran + Shell.getShell() return runCatching { magiskRepo.fetchUpdate().blockingGet() if (BuildConfig.VERSION_CODE < Info.remoteManagerVersionCode) Notifications.managerUpdate() - else if (Info.magiskVersionCode < Info.remoteManagerVersionCode) + else if (Info.magiskVersionCode < Info.remoteMagiskVersionCode) Notifications.magiskUpdate() ListenableWorker.Result.success() }.getOrElse {