Show confirmation dialog before deleting a message

Fixes #967
This commit is contained in:
onurays 2020-02-10 17:58:48 +03:00
parent c97d298166
commit 83d83e0812
4 changed files with 34 additions and 1 deletions

View File

@ -5,6 +5,7 @@ Features ✨:
-
Improvements 🙌:
- Show confirmation dialog before deleting a message (#967)
- Improve navigation to the timeline (#789, #862)
- Improve network detection. It is now based on the sync request status (#873, #882)

View File

@ -1108,7 +1108,14 @@ class RoomDetailFragment @Inject constructor(
showSnackWithMessage(getString(R.string.copied_to_clipboard), Snackbar.LENGTH_SHORT)
}
is EventSharedAction.Delete -> {
roomDetailViewModel.handle(RoomDetailAction.RedactAction(action.eventId, context?.getString(R.string.event_redacted_by_user_reason)))
val layout = requireActivity().layoutInflater.inflate(R.layout.dialog_delete_event, null)
AlertDialog.Builder(requireActivity())
.setView(layout)
.setPositiveButton(R.string.delete) { _, _ ->
roomDetailViewModel.handle(RoomDetailAction.RedactAction(action.eventId, context?.getString(R.string.event_redacted_by_user_reason)))
}
.setNegativeButton(R.string.cancel, null)
.show()
}
is EventSharedAction.Share -> {
// TODO current data communication is too limited

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="?dialogPreferredPadding"
android:paddingLeft="?dialogPreferredPadding"
android:paddingTop="12dp"
android:paddingEnd="?dialogPreferredPadding"
android:paddingRight="?dialogPreferredPadding"
android:paddingBottom="12dp">
<TextView
android:id="@+id/deleteEventConfirmationText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/delete_event_dialog_content"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -19,6 +19,10 @@
<!-- END Strings added by Benoit -->
<!-- BEGIN Strings added by Onuray -->
<string name="delete_event_dialog_content">Delete message?</string>
<!-- END Strings added by Onuray -->
<!-- BEGIN Strings added by Others -->