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

View File

@ -86,13 +86,14 @@ class SuperuserViewModel(
private fun updatePolicy(it: PolicyUpdateEvent) = when (it) {
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)
SnackbarEvent(text).publish()
}
is PolicyUpdateEvent.Log -> updatePolicy(it.item.item.copy(logging = it.shouldLog)) {
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)
SnackbarEvent(text).publish()
}