mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Ask for user confirmation before deleting Widget
This commit is contained in:
parent
5340d16e1f
commit
d52e61413d
@ -160,7 +160,7 @@ class WidgetFragment @Inject constructor() :
|
||||
return@withState true
|
||||
}
|
||||
R.id.action_delete -> {
|
||||
viewModel.handle(WidgetAction.DeleteWidget)
|
||||
deleteWidget()
|
||||
return@withState true
|
||||
}
|
||||
R.id.action_refresh -> if (state.formattedURL.complete) {
|
||||
@ -172,7 +172,7 @@ class WidgetFragment @Inject constructor() :
|
||||
return@withState true
|
||||
}
|
||||
R.id.action_revoke -> if (state.status == WidgetStatus.WIDGET_ALLOWED) {
|
||||
viewModel.handle(WidgetAction.RevokeWidget)
|
||||
revokeWidget()
|
||||
return@withState true
|
||||
}
|
||||
}
|
||||
@ -306,7 +306,7 @@ class WidgetFragment @Inject constructor() :
|
||||
)
|
||||
}
|
||||
|
||||
fun deleteWidget() {
|
||||
private fun deleteWidget() {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setMessage(R.string.widget_delete_message_confirmation)
|
||||
.setPositiveButton(R.string.remove) { _, _ ->
|
||||
@ -316,7 +316,7 @@ class WidgetFragment @Inject constructor() :
|
||||
.show()
|
||||
}
|
||||
|
||||
fun revokeWidget() {
|
||||
private fun revokeWidget() {
|
||||
viewModel.handle(WidgetAction.RevokeWidget)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user