Rename classes and fields

This commit is contained in:
topjohnwu
2020-08-21 06:45:40 -07:00
parent abc5457136
commit 1ed67eed35
14 changed files with 87 additions and 87 deletions
@@ -8,8 +8,8 @@ import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.*
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.download.DownloadSubject
import com.topjohnwu.magisk.core.download.DownloadSubject.Manager
import com.topjohnwu.magisk.core.download.Subject
import com.topjohnwu.magisk.core.download.Subject.Manager
import com.topjohnwu.magisk.core.model.MagiskJson
import com.topjohnwu.magisk.core.model.ManagerJson
import com.topjohnwu.magisk.data.repository.MagiskRepository
@@ -111,7 +111,7 @@ class HomeViewModel(
}
}.publish()
fun onProgressUpdate(progress: Float, subject: DownloadSubject) {
fun onProgressUpdate(progress: Float, subject: Subject) {
when (subject) {
is Manager -> stateManagerProgress = progress.times(100f).roundToInt()
}
@@ -8,9 +8,9 @@ import com.topjohnwu.magisk.BR
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.BaseViewModel
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.download.Configuration
import com.topjohnwu.magisk.core.download.Action
import com.topjohnwu.magisk.core.download.DownloadService
import com.topjohnwu.magisk.core.download.DownloadSubject
import com.topjohnwu.magisk.core.download.Subject
import com.topjohnwu.magisk.data.repository.StringRepository
import com.topjohnwu.magisk.events.RequestFileEvent
import com.topjohnwu.magisk.events.dialog.SecondSlotWarningDialog
@@ -64,8 +64,8 @@ class InstallViewModel(
}
}
fun onProgressUpdate(progress: Float, subject: DownloadSubject) {
if (subject !is DownloadSubject.Magisk) {
fun onProgressUpdate(progress: Float, subject: Subject) {
if (subject !is Subject.Magisk) {
return
}
this.progress = progress.times(100).roundToInt()
@@ -79,16 +79,16 @@ class InstallViewModel(
}
fun install() = DownloadService(get()) {
subject = DownloadSubject.Magisk(resolveConfiguration())
subject = Subject.Magisk(resolveConfiguration())
}.also { state = State.LOADING }
// ---
private fun resolveConfiguration() = when (method) {
R.id.method_download -> Configuration.Download
R.id.method_patch -> Configuration.Patch(data!!)
R.id.method_direct -> Configuration.Flash.Primary
R.id.method_inactive_slot -> Configuration.Flash.Secondary
R.id.method_download -> Action.Download
R.id.method_patch -> Action.Patch(data!!)
R.id.method_direct -> Action.Flash.Primary
R.id.method_inactive_slot -> Action.Flash.Secondary
else -> throw IllegalArgumentException("Unknown value")
}
}
@@ -7,7 +7,7 @@ import com.topjohnwu.magisk.BR
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.arch.*
import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.download.DownloadSubject
import com.topjohnwu.magisk.core.download.Subject
import com.topjohnwu.magisk.core.model.module.Module
import com.topjohnwu.magisk.core.tasks.RepoUpdater
import com.topjohnwu.magisk.data.database.RepoByNameDao
@@ -147,8 +147,8 @@ class ModuleViewModel(
// ---
fun onProgressUpdate(progress: Float, subject: DownloadSubject) {
if (subject !is DownloadSubject.Module)
fun onProgressUpdate(progress: Float, subject: Subject) {
if (subject !is Subject.Module)
return
viewModelScope.launch {
@@ -15,9 +15,9 @@ import com.topjohnwu.magisk.arch.diffListOf
import com.topjohnwu.magisk.arch.itemBindingOf
import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.download.Configuration
import com.topjohnwu.magisk.core.download.Action
import com.topjohnwu.magisk.core.download.DownloadService
import com.topjohnwu.magisk.core.download.DownloadSubject
import com.topjohnwu.magisk.core.download.Subject
import com.topjohnwu.magisk.core.utils.PatchAPK
import com.topjohnwu.magisk.data.database.RepoDao
import com.topjohnwu.magisk.events.AddHomeIconEvent
@@ -145,7 +145,7 @@ class SettingsViewModel(
private fun restoreManager() {
DownloadService(get()) {
subject = DownloadSubject.Manager(Configuration.APK.Restore)
subject = Subject.Manager(Action.APK.Restore)
}
}