1
mirror of https://github.com/topjohnwu/Magisk synced 2024-11-16 00:13:57 +01:00

Removed unnecessary code

This commit is contained in:
Viktor De Pasquale 2020-02-06 15:00:44 +01:00 committed by John Wu
parent 810468c279
commit db4ef1443d

View File

@ -21,7 +21,6 @@ import com.topjohnwu.magisk.model.events.dialog.EnvFixDialog
import com.topjohnwu.magisk.model.events.dialog.ManagerInstallDialog
import com.topjohnwu.magisk.model.events.dialog.UninstallDialog
import com.topjohnwu.magisk.model.navigation.Navigation
import com.topjohnwu.magisk.model.observer.Observer
import com.topjohnwu.magisk.ui.base.BaseViewModel
import com.topjohnwu.magisk.ui.base.itemBindingOf
import com.topjohnwu.magisk.utils.KObservableField
@ -46,22 +45,6 @@ class HomeViewModel(
val stateVersionManager = KObservableField("")
val stateCodeManager = KObservableField(0)
val stateCodeStub = KObservableField(0)
val stateTextMagisk = Observer(stateMagisk) {
when (stateMagisk.value) {
MagiskState.NOT_INSTALLED -> R.string.installed_error.res()
MagiskState.UP_TO_DATE -> R.string.up_to_date.res()
MagiskState.LOADING -> R.string.loading.res()
MagiskState.OBSOLETE -> R.string.obsolete.res()
}
}
val stateTextManager = Observer(stateManager) {
when (stateManager.value) {
MagiskState.NOT_INSTALLED -> R.string.channel_error.res()
MagiskState.UP_TO_DATE -> R.string.up_to_date.res()
MagiskState.LOADING -> R.string.loading.res()
MagiskState.OBSOLETE -> R.string.obsolete.res()
}
}
val statePackageManager = packageName
val statePackageOriginal = statePackageManager == BuildConfig.APPLICATION_ID
@ -170,12 +153,6 @@ class HomeViewModel(
}
}
private fun String.clipVersion(other: String = ""): String {
val thisVersion = substringBefore('-')
val otherVersion = other.substringBefore('-')
return if (thisVersion != otherVersion) thisVersion else substringAfter('-')
}
}
@Suppress("unused")