Commit 0e6c2057 authored by Viktor De Pasquale's avatar Viktor De Pasquale

Fixed snackbar for changed su states being incorrect

parent 125ae0a1
...@@ -86,13 +86,14 @@ class SuperuserViewModel( ...@@ -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()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment