From fa406676333194aaac49a773f6c7a5e345e35b66 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 10 Mar 2021 09:51:56 +0100 Subject: [PATCH] Restore BottomSheet for event not sent. Move the confirmation dialog when the action is selected from the bottom sheet. --- .../home/room/detail/RoomDetailFragment.kt | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 1df583187e..c1c32a417b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -1562,23 +1562,24 @@ class RoomDetailFragment @Inject constructor( this.view?.hideKeyboard() - if (informationData.sendState.isSending()) { - AlertDialog.Builder(requireContext()) - .setTitle(R.string.dialog_title_confirmation) - .setMessage(getString(R.string.event_status_cancel_sending_dialog_message)) - .setNegativeButton(R.string.no, null) - .setPositiveButton(R.string.yes) { _, _ -> - sharedActionViewModel.post(EventSharedAction.Cancel(informationData.eventId)) - } - .show() - } else { - MessageActionsBottomSheet - .newInstance(roomId, informationData) - .show(requireActivity().supportFragmentManager, "MESSAGE_CONTEXTUAL_ACTIONS") - } + MessageActionsBottomSheet + .newInstance(roomId, informationData) + .show(requireActivity().supportFragmentManager, "MESSAGE_CONTEXTUAL_ACTIONS") + return true } + private fun handleCancelSend(action: EventSharedAction.Cancel) { + AlertDialog.Builder(requireContext()) + .setTitle(R.string.dialog_title_confirmation) + .setMessage(getString(R.string.event_status_cancel_sending_dialog_message)) + .setNegativeButton(R.string.no, null) + .setPositiveButton(R.string.yes) { _, _ -> + roomDetailViewModel.handle(RoomDetailAction.CancelSend(action.eventId)) + } + .show() + } + override fun onAvatarClicked(informationData: MessageInformationData) { // roomDetailViewModel.handle(RoomDetailAction.RequestVerification(informationData.userId)) openRoomMemberProfile(informationData.senderId) @@ -1774,7 +1775,7 @@ class RoomDetailFragment @Inject constructor( roomDetailViewModel.handle(RoomDetailAction.RemoveFailedEcho(action.eventId)) } is EventSharedAction.Cancel -> { - roomDetailViewModel.handle(RoomDetailAction.CancelSend(action.eventId)) + handleCancelSend(action) } is EventSharedAction.ReportContentSpam -> { roomDetailViewModel.handle(RoomDetailAction.ReportContent(