mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Ask for user confirmation before deleting Widget
This commit is contained in:
parent
5340d16e1f
commit
d52e61413d
1 changed files with 4 additions and 4 deletions
|
@ -160,7 +160,7 @@ class WidgetFragment @Inject constructor() :
|
||||||
return@withState true
|
return@withState true
|
||||||
}
|
}
|
||||||
R.id.action_delete -> {
|
R.id.action_delete -> {
|
||||||
viewModel.handle(WidgetAction.DeleteWidget)
|
deleteWidget()
|
||||||
return@withState true
|
return@withState true
|
||||||
}
|
}
|
||||||
R.id.action_refresh -> if (state.formattedURL.complete) {
|
R.id.action_refresh -> if (state.formattedURL.complete) {
|
||||||
|
@ -172,7 +172,7 @@ class WidgetFragment @Inject constructor() :
|
||||||
return@withState true
|
return@withState true
|
||||||
}
|
}
|
||||||
R.id.action_revoke -> if (state.status == WidgetStatus.WIDGET_ALLOWED) {
|
R.id.action_revoke -> if (state.status == WidgetStatus.WIDGET_ALLOWED) {
|
||||||
viewModel.handle(WidgetAction.RevokeWidget)
|
revokeWidget()
|
||||||
return@withState true
|
return@withState true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ class WidgetFragment @Inject constructor() :
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteWidget() {
|
private fun deleteWidget() {
|
||||||
MaterialAlertDialogBuilder(requireContext())
|
MaterialAlertDialogBuilder(requireContext())
|
||||||
.setMessage(R.string.widget_delete_message_confirmation)
|
.setMessage(R.string.widget_delete_message_confirmation)
|
||||||
.setPositiveButton(R.string.remove) { _, _ ->
|
.setPositiveButton(R.string.remove) { _, _ ->
|
||||||
|
@ -316,7 +316,7 @@ class WidgetFragment @Inject constructor() :
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun revokeWidget() {
|
private fun revokeWidget() {
|
||||||
viewModel.handle(WidgetAction.RevokeWidget)
|
viewModel.handle(WidgetAction.RevokeWidget)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue