From 8a2872afa48a1e02d58d8766df92247d96828508 Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Fri, 25 Oct 2019 17:46:20 +0200 Subject: [PATCH] Removed pre-download while installing magisk --- .../magisk/redesign/home/HomeViewModel.kt | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt index 26adc56dd..b8cfc0935 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt @@ -7,12 +7,10 @@ import com.topjohnwu.magisk.R import com.topjohnwu.magisk.data.repository.MagiskRepository import com.topjohnwu.magisk.databinding.ComparableRvItem import com.topjohnwu.magisk.extensions.* -import com.topjohnwu.magisk.model.download.DownloadService import com.topjohnwu.magisk.model.download.RemoteFileService import com.topjohnwu.magisk.model.entity.MagiskJson import com.topjohnwu.magisk.model.entity.ManagerJson import com.topjohnwu.magisk.model.entity.UpdateInfo -import com.topjohnwu.magisk.model.entity.internal.Configuration import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.Magisk import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.Manager import com.topjohnwu.magisk.model.entity.recycler.HomeItem @@ -89,12 +87,6 @@ class HomeViewModel( is Manager -> stateManagerProgress.value = it.first.times(100f).roundToInt() } } - - stateMagiskProgress.addOnPropertyChangedCallback { - if (it == 100) { - Navigation.install().publish() - } - } } override fun refresh() = repoMagisk.fetchUpdate() @@ -139,18 +131,12 @@ class HomeViewModel( fun onManagerPressed() = ManagerInstallDialog().publish() - fun onMagiskPressed() { - withPermissions( - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE - ).map { check(it);it }.subscribeK { - //pre-fix so user doesn't click twice accidentally - stateMagiskProgress.value = 1 - DownloadService(get()) { - subject = Magisk(Configuration.Download) - } - }.add() - } + fun onMagiskPressed() = withPermissions( + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE + ).map { check(it);it } + .subscribeK { Navigation.install().publish() } + .add() private fun ensureEnv() { val invalidStates = listOf(