diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index ea0610f1b3..df381bbd59 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -135,40 +135,33 @@ Item { id: chatRepeater model: parentModule && parentModule.model - delegate: Loader { - id: chatLoader - - // Channels/chats are not loaded by default and only load when first put active - active: model.loaderActive + ChatContentView { width: parent.width height: parent.height - visible: model.active - - sourceComponent: ChatContentView { - visible: !root.rootStore.openCreateChat && isActiveChannel - rootStore: root.rootStore - contactsStore: root.contactsStore - emojiPopup: root.emojiPopup - stickersPopup: root.stickersPopup - sendTransactionNoEnsModal: cmpSendTransactionNoEns - receiveTransactionModal: cmpReceiveTransaction - sendTransactionWithEnsModal: cmpSendTransactionWithEns - stickersLoaded: root.stickersLoaded - isBlocked: model.blocked - isUserAdded: root.isUserAdded - isActiveChannel: chatLoader.visible - onOpenStickerPackPopup: { - root.openStickerPackPopup(stickerPackId) - } - onOpenAppSearch: { - root.openAppSearch(); - } - Component.onCompleted: { - parentModule.prepareChatContentModuleForChatId(model.itemId) - chatContentModule = parentModule.getChatContentModule() - chatSectionModule = root.parentModule - root.checkForCreateChatOptions(model.itemId) - } + visible: model.active && !root.rootStore.openCreateChat && isActiveChannel + chatMessagesLoader.active: model.loaderActive + rootStore: root.rootStore + contactsStore: root.contactsStore + emojiPopup: root.emojiPopup + stickersPopup: root.stickersPopup + sendTransactionNoEnsModal: cmpSendTransactionNoEns + receiveTransactionModal: cmpReceiveTransaction + sendTransactionWithEnsModal: cmpSendTransactionWithEns + stickersLoaded: root.stickersLoaded + isBlocked: model.blocked + isUserAdded: root.isUserAdded + isActiveChannel: model.active + onOpenStickerPackPopup: { + root.openStickerPackPopup(stickerPackId) + } + onOpenAppSearch: { + root.openAppSearch(); + } + Component.onCompleted: { + parentModule.prepareChatContentModuleForChatId(model.itemId) + chatContentModule = parentModule.getChatContentModule() + chatSectionModule = root.parentModule + root.checkForCreateChatOptions(model.itemId) } } } diff --git a/ui/app/AppLayouts/Chat/views/ChatContentView.qml b/ui/app/AppLayouts/Chat/views/ChatContentView.qml index 6a5221333e..757d410ccb 100644 --- a/ui/app/AppLayouts/Chat/views/ChatContentView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatContentView.qml @@ -36,9 +36,10 @@ ColumnLayout { property var contactsStore property bool isActiveChannel: false + readonly property alias chatMessagesLoader: chatMessagesLoader + property var emojiPopup property var stickersPopup - property alias textInputField: chatInput property UsersStore usersStore: UsersStore {} onChatContentModuleChanged: { @@ -76,8 +77,7 @@ ColumnLayout { } } - MessageStore { - id: messageStore + readonly property var messageStore: MessageStore { messageModule: chatContentModule ? chatContentModule.messagesModule : null chatSectionModule: root.rootStore.chatCommunitySectionModule } @@ -137,33 +137,36 @@ ColumnLayout { Layout.fillHeight: true clip: true - ChatMessagesView { - id: chatMessages + Loader { + id: chatMessagesLoader Layout.fillWidth: true Layout.fillHeight: true - chatContentModule: root.chatContentModule - rootStore: root.rootStore - contactsStore: root.contactsStore - messageContextMenu: contextmenu - messageStore: messageStore - emojiPopup: root.emojiPopup - stickersPopup: root.stickersPopup - usersStore: root.usersStore - stickersLoaded: root.stickersLoaded - isChatBlocked: root.isBlocked || (chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne && !root.isUserAdded) - channelEmoji: !chatContentModule ? "" : (chatContentModule.chatDetails.emoji || "") - isActiveChannel: root.isActiveChannel - onShowReplyArea: { - let obj = messageStore.getMessageByIdAsJson(messageId) - if (!obj) { - return + + sourceComponent: ChatMessagesView { + chatContentModule: root.chatContentModule + rootStore: root.rootStore + contactsStore: root.contactsStore + messageContextMenu: contextmenu + messageStore: root.messageStore + emojiPopup: root.emojiPopup + stickersPopup: root.stickersPopup + usersStore: root.usersStore + stickersLoaded: root.stickersLoaded + isChatBlocked: root.isBlocked || (chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne && !root.isUserAdded) + channelEmoji: !chatContentModule ? "" : (chatContentModule.chatDetails.emoji || "") + isActiveChannel: root.isActiveChannel + onShowReplyArea: { + let obj = messageStore.getMessageByIdAsJson(messageId) + if (!obj) { + return + } + chatInput.showReplyArea(messageId, obj.senderDisplayName, obj.messageText, obj.contentType, obj.messageImage, obj.sticker) } - chatInput.showReplyArea(messageId, obj.senderDisplayName, obj.messageText, obj.contentType, obj.messageImage, obj.sticker) + onOpenStickerPackPopup: { + root.openStickerPackPopup(stickerPackId); + } + onEditModeChanged: if (!editModeOn) chatInput.forceInputActiveFocus() } - onOpenStickerPackPopup: { - root.openStickerPackPopup(stickerPackId); - } - onEditModeChanged: if (!editModeOn) chatInput.forceInputActiveFocus() } Item {