Commit 8a2872af authored by Viktor De Pasquale's avatar Viktor De Pasquale

Removed pre-download while installing magisk

parent 85941c47
...@@ -7,12 +7,10 @@ import com.topjohnwu.magisk.R ...@@ -7,12 +7,10 @@ import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.data.repository.MagiskRepository import com.topjohnwu.magisk.data.repository.MagiskRepository
import com.topjohnwu.magisk.databinding.ComparableRvItem import com.topjohnwu.magisk.databinding.ComparableRvItem
import com.topjohnwu.magisk.extensions.* import com.topjohnwu.magisk.extensions.*
import com.topjohnwu.magisk.model.download.DownloadService
import com.topjohnwu.magisk.model.download.RemoteFileService import com.topjohnwu.magisk.model.download.RemoteFileService
import com.topjohnwu.magisk.model.entity.MagiskJson import com.topjohnwu.magisk.model.entity.MagiskJson
import com.topjohnwu.magisk.model.entity.ManagerJson import com.topjohnwu.magisk.model.entity.ManagerJson
import com.topjohnwu.magisk.model.entity.UpdateInfo 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.Magisk
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.Manager import com.topjohnwu.magisk.model.entity.internal.DownloadSubject.Manager
import com.topjohnwu.magisk.model.entity.recycler.HomeItem import com.topjohnwu.magisk.model.entity.recycler.HomeItem
...@@ -89,12 +87,6 @@ class HomeViewModel( ...@@ -89,12 +87,6 @@ class HomeViewModel(
is Manager -> stateManagerProgress.value = it.first.times(100f).roundToInt() is Manager -> stateManagerProgress.value = it.first.times(100f).roundToInt()
} }
} }
stateMagiskProgress.addOnPropertyChangedCallback {
if (it == 100) {
Navigation.install().publish()
}
}
} }
override fun refresh() = repoMagisk.fetchUpdate() override fun refresh() = repoMagisk.fetchUpdate()
...@@ -139,18 +131,12 @@ class HomeViewModel( ...@@ -139,18 +131,12 @@ class HomeViewModel(
fun onManagerPressed() = ManagerInstallDialog().publish() fun onManagerPressed() = ManagerInstallDialog().publish()
fun onMagiskPressed() { fun onMagiskPressed() = withPermissions(
withPermissions(
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE Manifest.permission.WRITE_EXTERNAL_STORAGE
).map { check(it);it }.subscribeK { ).map { check(it);it }
//pre-fix so user doesn't click twice accidentally .subscribeK { Navigation.install().publish() }
stateMagiskProgress.value = 1 .add()
DownloadService(get()) {
subject = Magisk(Configuration.Download)
}
}.add()
}
private fun ensureEnv() { private fun ensureEnv() {
val invalidStates = listOf( val invalidStates = listOf(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment