Rename method

This commit is contained in:
topjohnwu 2020-08-28 04:50:46 -07:00
parent 01efe7a4ea
commit 6bd4006652
7 changed files with 10 additions and 8 deletions

View File

@ -100,7 +100,7 @@ open class DownloadService : BaseDownloader() {
}
}
operator fun invoke(context: Context, subject: Subject) {
fun start(context: Context, subject: Subject) {
val app = context.applicationContext
if (Build.VERSION.SDK_INT >= 26) {
app.startForegroundService(intent(app, subject))

View File

@ -31,7 +31,7 @@ class EnvFixDialog : DialogEvent() {
lbm.unregisterReceiver(this)
}
}, IntentFilter(DISMISS))
DownloadService(dialog.context, Magisk(EnvFix))
DownloadService.start(dialog.context, Magisk(EnvFix))
}
}
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {

View File

@ -25,7 +25,7 @@ class ManagerInstallDialog : DialogEvent() {
applyButton(MagiskDialog.ButtonType.POSITIVE) {
titleRes = R.string.install
onClick { DownloadService(context, subject) }
onClick { DownloadService.start(context, subject) }
}
if (Info.remote.app.note.isEmpty()) return

View File

@ -15,7 +15,7 @@ class ModuleInstallDialog(private val item: Repo) : DialogEvent() {
fun download(install: Boolean) {
val config = if (install) Action.Flash.Primary else Action.Download
val subject = Subject.Module(item, config)
DownloadService(context, subject)
DownloadService.start(context, subject)
}
applyTitle(context.getString(R.string.repo_install_title, item.name))

View File

@ -47,7 +47,7 @@ class UninstallDialog : DialogEvent() {
}
private fun completeUninstall() {
DownloadService(dialog.context, Subject.Magisk(Action.Uninstall))
DownloadService.start(dialog.context, Subject.Magisk(Action.Uninstall))
}
}

View File

@ -78,8 +78,10 @@ class InstallViewModel(
step = nextStep
}
fun install() =
DownloadService(get(), Subject.Magisk(resolveAction())).also { state = State.LOADING }
fun install() {
DownloadService.start(get(), Subject.Magisk(resolveAction()))
state = State.LOADING
}
// ---

View File

@ -145,7 +145,7 @@ class SettingsViewModel(
}
private fun restoreManager() {
DownloadService(get(), Subject.Manager(Action.APK.Restore))
DownloadService.start(get(), Subject.Manager(Action.APK.Restore))
}
}