1
0
mirror of https://github.com/topjohnwu/Magisk.git synced 2025-03-29 08:42:16 +00:00

Fixed snackbar for changed su states being incorrect

This commit is contained in:
Viktor De Pasquale 2019-05-12 18:56:42 +02:00
parent 125ae0a173
commit 0e6c205732

@ -86,13 +86,14 @@ class SuperuserViewModel(
private fun updatePolicy(it: PolicyUpdateEvent) = when (it) { private fun updatePolicy(it: PolicyUpdateEvent) = when (it) {
is PolicyUpdateEvent.Notification -> updatePolicy(it.item.item.copy(notification = it.shouldNotify)) { is PolicyUpdateEvent.Notification -> updatePolicy(it.item.item.copy(notification = it.shouldNotify)) {
val textId = if (it.logging) R.string.su_snack_notif_on else R.string.su_snack_notif_off val textId =
if (it.notification) R.string.su_snack_notif_on else R.string.su_snack_notif_off
val text = resources.getString(textId).format(it.appName) val text = resources.getString(textId).format(it.appName)
SnackbarEvent(text).publish() SnackbarEvent(text).publish()
} }
is PolicyUpdateEvent.Log -> updatePolicy(it.item.item.copy(logging = it.shouldLog)) { is PolicyUpdateEvent.Log -> updatePolicy(it.item.item.copy(logging = it.shouldLog)) {
val textId = val textId =
if (it.notification) R.string.su_snack_log_on else R.string.su_snack_log_off if (it.logging) R.string.su_snack_log_on else R.string.su_snack_log_off
val text = resources.getString(textId).format(it.appName) val text = resources.getString(textId).format(it.appName)
SnackbarEvent(text).publish() SnackbarEvent(text).publish()
} }