From a70d800e6dd498161bdff3b46c0570c87e792b53 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Fri, 1 Apr 2022 11:52:44 +0200 Subject: [PATCH] fix(@desktop/chat): the app is crashed after sending gif to a group chat The issue was happening because adding gif to the recently used gifs model was initiated after `gifSelected` action was fired and that action actually removed the context within `addToRecentsGif` ought to be called and the app crashed. That's fixed now updating the order of those two calls. Fixes #5263 --- ui/app/AppLayouts/Chat/views/CreateChatView.qml | 1 + ui/imports/shared/status/StatusChatInput.qml | 5 ++++- ui/imports/shared/status/StatusGifColumn.qml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Chat/views/CreateChatView.qml b/ui/app/AppLayouts/Chat/views/CreateChatView.qml index 001cf7d41a..ef742cdee5 100644 --- a/ui/app/AppLayouts/Chat/views/CreateChatView.qml +++ b/ui/app/AppLayouts/Chat/views/CreateChatView.qml @@ -136,6 +136,7 @@ Page { emojiPopup: root.emojiPopup recentStickers: root.rootStore.stickersModuleInst.recent stickerPackList: root.rootStore.stickersModuleInst.stickerPacks + closeGifPopupAfterSelection: true onSendTransactionCommandButtonClicked: { root.rootStore.createChatStartSendTransactionProcess = true; diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index a21d34d7e4..2d99e63747 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -35,6 +35,7 @@ Rectangle { property var emojiPopup: null // Use this to only enable the Connections only when this Input opens the Emoji popup property bool emojiPopupOpened: false + property bool closeGifPopupAfterSelection: false property bool emojiEvent: false; property bool paste: false; @@ -740,7 +741,9 @@ Rectangle { messageInputField.text = url control.sendMessage(event) gifBtn.highlighted = false - messageInputField.forceActiveFocus(); + messageInputField.forceActiveFocus() + if(control.closeGifPopupAfterSelection) + gifPopup.close() } onClosed: { gifBtn.highlighted = false diff --git a/ui/imports/shared/status/StatusGifColumn.qml b/ui/imports/shared/status/StatusGifColumn.qml index 22e2f630bd..7a5bb8ffdd 100644 --- a/ui/imports/shared/status/StatusGifColumn.qml +++ b/ui/imports/shared/status/StatusGifColumn.qml @@ -110,8 +110,8 @@ Column { anchors.fill: parent hoverEnabled: true onClicked: function (event) { - root.gifSelected(event, model.url) root.store.addToRecentsGif(model.id) + root.gifSelected(event, model.url) } } }