Ask for user confirmation before deleting Widget

This commit is contained in:
Benoit Marty 2022-01-04 14:32:03 +01:00
parent 5340d16e1f
commit d52e61413d
1 changed files with 4 additions and 4 deletions

View File

@ -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)
}
}