mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 08:17:40 +00:00
Fix background update checks
This commit is contained in:
parent
e40d4318fa
commit
1d54c5144e
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user