2021-10-01 15:58:36 +00:00
|
|
|
|
import QtQuick 2.13
|
2021-01-25 20:50:42 +00:00
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-10-21 15:07:13 +00:00
|
|
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
import shared.status 1.0
|
|
|
|
|
import shared.controls 1.0
|
2021-10-28 20:23:30 +00:00
|
|
|
|
import shared.panels.chat 1.0
|
2021-12-08 21:20:43 +00:00
|
|
|
|
import shared.views.chat 1.0
|
2021-10-28 20:23:30 +00:00
|
|
|
|
import shared.controls.chat 1.0
|
2021-10-21 15:07:13 +00:00
|
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1 as StatusQControls
|
2022-03-07 14:56:05 +00:00
|
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2022-03-09 10:27:32 +00:00
|
|
|
|
import StatusQ.Components 0.1
|
2021-10-21 15:07:13 +00:00
|
|
|
|
|
2020-07-15 21:04:14 +00:00
|
|
|
|
Item {
|
2021-07-16 15:02:47 +00:00
|
|
|
|
id: root
|
2021-12-09 12:53:40 +00:00
|
|
|
|
|
2022-02-11 21:41:34 +00:00
|
|
|
|
property var store
|
2022-01-18 21:02:47 +00:00
|
|
|
|
property var messageStore
|
2022-02-08 12:08:02 +00:00
|
|
|
|
property var usersStore
|
2022-01-18 21:02:47 +00:00
|
|
|
|
property var contactsStore
|
|
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
|
property var messageContextMenu
|
|
|
|
|
property var container
|
2022-01-13 19:25:38 +00:00
|
|
|
|
property int contentType
|
2022-02-24 12:15:02 +00:00
|
|
|
|
property bool isChatBlocked: false
|
2021-12-09 12:53:40 +00:00
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
property int chatHorizontalPadding: Style.current.halfPadding
|
2020-07-15 21:04:14 +00:00
|
|
|
|
property int chatVerticalPadding: 7
|
2021-12-09 12:53:40 +00:00
|
|
|
|
property bool headerRepeatCondition: (authorCurrentMsg !== authorPrevMsg ||
|
|
|
|
|
shouldRepeatHeader || dateGroupLbl.visible || chatReply.active)
|
2021-12-08 21:20:43 +00:00
|
|
|
|
property bool stickersLoaded: false
|
2022-01-13 19:25:38 +00:00
|
|
|
|
property string sticker
|
|
|
|
|
property int stickerPack
|
2021-12-08 21:20:43 +00:00
|
|
|
|
property bool isMessageActive: false
|
2022-02-18 19:39:04 +00:00
|
|
|
|
property bool amISender: false
|
2022-03-04 21:33:48 +00:00
|
|
|
|
property string senderIcon: ""
|
2021-12-08 21:20:43 +00:00
|
|
|
|
property bool isHovered: false
|
2022-02-01 18:45:28 +00:00
|
|
|
|
property bool isInPinnedPopup: false
|
2022-02-24 15:04:59 +00:00
|
|
|
|
property string communityId
|
2021-10-01 15:58:36 +00:00
|
|
|
|
property bool showMoreButton: {
|
2022-01-25 11:39:50 +00:00
|
|
|
|
if(!root.messageStore)
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
let chatTypeThisMessageBelongsTo = root.messageStore.getChatType()
|
2021-12-14 14:19:55 +00:00
|
|
|
|
switch (chatTypeThisMessageBelongsTo) {
|
|
|
|
|
case Constants.chatType.oneToOne:
|
|
|
|
|
return true
|
|
|
|
|
case Constants.chatType.privateGroupChat:
|
2022-01-05 15:50:03 +00:00
|
|
|
|
return messageStore.amIChatAdmin() || amISender
|
2021-12-14 14:19:55 +00:00
|
|
|
|
case Constants.chatType.publicChat:
|
|
|
|
|
return amISender
|
|
|
|
|
case Constants.chatType.communityChat:
|
2022-01-05 15:50:03 +00:00
|
|
|
|
return messageStore.amIChatAdmin() || amISender
|
2021-12-14 14:19:55 +00:00
|
|
|
|
case Constants.chatType.profile:
|
|
|
|
|
return false
|
|
|
|
|
default:
|
|
|
|
|
return false
|
|
|
|
|
}
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2022-01-17 18:46:46 +00:00
|
|
|
|
property bool editModeOn: false
|
2022-01-25 12:56:53 +00:00
|
|
|
|
property string linkUrls: ""
|
2022-01-17 18:46:46 +00:00
|
|
|
|
|
2022-02-09 00:04:49 +00:00
|
|
|
|
property var transactionParams
|
|
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
|
signal openStickerPackPopup(string stickerPackId)
|
2021-07-16 15:02:47 +00:00
|
|
|
|
signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool emojiOnly, bool hideEmojiPicker)
|
2021-12-14 14:19:55 +00:00
|
|
|
|
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker, bool isReply, bool isRightClickOnImage, string imageSource)
|
2022-01-12 12:55:26 +00:00
|
|
|
|
signal replyClicked(string messageId, string author)
|
2022-01-18 21:02:47 +00:00
|
|
|
|
signal imageClicked(var image)
|
|
|
|
|
|
2021-01-25 20:50:42 +00:00
|
|
|
|
width: parent.width
|
2021-01-26 20:29:33 +00:00
|
|
|
|
height: messageContainer.height + messageContainer.anchors.topMargin
|
|
|
|
|
+ (dateGroupLbl.visible ? dateGroupLbl.height + dateGroupLbl.anchors.topMargin : 0)
|
2020-07-15 21:04:14 +00:00
|
|
|
|
|
2022-03-09 10:02:28 +00:00
|
|
|
|
Connections {
|
|
|
|
|
target: root.messageStore.messageModule
|
|
|
|
|
enabled: responseTo !== ""
|
|
|
|
|
onRefreshAMessageUserRespondedTo: {
|
|
|
|
|
if(msgId === messageId)
|
|
|
|
|
chatReply.resetOriginalMessage()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 13:38:03 +00:00
|
|
|
|
Timer {
|
|
|
|
|
id: ensureMessageFullyVisibleTimer
|
|
|
|
|
interval: 1
|
|
|
|
|
onTriggered: {
|
|
|
|
|
chatLogView.positionViewAtIndex(ListView.currentIndex, ListView.Contain)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-13 17:30:32 +00:00
|
|
|
|
MessageMouseArea {
|
2022-02-24 12:15:02 +00:00
|
|
|
|
enabled: !root.isChatBlocked && !placeholderMessage && !isImage
|
2021-01-25 20:50:42 +00:00
|
|
|
|
anchors.fill: messageContainer
|
2021-06-10 19:20:43 +00:00
|
|
|
|
acceptedButtons: activityCenterMessage ? Qt.LeftButton : Qt.RightButton
|
2022-01-13 17:30:32 +00:00
|
|
|
|
messageContextMenu: root.messageContextMenu
|
|
|
|
|
messageContextMenuParent: root
|
|
|
|
|
isHovered: root.isHovered
|
|
|
|
|
isMessageActive: root.isMessageActive
|
|
|
|
|
isActivityCenterMessage: activityCenterMessage
|
|
|
|
|
stickersLoaded: root.stickersLoaded
|
|
|
|
|
onClickMessage: {
|
|
|
|
|
root.clickMessage(isProfileClick, isSticker, isImage, null, false, false, false, false, "");
|
2021-06-10 19:20:43 +00:00
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
|
ChatButtonsPanel {
|
2021-12-14 14:19:55 +00:00
|
|
|
|
contentType: messageContentType
|
2022-01-17 18:46:46 +00:00
|
|
|
|
parentIsHovered: !editModeOn && isHovered
|
2022-02-24 12:15:02 +00:00
|
|
|
|
isChatBlocked: root.isChatBlocked
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onHoverChanged: {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
hovered && setHovered(messageId, hovered)
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
|
anchors.right: parent.right
|
2021-01-25 20:50:42 +00:00
|
|
|
|
anchors.rightMargin: 20
|
2021-02-01 19:05:34 +00:00
|
|
|
|
anchors.top: messageContainer.top
|
2021-01-25 20:50:42 +00:00
|
|
|
|
// This is not exactly like the design because the hover becomes messed up with the buttons on top of another Message
|
|
|
|
|
anchors.topMargin: -Style.current.halfPadding
|
2021-07-16 15:02:47 +00:00
|
|
|
|
messageContextMenu: root.messageContextMenu
|
2021-12-14 14:19:55 +00:00
|
|
|
|
showMoreButton: root.showMoreButton
|
2022-02-01 18:45:28 +00:00
|
|
|
|
isInPinnedPopup: root.isInPinnedPopup
|
2021-12-09 12:53:40 +00:00
|
|
|
|
fromAuthor: senderId
|
2022-02-18 19:39:04 +00:00
|
|
|
|
editBtnActive: isText && !editModeOn && root.amISender
|
2021-12-17 12:53:10 +00:00
|
|
|
|
activityCenterMsg: activityCenterMessage
|
|
|
|
|
placeholderMsg: placeholderMessage
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onClickMessage: {
|
2021-12-14 14:19:55 +00:00
|
|
|
|
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, false, false, "");
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-12-08 21:20:43 +00:00
|
|
|
|
onReplyClicked: {
|
2022-01-12 12:55:26 +00:00
|
|
|
|
root.replyClicked(messageId, author)
|
2021-12-08 21:20:43 +00:00
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-20 17:34:20 +00:00
|
|
|
|
Loader {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
active: typeof root.messageContextMenu !== "undefined"
|
2020-09-30 18:16:16 +00:00
|
|
|
|
sourceComponent: Component {
|
2021-01-25 20:50:42 +00:00
|
|
|
|
Connections {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
enabled: isMessageActive
|
|
|
|
|
target: root.messageContextMenu
|
|
|
|
|
onClosed: setMessageActive(messageId, false)
|
2020-09-30 18:16:16 +00:00
|
|
|
|
}
|
2020-07-20 17:34:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-26 20:29:33 +00:00
|
|
|
|
DateGroup {
|
|
|
|
|
id: dateGroupLbl
|
2021-06-11 17:41:59 +00:00
|
|
|
|
previousMessageIndex: prevMessageIndex
|
|
|
|
|
previousMessageTimestamp: prevMsgTimestamp
|
|
|
|
|
messageTimestamp: timestamp
|
2021-06-15 19:34:36 +00:00
|
|
|
|
isActivityCenterMessage: activityCenterMessage
|
2021-01-26 20:29:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-22 08:25:55 +00:00
|
|
|
|
function startMessageFoundAnimation() {
|
|
|
|
|
messageFoundAnimation.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SequentialAnimation {
|
|
|
|
|
id: messageFoundAnimation
|
|
|
|
|
PauseAnimation {
|
|
|
|
|
duration: 600
|
|
|
|
|
}
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
target: highlightRect
|
|
|
|
|
property: "opacity"
|
|
|
|
|
to: 1.0
|
|
|
|
|
duration: 1500
|
|
|
|
|
}
|
|
|
|
|
PauseAnimation {
|
|
|
|
|
duration: 1000
|
|
|
|
|
}
|
|
|
|
|
NumberAnimation {
|
|
|
|
|
target: highlightRect
|
|
|
|
|
property: "opacity"
|
|
|
|
|
to: 0.0
|
|
|
|
|
duration: 1500
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: highlightRect
|
|
|
|
|
anchors.fill: messageContainer
|
|
|
|
|
opacity: 0
|
|
|
|
|
visible: (opacity > 0.001)
|
|
|
|
|
color: Style.current.backgroundHoverLight
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-25 20:50:42 +00:00
|
|
|
|
Rectangle {
|
|
|
|
|
id: messageContainer
|
2022-01-25 11:39:50 +00:00
|
|
|
|
|
|
|
|
|
property alias messageContent: messageContent
|
|
|
|
|
|
2021-01-26 20:29:33 +00:00
|
|
|
|
anchors.top: dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top
|
2021-06-11 17:41:59 +00:00
|
|
|
|
anchors.topMargin: dateGroupLbl.visible ? (activityCenterMessage ? 4 : Style.current.padding) : 0
|
2021-02-22 19:47:32 +00:00
|
|
|
|
height: childrenRect.height
|
2021-04-30 14:45:13 +00:00
|
|
|
|
+ (chatName.visible || emojiReactionLoader.active ? Style.current.halfPadding : 0)
|
2021-04-28 17:58:40 +00:00
|
|
|
|
+ (chatName.visible && emojiReactionLoader.active ? Style.current.padding : 0)
|
2021-04-30 14:45:13 +00:00
|
|
|
|
+ (!chatName.visible && chatImageContent.active ? 6 : 0)
|
2021-02-01 18:40:55 +00:00
|
|
|
|
+ (emojiReactionLoader.active ? emojiReactionLoader.height: 0)
|
|
|
|
|
+ (retry.visible && !chatTime.visible ? Style.current.smallPadding : 0)
|
2021-05-25 19:34:46 +00:00
|
|
|
|
+ (pinnedRectangleLoader.active ? Style.current.smallPadding : 0)
|
2022-01-17 18:46:46 +00:00
|
|
|
|
+ (editModeOn ? 25 : 0)
|
2021-01-25 20:50:42 +00:00
|
|
|
|
width: parent.width
|
2021-12-09 12:53:40 +00:00
|
|
|
|
|
2021-05-25 19:34:46 +00:00
|
|
|
|
color: {
|
2022-01-17 18:46:46 +00:00
|
|
|
|
if (editModeOn) {
|
2021-06-29 14:49:32 +00:00
|
|
|
|
return Style.current.backgroundHoverLight
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-14 15:40:05 +00:00
|
|
|
|
if (activityCenterMessage) {
|
|
|
|
|
return read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (placeholderMessage) {
|
2021-06-11 17:41:59 +00:00
|
|
|
|
return Style.current.transparent
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-25 19:34:46 +00:00
|
|
|
|
if (pinnedMessage) {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
return isHovered || isMessageActive ? Style.current.pinnedMessageBackgroundHovered : Style.current.pinnedMessageBackground
|
2021-05-25 19:34:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
|
return isHovered || isMessageActive ? (hasMention ? Style.current.mentionMessageHoverColor : Style.current.backgroundHoverLight) :
|
2021-09-22 08:25:55 +00:00
|
|
|
|
(hasMention ? Style.current.mentionMessageColor : Style.current.transparent)
|
2021-05-25 19:34:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: pinnedRectangleLoader
|
2022-01-17 18:46:46 +00:00
|
|
|
|
active: !editModeOn && pinnedMessage
|
2021-05-25 19:34:46 +00:00
|
|
|
|
anchors.left: chatName.left
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: active ? Style.current.halfPadding : 0
|
|
|
|
|
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: pinnedRectangle
|
|
|
|
|
height: 24
|
|
|
|
|
width: childrenRect.width + Style.current.smallPadding
|
|
|
|
|
color: Style.current.pinnedRectangleBackground
|
|
|
|
|
radius: 12
|
|
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
|
id: pinImage
|
2021-09-28 15:04:06 +00:00
|
|
|
|
source: Style.svg("pin")
|
2021-05-25 19:34:46 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: 3
|
2021-05-25 19:38:18 +00:00
|
|
|
|
width: 16
|
|
|
|
|
height: 16
|
2021-05-25 19:34:46 +00:00
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
|
|
ColorOverlay {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
source: parent
|
|
|
|
|
color: Style.current.pinnedMessageBorder
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StyledText {
|
2022-01-04 12:06:05 +00:00
|
|
|
|
//% "Pinned by %1"
|
2022-01-05 15:50:03 +00:00
|
|
|
|
text: qsTrId("pinned-by--1").arg(Utils.getContactDetailsAsJson(messagePinnedBy).displayName)
|
2021-05-25 19:34:46 +00:00
|
|
|
|
anchors.left: pinImage.right
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
font.pixelSize: 13
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-25 20:50:42 +00:00
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
2021-12-10 16:11:18 +00:00
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
// Connections {
|
|
|
|
|
// enabled: !!rootStore
|
|
|
|
|
// target: enabled ? rootStore.chatsModelInst.messageView : null
|
|
|
|
|
// onMessageEdited: {
|
|
|
|
|
// if(chatReply.item)
|
|
|
|
|
// chatReply.item.messageEdited(editedMessageId, editedMessageContent)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
|
|
ChatReplyPanel {
|
2021-04-23 15:49:05 +00:00
|
|
|
|
id: chatReply
|
2021-05-25 19:34:46 +00:00
|
|
|
|
anchors.top: pinnedRectangleLoader.active ? pinnedRectangleLoader.bottom : parent.top
|
|
|
|
|
anchors.topMargin: active ? 4 : 0
|
2021-04-23 15:49:05 +00:00
|
|
|
|
anchors.left: chatImage.left
|
2021-10-01 15:58:36 +00:00
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: Style.current.padding
|
2022-02-18 19:39:04 +00:00
|
|
|
|
isCurrentUser: root.amISender
|
2021-04-23 15:49:05 +00:00
|
|
|
|
longReply: active && textFieldImplicitWidth > width
|
|
|
|
|
container: root.container
|
2021-12-09 12:53:40 +00:00
|
|
|
|
chatHorizontalPadding: chatHorizontalPadding
|
|
|
|
|
active: responseTo !== "" && !activityCenterMessage
|
|
|
|
|
|
2022-03-09 10:02:28 +00:00
|
|
|
|
function resetOriginalMessage() {
|
2022-01-25 11:39:50 +00:00
|
|
|
|
if(!root.messageStore)
|
|
|
|
|
return
|
|
|
|
|
let obj = root.messageStore.getMessageByIdAsJson(responseTo)
|
2021-12-09 12:53:40 +00:00
|
|
|
|
if(!obj)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
amISenderOfTheRepliedMessage = obj.amISender
|
|
|
|
|
repliedMessageContentType = obj.contentType
|
|
|
|
|
repliedMessageSenderIcon = obj.senderIcon
|
|
|
|
|
// TODO: not sure about is edited at the moment
|
|
|
|
|
repliedMessageIsEdited = false
|
|
|
|
|
repliedMessageSender = obj.senderDisplayName
|
2022-03-09 10:27:32 +00:00
|
|
|
|
repliedMessageSenderPubkey = obj.senderId
|
|
|
|
|
repliedMessageSenderIsAdded = obj.senderIsAdded
|
2021-12-09 12:53:40 +00:00
|
|
|
|
repliedMessageContent = obj.messageText
|
|
|
|
|
repliedMessageImage = obj.messageImage
|
2022-04-06 12:28:07 +00:00
|
|
|
|
stickerData = obj.sticker
|
2021-12-09 12:53:40 +00:00
|
|
|
|
}
|
2022-03-09 10:02:28 +00:00
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
resetOriginalMessage()
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
|
onScrollToBottom: {
|
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
// messageStore.scrollToBottom(isit, root.container);
|
|
|
|
|
}
|
2021-12-08 21:20:43 +00:00
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onClickMessage: {
|
2021-12-14 14:19:55 +00:00
|
|
|
|
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, false, "")
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-04-23 15:49:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
2021-01-25 20:50:42 +00:00
|
|
|
|
UserImage {
|
|
|
|
|
id: chatImage
|
2022-03-09 10:27:32 +00:00
|
|
|
|
|
2021-04-06 14:59:59 +00:00
|
|
|
|
active: isMessage && headerRepeatCondition
|
2022-03-09 10:27:32 +00:00
|
|
|
|
|
2021-01-25 20:50:42 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2021-05-25 19:34:46 +00:00
|
|
|
|
anchors.top: chatReply.active ? chatReply.bottom :
|
|
|
|
|
pinnedRectangleLoader.active ? pinnedRectangleLoader.bottom : parent.top
|
|
|
|
|
anchors.topMargin: chatReply.active || pinnedRectangleLoader.active ? 4 : Style.current.smallPadding
|
2022-03-09 10:27:32 +00:00
|
|
|
|
|
2022-03-30 15:30:28 +00:00
|
|
|
|
image: root.senderIcon
|
2022-03-09 10:27:32 +00:00
|
|
|
|
pubkey: senderId
|
|
|
|
|
name: senderDisplayName
|
|
|
|
|
|
|
|
|
|
onClicked: root.clickMessage(true, false, false, null, false, false, false, false, "")
|
2021-01-25 20:50:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UsernameLabel {
|
|
|
|
|
id: chatName
|
2022-01-17 18:46:46 +00:00
|
|
|
|
visible: !editModeOn && isMessage && headerRepeatCondition
|
2021-12-09 12:53:40 +00:00
|
|
|
|
anchors.leftMargin: chatHorizontalPadding
|
2021-01-25 20:50:42 +00:00
|
|
|
|
anchors.top: chatImage.top
|
|
|
|
|
anchors.left: chatImage.right
|
2022-01-17 08:56:44 +00:00
|
|
|
|
messageContextMenu: root.messageContextMenu
|
2021-12-09 12:53:40 +00:00
|
|
|
|
displayName: senderDisplayName
|
|
|
|
|
localName: senderLocalName
|
2022-02-18 19:39:04 +00:00
|
|
|
|
amISender: root.amISender
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onClickMessage: {
|
2021-12-14 14:19:55 +00:00
|
|
|
|
root.clickMessage(true, false, false, null, false, false, false, false, "")
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-01-25 20:50:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-21 22:39:53 +00:00
|
|
|
|
ChatTimePanel {
|
2021-02-01 18:40:55 +00:00
|
|
|
|
id: chatTime
|
2022-01-17 18:46:46 +00:00
|
|
|
|
visible: !editModeOn && headerRepeatCondition
|
2021-02-01 18:40:55 +00:00
|
|
|
|
anchors.verticalCenter: chatName.verticalCenter
|
|
|
|
|
anchors.left: chatName.right
|
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
|
color: Style.current.secondaryText
|
2021-12-10 16:11:18 +00:00
|
|
|
|
timestamp: messageTimestamp
|
2021-02-01 18:40:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-29 14:49:32 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: editMessageLoader
|
2022-01-17 18:46:46 +00:00
|
|
|
|
active: editModeOn
|
2021-06-29 14:49:32 +00:00
|
|
|
|
anchors.top: chatReply.active ? chatReply.bottom : parent.top
|
|
|
|
|
anchors.left: chatImage.right
|
2021-12-09 12:53:40 +00:00
|
|
|
|
anchors.leftMargin: chatHorizontalPadding
|
2021-06-29 14:49:32 +00:00
|
|
|
|
anchors.right: parent.right
|
2021-12-09 12:53:40 +00:00
|
|
|
|
anchors.rightMargin: chatHorizontalPadding
|
2021-06-29 14:49:32 +00:00
|
|
|
|
height: (item !== null && typeof(item)!== 'undefined')? item.height: 0
|
2021-08-24 14:14:19 +00:00
|
|
|
|
property string sourceText
|
|
|
|
|
|
|
|
|
|
onActiveChanged: {
|
|
|
|
|
if (!active) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let mentionsMap = new Map()
|
|
|
|
|
let index = 0
|
|
|
|
|
while (true) {
|
|
|
|
|
index = message.indexOf("<a href=", index)
|
|
|
|
|
if (index < 0) {
|
|
|
|
|
break
|
|
|
|
|
}
|
2022-02-08 12:08:02 +00:00
|
|
|
|
let startIndex = index
|
|
|
|
|
let endIndex = message.indexOf("</a>", index) + 4
|
2021-08-24 14:14:19 +00:00
|
|
|
|
if (endIndex < 0) {
|
|
|
|
|
index += 8 // "<a href="
|
|
|
|
|
continue
|
|
|
|
|
}
|
2022-02-08 12:08:02 +00:00
|
|
|
|
let addrIndex = message.indexOf("0x", index + 8)
|
2021-08-24 14:14:19 +00:00
|
|
|
|
if (addrIndex < 0) {
|
|
|
|
|
index += 8 // "<a href="
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
let addrEndIndex = message.indexOf('"', addrIndex)
|
|
|
|
|
if (addrEndIndex < 0) {
|
|
|
|
|
index += 8 // "<a href="
|
|
|
|
|
continue
|
|
|
|
|
}
|
2022-02-08 12:08:02 +00:00
|
|
|
|
const mentionLink = message.substring(startIndex, endIndex)
|
|
|
|
|
const linkTag = message.substring(index, endIndex)
|
2021-09-24 11:40:02 +00:00
|
|
|
|
const linkText = linkTag.replace(/(<([^>]+)>)/ig,"").trim()
|
|
|
|
|
const atSymbol = linkText.startsWith("@") ? '' : '@'
|
|
|
|
|
const mentionTag = Constants.mentionSpanTag + atSymbol + linkText + '</span> '
|
2022-02-08 12:08:02 +00:00
|
|
|
|
mentionsMap.set(mentionLink, mentionTag)
|
2021-08-24 14:14:19 +00:00
|
|
|
|
index += linkTag.length
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-08 12:08:02 +00:00
|
|
|
|
sourceText = message
|
2021-08-24 14:14:19 +00:00
|
|
|
|
for (let [key, value] of mentionsMap) {
|
|
|
|
|
sourceText = sourceText.replace(new RegExp(key, 'g'), value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-29 14:49:32 +00:00
|
|
|
|
sourceComponent: Item {
|
|
|
|
|
id: editText
|
|
|
|
|
height: childrenRect.height
|
2021-08-02 13:38:03 +00:00
|
|
|
|
|
|
|
|
|
property bool suggestionsOpened: false
|
|
|
|
|
Keys.onEscapePressed: {
|
|
|
|
|
if (!suggestionsOpened) {
|
|
|
|
|
cancelBtn.clicked()
|
|
|
|
|
}
|
|
|
|
|
suggestionsOpened = false
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-29 14:49:32 +00:00
|
|
|
|
StatusChatInput {
|
2021-08-02 13:38:03 +00:00
|
|
|
|
id: editTextInput
|
2022-02-08 12:08:02 +00:00
|
|
|
|
|
2022-02-14 23:27:23 +00:00
|
|
|
|
store: root.store
|
2022-02-08 12:08:02 +00:00
|
|
|
|
usersStore: root.usersStore
|
|
|
|
|
|
2021-06-29 14:49:32 +00:00
|
|
|
|
chatInputPlaceholder: qsTrId("type-a-message-")
|
2021-12-14 14:19:55 +00:00
|
|
|
|
chatType: messageStore.getChatType()
|
2021-06-29 14:49:32 +00:00
|
|
|
|
isEdit: true
|
2021-08-24 14:14:19 +00:00
|
|
|
|
textInput.text: editMessageLoader.sourceText
|
2022-02-01 13:10:24 +00:00
|
|
|
|
messageContextMenu: root.messageContextMenu
|
2021-08-02 13:38:03 +00:00
|
|
|
|
onSendMessage: {
|
2021-12-01 21:39:58 +00:00
|
|
|
|
saveBtn.clicked(null)
|
2021-08-02 13:38:03 +00:00
|
|
|
|
}
|
|
|
|
|
suggestions.onVisibleChanged: {
|
|
|
|
|
if (suggestions.visible) {
|
|
|
|
|
editText.suggestionsOpened = true
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-29 14:49:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-21 15:07:13 +00:00
|
|
|
|
StatusQControls.StatusFlatButton {
|
2021-06-29 14:49:32 +00:00
|
|
|
|
id: cancelBtn
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
|
anchors.top: editTextInput.bottom
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Cancel"
|
|
|
|
|
text: qsTrId("browsing-cancel")
|
2021-06-29 14:49:32 +00:00
|
|
|
|
onClicked: {
|
2022-01-17 18:46:46 +00:00
|
|
|
|
messageStore.setEditModeOff(messageId)
|
2022-03-07 14:56:05 +00:00
|
|
|
|
editTextInput.textInput.text = StatusQUtils.Emoji.parse(message)
|
2021-08-02 13:38:03 +00:00
|
|
|
|
ensureMessageFullyVisibleTimer.start()
|
2021-06-29 14:49:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-21 15:07:13 +00:00
|
|
|
|
StatusQControls.StatusButton {
|
2021-06-29 14:49:32 +00:00
|
|
|
|
id: saveBtn
|
|
|
|
|
anchors.left: cancelBtn.right
|
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
|
anchors.top: editTextInput.bottom
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Save"
|
|
|
|
|
text: qsTrId("save")
|
2021-08-02 13:38:03 +00:00
|
|
|
|
enabled: editTextInput.textInput.text.trim().length > 0
|
2021-06-29 14:49:32 +00:00
|
|
|
|
onClicked: {
|
2022-03-07 14:56:05 +00:00
|
|
|
|
let msg = rootStore.plainText(StatusQUtils.Emoji.deparse(editTextInput.textInput.text))
|
2022-01-17 18:46:46 +00:00
|
|
|
|
if (msg.length > 0){
|
|
|
|
|
msg = messageStore.interpretMessage(msg)
|
|
|
|
|
messageStore.setEditModeOff(messageId)
|
|
|
|
|
messageStore.editMessage(messageId, msg)
|
|
|
|
|
}
|
2021-06-29 14:49:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
Item {
|
|
|
|
|
id: messageContent
|
2021-04-20 15:25:00 +00:00
|
|
|
|
height: childrenRect.height + (isEmoji ? 2 : 0)
|
2021-04-23 15:49:05 +00:00
|
|
|
|
anchors.top: chatName.visible ? chatName.bottom :
|
2021-05-14 17:23:27 +00:00
|
|
|
|
chatReply.active ? chatReply.bottom :
|
|
|
|
|
pinnedRectangleLoader.active ? pinnedRectangleLoader.bottom : parent.top
|
2022-01-14 11:38:45 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: chatImage.imageWidth + Style.current.padding + root.chatHorizontalPadding
|
2021-01-25 20:50:42 +00:00
|
|
|
|
anchors.right: parent.right
|
2022-01-14 11:38:45 +00:00
|
|
|
|
anchors.rightMargin: root.chatHorizontalPadding
|
2022-01-17 18:46:46 +00:00
|
|
|
|
visible: !editModeOn
|
2021-10-01 15:58:36 +00:00
|
|
|
|
ChatTextView {
|
2021-02-01 18:40:55 +00:00
|
|
|
|
id: chatText
|
2021-12-09 12:53:40 +00:00
|
|
|
|
readonly property int leftPadding: chatImage.anchors.leftMargin + chatImage.width + chatHorizontalPadding
|
2021-09-06 12:19:57 +00:00
|
|
|
|
visible: {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
const urls = linkUrls.split(" ")
|
2021-10-20 09:50:50 +00:00
|
|
|
|
if (urls.length === 1 && Utils.hasImageExtension(urls[0]) && localAccountSensitiveSettings.displayChatImages) {
|
2021-09-06 12:19:57 +00:00
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isText || isEmoji
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-23 15:49:05 +00:00
|
|
|
|
anchors.top: parent.top
|
2021-04-20 15:25:00 +00:00
|
|
|
|
anchors.topMargin: isEmoji ? 2 : 0
|
2021-02-01 18:40:55 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
// using a padding instead of a margin let's us select text more easily
|
|
|
|
|
anchors.leftMargin: -leftPadding
|
|
|
|
|
textField.leftPadding: leftPadding
|
|
|
|
|
textField.rightPadding: Style.current.bigPadding
|
2021-09-27 12:08:55 +00:00
|
|
|
|
|
|
|
|
|
onLinkActivated: {
|
|
|
|
|
if (activityCenterMessage) {
|
2021-12-14 14:19:55 +00:00
|
|
|
|
root.clickMessage(false, isSticker, false, null, false, false, false, false, "")
|
2021-09-27 12:08:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-01 18:40:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: chatImageContent
|
|
|
|
|
active: isImage
|
2021-04-23 15:49:05 +00:00
|
|
|
|
anchors.top: parent.top
|
2021-04-30 14:45:13 +00:00
|
|
|
|
anchors.topMargin: active ? 6 : 0
|
2021-02-01 18:40:55 +00:00
|
|
|
|
z: 51
|
|
|
|
|
sourceComponent: Component {
|
2021-08-30 12:42:11 +00:00
|
|
|
|
StatusChatImage {
|
2022-02-22 20:48:57 +00:00
|
|
|
|
playing: root.messageStore.playAnimation
|
2021-12-17 12:53:10 +00:00
|
|
|
|
imageSource: messageImage
|
2021-02-01 18:40:55 +00:00
|
|
|
|
imageWidth: 200
|
2021-08-16 09:11:43 +00:00
|
|
|
|
onClicked: {
|
2021-08-25 20:31:00 +00:00
|
|
|
|
if (mouse.button === Qt.LeftButton) {
|
2022-01-18 21:02:47 +00:00
|
|
|
|
root.imageClicked(image)
|
2021-08-16 09:11:43 +00:00
|
|
|
|
}
|
2021-08-25 20:31:00 +00:00
|
|
|
|
else if (mouse.button === Qt.RightButton) {
|
|
|
|
|
// Set parent, X & Y positions for the messageContextMenu
|
2021-12-09 12:53:40 +00:00
|
|
|
|
root.messageContextMenu.parent = root
|
|
|
|
|
root.messageContextMenu.setXPosition = function() { return (mouse.x)}
|
|
|
|
|
root.messageContextMenu.setYPosition = function() { return (mouse.y)}
|
2021-12-14 14:19:55 +00:00
|
|
|
|
root.clickMessage(false, false, true, image, false, true, false, true, imageSource)
|
2021-08-16 09:11:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-01 18:40:55 +00:00
|
|
|
|
container: root.container
|
|
|
|
|
}
|
2020-09-30 18:01:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: stickerLoader
|
2021-12-09 12:53:40 +00:00
|
|
|
|
active: contentType === Constants.messageContentType.stickerType
|
2021-02-01 18:40:55 +00:00
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: active ? Style.current.halfPadding : 0
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: stickerContainer
|
|
|
|
|
color: Style.current.transparent
|
2021-12-09 12:53:40 +00:00
|
|
|
|
border.color: isHovered ? Qt.darker(Style.current.border, 1.1) : Style.current.border
|
2021-02-01 18:40:55 +00:00
|
|
|
|
border.width: 1
|
|
|
|
|
radius: 16
|
2021-12-09 12:53:40 +00:00
|
|
|
|
width: stickerId.width + 2 * chatVerticalPadding
|
|
|
|
|
height: stickerId.height + 2 * chatVerticalPadding
|
2021-02-01 18:40:55 +00:00
|
|
|
|
|
2021-08-30 12:42:11 +00:00
|
|
|
|
StatusSticker {
|
2021-02-01 18:40:55 +00:00
|
|
|
|
id: stickerId
|
|
|
|
|
anchors.top: parent.top
|
2021-12-09 12:53:40 +00:00
|
|
|
|
anchors.topMargin: chatVerticalPadding
|
2021-02-01 18:40:55 +00:00
|
|
|
|
anchors.left: parent.left
|
2021-12-09 12:53:40 +00:00
|
|
|
|
anchors.leftMargin: chatVerticalPadding
|
2022-01-13 19:25:38 +00:00
|
|
|
|
contentType: root.contentType
|
|
|
|
|
stickerData: root.sticker
|
2021-08-30 12:42:11 +00:00
|
|
|
|
onLoaded: {
|
2022-01-25 11:39:50 +00:00
|
|
|
|
if(!root.messageStore)
|
|
|
|
|
return
|
2022-02-14 23:27:23 +00:00
|
|
|
|
// Not refactored yet
|
|
|
|
|
// root.messageStore.scrollToBottom(true, root.container)
|
2021-08-30 12:42:11 +00:00
|
|
|
|
}
|
2021-02-01 18:40:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MessageMouseArea {
|
|
|
|
|
id: messageMouseArea
|
|
|
|
|
anchors.fill: stickerLoader.active ? stickerLoader : chatText
|
2021-06-10 19:20:43 +00:00
|
|
|
|
z: activityCenterMessage ? chatText.z + 1 : chatText.z -1
|
2022-02-24 12:15:02 +00:00
|
|
|
|
enabled: !root.isChatBlocked && !placeholderMessage
|
2021-10-01 15:58:36 +00:00
|
|
|
|
messageContextMenu: root.messageContextMenu
|
2021-12-08 21:20:43 +00:00
|
|
|
|
messageContextMenuParent: root
|
|
|
|
|
isHovered: root.isHovered
|
|
|
|
|
isMessageActive: root.isMessageActive
|
2021-10-01 15:58:36 +00:00
|
|
|
|
isActivityCenterMessage: activityCenterMessage
|
2021-12-08 21:20:43 +00:00
|
|
|
|
stickersLoaded: root.stickersLoaded
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onClickMessage: {
|
2021-12-14 14:19:55 +00:00
|
|
|
|
root.clickMessage(isProfileClick, isSticker, isImage, null, false, false, false, false, "");
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-12-08 21:20:43 +00:00
|
|
|
|
onOpenStickerPackPopup: {
|
2022-01-13 19:25:38 +00:00
|
|
|
|
root.openStickerPackPopup(root.stickerPack);
|
2021-12-08 21:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onSetMessageActive: {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
setMessageActive(messageId, active);
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-02-01 18:40:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: linksLoader
|
2021-12-09 12:53:40 +00:00
|
|
|
|
active: !!linkUrls
|
2022-02-16 19:37:03 +00:00
|
|
|
|
height: item ? item.height : 0
|
2021-02-01 18:40:55 +00:00
|
|
|
|
anchors.top: chatText.bottom
|
|
|
|
|
anchors.topMargin: active ? Style.current.halfPadding : 0
|
|
|
|
|
|
|
|
|
|
sourceComponent: Component {
|
2021-10-01 15:58:36 +00:00
|
|
|
|
LinksMessageView {
|
2022-01-25 12:56:53 +00:00
|
|
|
|
linkUrls: root.linkUrls
|
2021-01-25 20:50:42 +00:00
|
|
|
|
container: root.container
|
2022-01-25 12:56:53 +00:00
|
|
|
|
messageStore: root.messageStore
|
2022-02-11 21:41:34 +00:00
|
|
|
|
store: root.store
|
2022-02-18 19:39:04 +00:00
|
|
|
|
isCurrentUser: root.amISender
|
2021-01-25 20:50:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: audioPlayerLoader
|
|
|
|
|
active: isAudio
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: active ? Style.current.halfPadding : 0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
sourceComponent: Component {
|
2021-10-01 15:58:36 +00:00
|
|
|
|
AudioPlayerPanel {
|
2021-02-01 18:40:55 +00:00
|
|
|
|
audioSource: audio
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-16 14:51:12 +00:00
|
|
|
|
|
2022-01-04 12:06:05 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: transactionBubbleLoader
|
|
|
|
|
active: contentType === Constants.messageContentType.transactionType
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: active ? (chatName.visible ? 4 : 6) : 0
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
TransactionBubbleView {
|
2022-02-09 00:04:49 +00:00
|
|
|
|
transactionParams: root.transactionParams
|
|
|
|
|
store: root.store
|
2022-01-04 12:06:05 +00:00
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-30 14:45:13 +00:00
|
|
|
|
|
|
|
|
|
Loader {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
active: contentType === Constants.messageContentType.communityInviteType
|
2021-04-30 14:45:13 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: active ? 8 : 0
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
id: invitationBubble
|
2021-10-21 00:41:54 +00:00
|
|
|
|
InvitationBubbleView {
|
2022-02-24 15:04:59 +00:00
|
|
|
|
store: root.store
|
|
|
|
|
communityId: root.communityId
|
2021-04-30 14:45:13 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-25 20:50:42 +00:00
|
|
|
|
}
|
2020-07-14 15:35:21 +00:00
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
|
2021-01-25 20:50:42 +00:00
|
|
|
|
Retry {
|
|
|
|
|
id: retry
|
2021-02-01 18:40:55 +00:00
|
|
|
|
anchors.left: chatTime.visible ? chatTime.right : messageContent.left
|
|
|
|
|
anchors.leftMargin: chatTime.visible ? chatHorizontalPadding : 0
|
2021-09-21 03:25:50 +00:00
|
|
|
|
anchors.top: chatTime.visible ? chatTime.top : messageContent.bottom
|
2021-02-01 18:40:55 +00:00
|
|
|
|
anchors.topMargin: chatTime.visible ? 0 : -4
|
2021-09-21 03:25:50 +00:00
|
|
|
|
anchors.bottom: chatTime.visible ? chatTime.bottom : undefined
|
2022-02-18 19:39:04 +00:00
|
|
|
|
isCurrentUser: root.amISender
|
2021-12-09 12:53:40 +00:00
|
|
|
|
isExpired: isExpired
|
|
|
|
|
timeout: timeout
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onClicked: {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
// rootStore.chatsModelInst.messageView.resendMessage(chatId, messageId)
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2020-10-23 19:46:44 +00:00
|
|
|
|
}
|
2021-02-01 18:40:55 +00:00
|
|
|
|
}
|
2020-10-23 19:46:44 +00:00
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
Loader {
|
2021-06-11 17:41:59 +00:00
|
|
|
|
active: !activityCenterMessage && (hasMention || pinnedMessage)
|
2021-02-01 18:40:55 +00:00
|
|
|
|
height: messageContainer.height
|
|
|
|
|
anchors.left: messageContainer.left
|
2021-05-25 19:34:46 +00:00
|
|
|
|
anchors.top: messageContainer.top
|
2020-07-30 16:07:41 +00:00
|
|
|
|
|
2021-02-01 18:40:55 +00:00
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: mentionBorder
|
2021-05-25 19:34:46 +00:00
|
|
|
|
color: pinnedMessage ? Style.current.pinnedMessageBorder : Style.current.mentionColor
|
2021-02-01 18:40:55 +00:00
|
|
|
|
width: 2
|
|
|
|
|
height: parent.height
|
2020-09-30 18:45:45 +00:00
|
|
|
|
}
|
2020-07-30 16:07:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-12 15:01:03 +00:00
|
|
|
|
|
2021-02-09 20:40:39 +00:00
|
|
|
|
HoverHandler {
|
2021-06-10 19:20:43 +00:00
|
|
|
|
enabled: !activityCenterMessage &&
|
2021-12-08 21:20:43 +00:00
|
|
|
|
(forceHoverHandler || (typeof root.messageContextMenu !== "undefined" && typeof Global.profilePopupOpened !== "undefined" &&
|
|
|
|
|
!root.messageContextMenu.opened && !Global.profilePopupOpened && !Global.popupOpened))
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onHoveredChanged: {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
setHovered(messageId, hovered);
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-01-25 20:50:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-12 15:01:03 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: emojiReactionLoader
|
2021-12-20 14:21:35 +00:00
|
|
|
|
active: reactionsModel.count > 0
|
2021-01-25 20:50:42 +00:00
|
|
|
|
anchors.bottom: messageContainer.bottom
|
2021-04-30 14:45:13 +00:00
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
2021-01-25 20:50:42 +00:00
|
|
|
|
anchors.left: messageContainer.left
|
2022-01-25 11:39:50 +00:00
|
|
|
|
anchors.leftMargin: messageContainer.messageContent.anchors.leftMargin
|
2020-08-12 15:01:03 +00:00
|
|
|
|
|
2020-09-30 18:45:45 +00:00
|
|
|
|
sourceComponent: Component {
|
2021-10-01 15:58:36 +00:00
|
|
|
|
EmojiReactionsPanel {
|
2021-08-25 20:31:00 +00:00
|
|
|
|
id: emojiRect
|
2022-01-25 11:39:50 +00:00
|
|
|
|
store: root.messageStore
|
2021-12-20 14:21:35 +00:00
|
|
|
|
emojiReactionsModel: reactionsModel
|
2021-10-01 15:58:36 +00:00
|
|
|
|
onHoverChanged: {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
setHovered(messageId, hovered)
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-12-09 12:53:40 +00:00
|
|
|
|
isMessageActive: isMessageActive
|
2022-02-18 19:39:04 +00:00
|
|
|
|
isCurrentUser: root.amISender
|
2021-07-16 15:02:47 +00:00
|
|
|
|
onAddEmojiClicked: {
|
2022-02-24 12:15:02 +00:00
|
|
|
|
if(root.isChatBlocked)
|
|
|
|
|
return
|
2021-07-16 15:02:47 +00:00
|
|
|
|
root.addEmoji(false, false, false, null, true, false);
|
2021-08-25 20:31:00 +00:00
|
|
|
|
// Set parent, X & Y positions for the messageContextMenu
|
2021-12-09 12:53:40 +00:00
|
|
|
|
root.messageContextMenu.parent = emojiReactionLoader
|
|
|
|
|
root.messageContextMenu.setXPosition = function() { return (root.messageContextMenu.parent.x + 4)}
|
|
|
|
|
root.messageContextMenu.setYPosition = function() { return (-root.messageContextMenu.height - 4)}
|
2021-07-16 15:02:47 +00:00
|
|
|
|
}
|
2021-12-20 14:21:35 +00:00
|
|
|
|
|
2022-01-25 11:39:50 +00:00
|
|
|
|
onToggleReaction: {
|
2022-02-24 12:15:02 +00:00
|
|
|
|
if(root.isChatBlocked)
|
|
|
|
|
return
|
|
|
|
|
|
2022-01-25 11:39:50 +00:00
|
|
|
|
if(!root.messageStore)
|
|
|
|
|
{
|
|
|
|
|
console.error("reaction cannot be toggled, message store is not valid")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
root.messageStore.toggleReaction(messageId, emojiID)
|
|
|
|
|
}
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
|
|
onSetMessageActive: {
|
2021-12-09 12:53:40 +00:00
|
|
|
|
setMessageActive(messageId, active);;
|
2021-10-01 15:58:36 +00:00
|
|
|
|
}
|
2021-01-25 20:50:42 +00:00
|
|
|
|
}
|
2020-09-30 18:45:45 +00:00
|
|
|
|
}
|
2020-08-12 15:01:03 +00:00
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
|
}
|