fix(chat): fix gifs staying active in the background when switching chat

This commit is contained in:
Jonathan Rainville 2022-06-29 12:50:10 -04:00 committed by Iuri Matias
parent 6deb900ac5
commit 9d2862a602
4 changed files with 8 additions and 4 deletions

View File

@ -49,14 +49,13 @@ Item {
onIsActiveChannelChanged: {
if (!isActiveChannel) {
root.allMessagesLoaded = false
return
}
// We wait to load all messages, because switching back to chats makes
// the scroll go crazy so it loads way too many messages making it slow
timer.setTimeout(function() {
root.allMessagesLoaded = true
}, 10);
}, 5);
}
Connections {
@ -117,7 +116,6 @@ Item {
text: qsTr("Loading...")
}
StatusLoadingIndicator {
color: Theme.palette.directColor4
anchors.left: loadingText.right
anchors.leftMargin: 8
}
@ -286,6 +284,7 @@ Item {
channelEmoji: root.channelEmoji
emojiPopup: root.emojiPopup
isActiveChannel: root.isActiveChannel
isChatBlocked: root.isChatBlocked
messageContextMenu: messageContextMenuInst

View File

@ -10,7 +10,8 @@ Item {
property int imageWidth: 350
property bool isCurrentUser: false
property url source
property bool playing: Global.applicationWindow.active
property bool isActiveChannel: false
property bool playing: Global.applicationWindow.active && isChatActive
property bool isAnimated: !!source && source.toString().endsWith('.gif')
signal clicked(var image, var mouse)
property var container

View File

@ -27,6 +27,7 @@ Item {
property var container
property int contentType
property bool isChatBlocked: false
property bool isActiveChannel: false
property int chatHorizontalPadding: Style.current.halfPadding
property int chatVerticalPadding: 7
@ -545,6 +546,7 @@ Item {
playing: root.messageStore.playAnimation
imageSource: messageImage
imageWidth: 200
isActiveChannel: root.isActiveChannel
onClicked: {
if (mouse.button === Qt.LeftButton) {
root.imageClicked(image)

View File

@ -23,6 +23,7 @@ Column {
property var contactsStore
property var messageContextMenu
property string channelEmoji
property bool isActiveChannel: false
property var emojiPopup
@ -337,6 +338,7 @@ Column {
messageContextMenu: root.messageContextMenu
contentType: root.messageContentType
isChatBlocked: root.isChatBlocked
isActiveChannel: root.isActiveChannel
emojiPopup: root.emojiPopup
communityId: root.communityId