diff --git a/src/app/modules/main/activity_center/module.nim b/src/app/modules/main/activity_center/module.nim
index bc566d85a23..8834e2777e2 100644
--- a/src/app/modules/main/activity_center/module.nim
+++ b/src/app/modules/main/activity_center/module.nim
@@ -75,7 +75,7 @@ proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: Ch
chatDetails.communityId, # we don't received community id via `activityCenterNotifications` api call
message.responseTo,
message.`from`,
- contactDetails.displayName,
+ contactDetails.details.displayName,
contactDetails.details.localNickname,
contactDetails.icon,
contactDetails.isCurrentUser,
@@ -93,7 +93,8 @@ proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: Ch
message.links,
newTransactionParametersItem("","","","","","",-1,""),
message.mentionedUsersPks,
- contactDetails.details.trustStatus
+ contactDetails.details.trustStatus,
+ contactDetails.details.ensVerified
))
method convertToItems*(
diff --git a/src/app/modules/main/chat_section/chat_content/messages/module.nim b/src/app/modules/main/chat_section/chat_content/messages/module.nim
index 2e15916cb7d..3410485b852 100644
--- a/src/app/modules/main/chat_section/chat_content/messages/module.nim
+++ b/src/app/modules/main/chat_section/chat_content/messages/module.nim
@@ -94,7 +94,8 @@ proc createFetchMoreMessagesItem(self: Module): Item =
@[],
newTransactionParametersItem("","","","","","",-1,""),
@[],
- TrustStatus.Unknown
+ TrustStatus.Unknown,
+ false
)
proc createChatIdentifierItem(self: Module): Item =
@@ -131,7 +132,8 @@ proc createChatIdentifierItem(self: Module): Item =
@[],
newTransactionParametersItem("","","","","","",-1,""),
@[],
- TrustStatus.Unknown
+ TrustStatus.Unknown,
+ false
)
proc checkIfMessageLoadedAndScrollToItIfItIs(self: Module): bool =
@@ -177,7 +179,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
m.communityId,
m.responseTo,
m.`from`,
- sender.displayName,
+ sender.details.displayName,
sender.details.localNickname,
sender.icon,
isCurrentUser,
@@ -203,6 +205,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
m.transactionParameters.signature),
m.mentionedUsersPks(),
sender.details.trustStatus,
+ sender.details.ensVerified
)
for r in reactions:
@@ -265,7 +268,7 @@ method messageAdded*(self: Module, message: MessageDto) =
message.communityId,
message.responseTo,
message.`from`,
- sender.displayName,
+ sender.details.displayName,
sender.details.localNickname,
sender.icon,
isCurrentUser,
@@ -291,6 +294,7 @@ method messageAdded*(self: Module, message: MessageDto) =
message.transactionParameters.signature),
message.mentionedUsersPks,
sender.details.trustStatus,
+ sender.details.ensVerified
)
self.view.model().insertItemBasedOnTimestamp(item)
@@ -399,7 +403,7 @@ method updateContactDetails*(self: Module, contactId: string) =
let updatedContact = self.controller.getContactDetails(contactId)
for item in self.view.model().modelContactUpdateIterator(contactId):
if(item.senderId == contactId):
- item.senderDisplayName = updatedContact.displayName
+ item.senderDisplayName = updatedContact.details.displayName
item.senderLocalName = updatedContact.details.localNickname
item.senderIcon = updatedContact.icon
item.senderIsAdded = updatedContact.details.added
diff --git a/src/app/modules/main/chat_section/chat_content/module.nim b/src/app/modules/main/chat_section/chat_content/module.nim
index 25bc6265361..14230c4cd13 100644
--- a/src/app/modules/main/chat_section/chat_content/module.nim
+++ b/src/app/modules/main/chat_section/chat_content/module.nim
@@ -167,7 +167,7 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
m.communityId,
m.responseTo,
m.`from`,
- contactDetails.displayName,
+ contactDetails.details.displayName,
contactDetails.details.localNickname,
contactDetails.icon,
isCurrentUser,
@@ -193,6 +193,7 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
m.transactionParameters.signature),
m.mentionedUsersPks,
contactDetails.details.trustStatus,
+ contactDetails.details.ensVerified
)
item.pinned = true
item.pinnedBy = actionInitiatedBy
@@ -318,8 +319,9 @@ method onContactDetailsUpdated*(self: Module, contactId: string) =
let updatedContact = self.controller.getContactDetails(contactId)
for item in self.view.pinnedModel().modelContactUpdateIterator(contactId):
if(item.senderId == contactId):
- item.senderDisplayName = updatedContact.displayName
+ item.senderDisplayName = updatedContact.details.displayName
item.senderLocalName = updatedContact.details.localNickname
+ item.senderEnsVerified = updatedContact.details.ensVerified
item.senderIcon = updatedContact.icon
item.senderTrustStatus = updatedContact.details.trustStatus
if(item.messageContainsMentions):
@@ -329,7 +331,7 @@ method onContactDetailsUpdated*(self: Module, contactId: string) =
item.messageContainsMentions = m.containsContactMentions()
if(self.controller.getMyChatId() == contactId):
- self.view.updateChatDetailsNameAndIcon(updatedContact.displayName, updatedContact.icon)
+ self.view.updateChatDetailsNameAndIcon(updatedContact.details.displayName, updatedContact.icon)
self.view.updateTrustStatus(updatedContact.details.trustStatus == TrustStatus.Untrustworthy)
method onNotificationsUpdated*(self: Module, hasUnreadMessages: bool, notificationCount: int) =
diff --git a/src/app/modules/main/chat_section/chat_content/users/module.nim b/src/app/modules/main/chat_section/chat_content/users/module.nim
index dacf912d5c9..4120b85067a 100644
--- a/src/app/modules/main/chat_section/chat_content/users/module.nim
+++ b/src/app/modules/main/chat_section/chat_content/users/module.nim
@@ -132,7 +132,7 @@ method addChatMember*(self: Module, member: ChatMember) =
let isMe = member.id == singletonInstance.userProfile.getPubKey()
let contactDetails = self.controller.getContactDetails(member.id)
var status = OnlineStatus.Online
- var displayName = contactDetails.displayName
+ var displayName = contactDetails.details.displayName
if (isMe):
displayName = displayName & " (You)"
let currentUserStatus = intToEnum(singletonInstance.userProfile.getCurrentUserStatus(), StatusType.Unknown)
@@ -143,7 +143,7 @@ method addChatMember*(self: Module, member: ChatMember) =
self.view.model().addItem(initMemberItem(
pubKey = member.id,
- displayName = displayName,
+ displayName = contactDetails.details.displayName,
ensName = contactDetails.details.name,
localNickname = contactDetails.details.localNickname,
alias = contactDetails.details.alias,
@@ -181,7 +181,7 @@ method onChatMemberUpdated*(self: Module, publicKey: string, admin: bool, joined
let contactDetails = self.controller.getContactDetails(publicKey)
self.view.model().updateItem(
pubKey = publicKey,
- displayName = contactDetails.displayName,
+ displayName = contactDetails.details.displayName,
ensName = contactDetails.details.name,
localNickname = contactDetails.details.localNickname,
alias = contactDetails.details.alias,
diff --git a/src/app/modules/main/profile_section/notifications/module.nim b/src/app/modules/main/profile_section/notifications/module.nim
index 34a75246eb8..7ddaee7338f 100644
--- a/src/app/modules/main/profile_section/notifications/module.nim
+++ b/src/app/modules/main/profile_section/notifications/module.nim
@@ -65,7 +65,7 @@ proc createChatItem(self: Module, chatDto: ChatDto): Item =
var itemType = item.Type.GroupChat
if(chatDto.chatType == ChatType.OneToOne):
let contactDetails = self.controller.getContactDetails(chatDto.id)
- chatName = contactDetails.displayName
+ chatName = contactDetails.details.displayName
chatImage = contactDetails.icon
itemType = item.Type.OneToOneChat
diff --git a/src/app/modules/shared_models/message_item.nim b/src/app/modules/shared_models/message_item.nim
index a6ada2e8008..fcbef8d0c9b 100644
--- a/src/app/modules/shared_models/message_item.nim
+++ b/src/app/modules/shared_models/message_item.nim
@@ -37,6 +37,7 @@ type
transactionParameters: TransactionParametersItem
mentionedUsersPks: seq[string]
senderTrustStatus: TrustStatus
+ senderEnsVerified: bool
proc initItem*(
id,
@@ -61,7 +62,8 @@ proc initItem*(
links: seq[string],
transactionParameters: TransactionParametersItem,
mentionedUsersPks: seq[string],
- senderTrustStatus: TrustStatus
+ senderTrustStatus: TrustStatus,
+ senderEnsVerified: bool
): Item =
result = Item()
result.id = id
@@ -93,6 +95,7 @@ proc initItem*(
result.gapFrom = 0
result.gapTo = 0
result.senderTrustStatus = senderTrustStatus
+ result.senderEnsVerified = senderEnsVerified
proc `$`*(self: Item): string =
result = fmt"""Item(
@@ -120,6 +123,7 @@ proc `$`*(self: Item): string =
transactionParameters:{$self.transactionParameters},
mentionedUsersPks:{$self.mentionedUsersPks},
senderTrustStatus:{$self.senderTrustStatus},
+ senderEnsVerified: {self.senderEnsVerified},
)"""
proc id*(self: Item): string {.inline.} =
@@ -167,6 +171,12 @@ proc senderTrustStatus*(self: Item): TrustStatus {.inline.} =
proc `senderTrustStatus=`*(self: Item, value: TrustStatus) {.inline.} =
self.senderTrustStatus = value
+proc senderEnsVerified*(self: Item): bool {.inline.} =
+ self.senderEnsVerified
+
+proc `senderEnsVerified=`*(self: Item, value: bool) {.inline.} =
+ self.senderEnsVerified = value
+
proc outgoingStatus*(self: Item): string {.inline.} =
self.outgoingStatus
@@ -274,7 +284,8 @@ proc toJsonNode*(self: Item): JsonNode =
"editMode": self.editMode,
"isEdited": self.isEdited,
"links": self.links,
- "mentionedUsersPks": self.mentionedUsersPks
+ "mentionedUsersPks": self.mentionedUsersPks,
+ "senderEnsVerified": self.senderEnsVerified
}
proc editMode*(self: Item): bool {.inline.} =
diff --git a/src/app/modules/shared_models/message_item_qobject.nim b/src/app/modules/shared_models/message_item_qobject.nim
index cda1eb89d0c..f9e68db7006 100644
--- a/src/app/modules/shared_models/message_item_qobject.nim
+++ b/src/app/modules/shared_models/message_item_qobject.nim
@@ -49,6 +49,10 @@ QtObject:
QtProperty[string] senderLocalName:
read = senderLocalName
+ proc senderEnsVerified*(self: MessageItem): bool {.slot.} = result = ?.self.messageItem.senderEnsVerified
+ QtProperty[bool] senderEnsVerified:
+ read = senderEnsVerified
+
proc amISender*(self: MessageItem): bool {.slot.} = result = ?.self.messageItem.amISender
QtProperty[bool] amISender:
read = amISender
diff --git a/src/app/modules/shared_models/message_model.nim b/src/app/modules/shared_models/message_model.nim
index 3a00f7d6f26..4903847deff 100644
--- a/src/app/modules/shared_models/message_model.nim
+++ b/src/app/modules/shared_models/message_model.nim
@@ -37,6 +37,7 @@ type
TransactionParameters
MentionedUsersPks
SenderTrustStatus
+ SenderEnsVerified
QtObject:
type
@@ -70,7 +71,7 @@ QtObject:
proc countChanged(self: Model) {.signal.}
proc getCount(self: Model): int {.slot.} =
self.items.len
- QtProperty[int] count:
+ QtProperty[int]count:
read = getCount
notify = countChanged
@@ -110,7 +111,8 @@ QtObject:
ModelRole.Links.int: "links",
ModelRole.TransactionParameters.int: "transactionParameters",
ModelRole.MentionedUsersPks.int: "mentionedUsersPks",
- ModelRole.SenderTrustStatus.int: "senderTrustStatus"
+ ModelRole.SenderTrustStatus.int: "senderTrustStatus",
+ ModelRole.SenderEnsVerified.int: "senderEnsVerified"
}.toTable
method data(self: Model, index: QModelIndex, role: int): QVariant =
@@ -197,6 +199,8 @@ QtObject:
}))
of ModelRole.MentionedUsersPks:
result = newQVariant(item.mentionedUsersPks.join(" "))
+ of ModelRole.SenderEnsVerified:
+ result = newQVariant(item.senderEnsVerified)
proc updateItemAtIndex(self: Model, index: int) =
let ind = self.createIndex(index, 0, nil)
@@ -369,8 +373,12 @@ QtObject:
var roles: seq[int]
if(self.items[i].senderId == contactId):
- roles = @[ModelRole.SenderDisplayName.int, ModelRole.SenderLocalName.int,
- ModelRole.SenderIcon.int, ModelRole.SenderIsAdded.int, ModelRole.SenderTrustStatus.int]
+ roles = @[ModelRole.SenderDisplayName.int,
+ ModelRole.SenderLocalName.int,
+ ModelRole.SenderIcon.int,
+ ModelRole.SenderIsAdded.int,
+ ModelRole.SenderTrustStatus.int,
+ ModelRole.SenderEnsVerified.int]
if(self.items[i].pinnedBy == contactId):
roles.add(ModelRole.PinnedBy.int)
if(self.items[i].messageContainsMentions):
diff --git a/ui/StatusQ b/ui/StatusQ
index e0fd627050b..48df36b156a 160000
--- a/ui/StatusQ
+++ b/ui/StatusQ
@@ -1 +1 @@
-Subproject commit e0fd627050b45440132acce69c8c317f4efe129a
+Subproject commit 48df36b156a78c7d6e7f869f478bd0755dc02d75
diff --git a/ui/app/AppLayouts/Chat/controls/activityCenter/ChannelBadge.qml b/ui/app/AppLayouts/Chat/controls/activityCenter/ChannelBadge.qml
index b9165065159..876a1ee1cd1 100644
--- a/ui/app/AppLayouts/Chat/controls/activityCenter/ChannelBadge.qml
+++ b/ui/app/AppLayouts/Chat/controls/activityCenter/ChannelBadge.qml
@@ -50,8 +50,8 @@ Item {
StyledText {
id: contactInfo
text: realChatType !== Constants.chatType.publicChat ?
- StatusQUtils.Emoji.parse(Utils.removeStatusEns(Utils.filterXSS(name))) :
- "#" + Utils.filterXSS(name)
+ StatusQUtils.Emoji.parse(Utils.removeStatusEns(StatusQUtils.filterXSS(name))) :
+ "#" + StatusQUtils.filterXSS(name)
anchors.left: contactImage.right
anchors.leftMargin: 4
color: textColor
diff --git a/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml b/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml
index 0ae8dce3ee2..2933c6df82f 100644
--- a/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml
+++ b/ui/app/AppLayouts/Chat/controls/activityCenter/ReplyComponent.qml
@@ -24,7 +24,7 @@ Item {
}
StyledTextEdit {
- text: Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(Utils.linkifyAndXSS(repliedMessageContent), StatusQUtils.Emoji.size.small), false)
+ text: Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(StatusQUtils.Utils.linkifyAndXSS(repliedMessageContent), StatusQUtils.Emoji.size.small), false)
textFormat: Text.RichText
height: 18
width: implicitWidth > 300 ? 300 : implicitWidth
diff --git a/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml b/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml
index 25c9a43b0df..70acd164ccb 100644
--- a/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml
+++ b/ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml
@@ -104,7 +104,7 @@ ModalPopup {
MessageView {
id: messageItem
- store: popup.store
+ rootStore: popup.store
messageStore: popup.messageStore
messageContextMenu: msgContextMenu
@@ -115,7 +115,7 @@ ModalPopup {
senderLocalName: model.senderLocalName
senderIcon: model.senderIcon
amISender: model.amISender
- message: model.messageText
+ messageText: model.messageText
messageImage: model.messageImage
messageTimestamp: model.timestamp
messageOutgoingStatus: model.outgoingStatus
diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml
index 2b20fd0d0ef..4230f265d24 100644
--- a/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml
+++ b/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml
@@ -4,6 +4,7 @@ import QtQuick.Dialogs 1.3
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
+import StatusQ.Core.Utils 0.1 as StatusQUtils
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1
@@ -218,9 +219,9 @@ StatusModal {
let error = ""
if (isEdit) {
- error = root.store.editCommunityCategory(root.categoryId, Utils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
+ error = root.store.editCommunityCategory(root.categoryId, StatusQUtils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
} else {
- error = root.store.createCommunityCategory(Utils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
+ error = root.store.createCommunityCategory(StatusQUtils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
}
if (error) {
diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml
index c067d2e7521..84cdffe9c60 100644
--- a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml
+++ b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml
@@ -300,14 +300,14 @@ StatusModal {
if (!isEdit) {
//popup.contentItem.communityColor.color.toString().toUpperCase()
- popup.createCommunityChannel(Utils.filterXSS(popup.contentItem.channelName.input.text),
- Utils.filterXSS(popup.contentItem.channelDescription.input.text),
+ popup.createCommunityChannel(StatusQUtils.filterXSS(popup.contentItem.channelName.input.text),
+ StatusQUtils.filterXSS(popup.contentItem.channelDescription.input.text),
emoji,
popup.contentItem.channelColorDialog.color.toString().toUpperCase(),
popup.categoryId)
} else {
- popup.editCommunityChannel(Utils.filterXSS(popup.contentItem.channelName.input.text),
- Utils.filterXSS(popup.contentItem.channelDescription.input.text),
+ popup.editCommunityChannel(StatusQUtils.filterXSS(popup.contentItem.channelName.input.text),
+ StatusQUtils.filterXSS(popup.contentItem.channelDescription.input.text),
emoji,
popup.contentItem.channelColorDialog.color.toString().toUpperCase(),
popup.categoryId)
diff --git a/ui/app/AppLayouts/Chat/stores/MessageStore.qml b/ui/app/AppLayouts/Chat/stores/MessageStore.qml
index ca298a98254..839e23ec5b5 100644
--- a/ui/app/AppLayouts/Chat/stores/MessageStore.qml
+++ b/ui/app/AppLayouts/Chat/stores/MessageStore.qml
@@ -135,10 +135,12 @@ QtObject {
return messageModule.toggleReaction(messageId, emojiId)
}
+ // TODO: Remove. Moved to StatusQ.
function lastTwoItems(nodes) {
return nodes.join(qsTr(" and "));
}
+ // TODO: Remove. Moved to StatusQ.
function showReactionAuthors(jsonArrayOfUsersReactedWithThisEmoji, emojiId) {
let listOfUsers = JSON.parse(jsonArrayOfUsersReactedWithThisEmoji)
if (listOfUsers.error) {
diff --git a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml
index da99b2045eb..2b189d3ce0c 100644
--- a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml
+++ b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml
@@ -124,11 +124,11 @@ Item {
MessageView {
id: notificationMessage
anchors.right: undefined
- store: root.store
+ rootStore: root.store
messageStore: root.store.messageStore
messageId: model.id
senderDisplayName: model.message.senderDisplayName
- message: model.message.messageText
+ messageText: model.message.messageText
responseToMessageWithId: model.message.responseToMessageWithId
senderId: model.message.senderId
senderLocalName: model.message.senderLocalName
@@ -143,7 +143,7 @@ Item {
read: model.read
onImageClicked: Global.openImagePopup(image, root.messageContextMenu)
scrollToBottom: null
- clickMessage: function (isProfileClick) {
+ messageClickHandler: {
if (isProfileClick) {
return Global.openProfilePopup(model.message.senderId);
}
diff --git a/ui/app/AppLayouts/Chat/views/ChatContentView.qml b/ui/app/AppLayouts/Chat/views/ChatContentView.qml
index 070984cd1b0..2a1b7e0641a 100644
--- a/ui/app/AppLayouts/Chat/views/ChatContentView.qml
+++ b/ui/app/AppLayouts/Chat/views/ChatContentView.qml
@@ -93,7 +93,7 @@ ColumnLayout {
if(cnt > 1) return qsTr("%1 members").arg(cnt);
return qsTr("1 member");
case Constants.chatType.communityChat:
- return Utils.linkifyAndXSS(chatContentModule.chatDetails.description).trim()
+ return StatusQUtils.Utils.linkifyAndXSS(chatContentModule.chatDetails.description).trim()
default:
return ""
}
@@ -159,10 +159,11 @@ ColumnLayout {
Component {
id: contactsSelector
GroupChatPanel {
- sectionModule: root.chatSectionModule
+ sectionModule: chatSectionModule
chatContentModule: root.chatContentModule
rootStore: root.rootStore
maxHeight: root.height
+
onPanelClosed: topBar.toolbarComponent = statusChatInfoButton
}
}
@@ -425,9 +426,10 @@ ColumnLayout {
id: chatMessages
Layout.fillWidth: true
Layout.fillHeight: true
- store: root.rootStore
+ chatContentModule: root.chatContentModule
+ rootStore: root.rootStore
contactsStore: root.contactsStore
- messageContextMenuInst: contextmenu
+ messageContextMenu: contextmenu
messageStore: messageStore
emojiPopup: root.emojiPopup
usersStore: root.usersStore
@@ -452,8 +454,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.fillWidth: true
Layout.preferredWidth: parent.width
- height: chatInput.height
- Layout.preferredHeight: height
+ Layout.preferredHeight: chatInput.implicitHeight + chatInput.anchors.leftMargin + chatInput.anchors.rightMargin
Loader {
id: loadingMessagesIndicator
@@ -470,6 +471,10 @@ ColumnLayout {
StatusChatInput {
id: chatInput
+
+ anchors.fill: parent
+ anchors.margins: Style.current.smallPadding
+
store: root.rootStore
usersStore: root.usersStore
diff --git a/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml b/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml
index fc04c22ae4e..5ca5c19361f 100644
--- a/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml
+++ b/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml
@@ -14,7 +14,10 @@ import shared.popups 1.0
import shared.status 1.0
import shared.controls 1.0
import shared.views.chat 1.0
+
import StatusQ.Core 0.1
+import StatusQ.Core.Theme 0.1
+import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import "../controls"
@@ -22,7 +25,8 @@ import "../controls"
Item {
id: root
- property var store
+ property var chatContentModule
+ property var rootStore
property var messageStore
property var usersStore
property var contactsStore
@@ -35,7 +39,7 @@ Item {
property bool isChatBlocked: false
property bool isActiveChannel: false
- property var messageContextMenuInst
+ property var messageContextMenu
property real scrollY: chatLogView.visibleArea.yPosition * chatLogView.contentHeight
property int newMessages: 0
@@ -65,23 +69,23 @@ Item {
}
// Not Refactored Yet
-// onNewMessagePushed: {
-// if (!chatLogView.scrollToBottom()) {
-// newMessages++
-// }
-// }
+ // onNewMessagePushed: {
+ // if (!chatLogView.scrollToBottom()) {
+ // newMessages++
+ // }
+ // }
}
Item {
id: loadingMessagesIndicator
- visible: root.store.loadingHistoryMessagesInProgress
+ visible: root.rootStore.loadingHistoryMessagesInProgress
anchors.top: parent.top
anchors.left: parent.left
height: visible? 20 : 0
width: parent.width
Loader {
- active: root.store.loadingHistoryMessagesInProgress
+ active: root.rootStore.loadingHistoryMessagesInProgress
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
sourceComponent: Component {
@@ -95,6 +99,19 @@ Item {
ListView {
id: chatLogView
+
+ function checkHeaderHeight() {
+ if (!chatLogView.headerItem) {
+ return
+ }
+
+ if (chatLogView.contentItem.height - chatLogView.headerItem.height < chatLogView.height) {
+ chatLogView.headerItem.height = chatLogView.height - (chatLogView.contentItem.height - chatLogView.headerItem.height) - 36
+ } else {
+ chatLogView.headerItem.height = 0
+ }
+ }
+
anchors.top: loadingMessagesIndicator.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
@@ -104,23 +121,15 @@ Item {
clip: true
verticalLayoutDirection: ListView.BottomToTop
- // This header and Connections is to create an invisible padding so that the chat identifier is at the top
- // The Connections is necessary, because doing the check inside the header created a binding loop (the contentHeight includes the header height
- // If the content height is smaller than the full height, we "show" the padding so that the chat identifier is at the top, otherwise we disable the Connections
- header: Item {
- height: 0
- width: chatLogView.width
- }
+ model: messageStore.messagesModel
- function checkHeaderHeight() {
- if (!chatLogView.headerItem) {
- return
- }
+ Component.onCompleted: chatLogView.scrollToBottom(true)
- if (chatLogView.contentItem.height - chatLogView.headerItem.height < chatLogView.height) {
- chatLogView.headerItem.height = chatLogView.height - (chatLogView.contentItem.height - chatLogView.headerItem.height) - 36
- } else {
- chatLogView.headerItem.height = 0
+ onContentYChanged: {
+ scrollDownButton.visible = contentHeight - (scrollY + height) > 400
+ let loadMore = scrollDownButton.visible && scrollY < 500
+ if(loadMore){
+ messageStore.loadMoreMessages()
}
}
@@ -128,26 +137,55 @@ Item {
visible: chatLogView.visibleArea.heightRatio < 1
}
-// Connections {
-// id: contentHeightConnection
-// enabled: true
-// target: chatLogView
-// onContentHeightChanged: {
-// chatLogView.checkHeaderHeight()
-// }
-// onHeightChanged: {
-// chatLogView.checkHeaderHeight()
-// }
-// }
+ // This header and Connections is to create an invisible padding so that the chat identifier is at the top
+ // The Connections is necessary, because doing the check inside the header created a binding loop (the contentHeight includes the header height
+ // If the content height is smaller than the full height, we "show" the padding so that the chat identifier is at the top, otherwise we disable the Connections
+ header: Item {
+ height: 0
+ width: chatLogView.width
+ }
+
+ // Connections {
+ // id: contentHeightConnection
+ // enabled: true
+ // target: chatLogView
+ // onContentHeightChanged: {
+ // chatLogView.checkHeaderHeight()
+ // }
+ // onHeightChanged: {
+ // chatLogView.checkHeaderHeight()
+ // }
+ // }
Timer {
id: timer
}
Button {
+ id: scrollDownButton
+
readonly property int buttonPadding: 5
- id: scrollDownButton
+
+ function scrollToBottom(force, caller) {
+ if (!force && !chatLogView.atYEnd) {
+ // User has scrolled up, we don't want to scroll back
+ return false
+ }
+ if (caller && caller !== chatLogView.itemAtIndex(chatLogView.count - 1)) {
+ // If we have a caller, only accept its request if it's the last message
+ return false
+ }
+ // Call this twice and with a timer since the first scroll to bottom might have happened before some stuff loads
+ // meaning that the scroll will not actually be at the bottom on switch
+ // Add a small delay because images, even though they say they say they are loaed, they aren't shown yet
+ Qt.callLater(chatLogView.positionViewAtBeginning)
+ timer.setTimeout(function() {
+ Qt.callLater(chatLogView.positionViewAtBeginning)
+ }, 100);
+ return true
+ }
+
visible: false
height: 32
width: nbMessages.width + arrowImage.width + 2 * Style.current.halfPadding + (nbMessages.visible ? scrollDownButton.buttonPadding : 0)
@@ -159,6 +197,7 @@ Item {
border.width: 0
radius: 16
}
+
onClicked: {
newMessages = 0
scrollDownButton.visible = false
@@ -201,50 +240,23 @@ Item {
}
}
- function scrollToBottom(force, caller) {
- if (!force && !chatLogView.atYEnd) {
- // User has scrolled up, we don't want to scroll back
- return false
- }
- if (caller && caller !== chatLogView.itemAtIndex(chatLogView.count - 1)) {
- // If we have a caller, only accept its request if it's the last message
- return false
- }
- // Call this twice and with a timer since the first scroll to bottom might have happened before some stuff loads
- // meaning that the scroll will not actually be at the bottom on switch
- // Add a small delay because images, even though they say they say they are loaed, they aren't shown yet
- Qt.callLater(chatLogView.positionViewAtBeginning)
- timer.setTimeout(function() {
- Qt.callLater(chatLogView.positionViewAtBeginning)
- }, 100);
- return true
- }
-
-// Connections {
+ // Connections {
// Not Refactored Yet
-// target: root.store.chatsModelInst
-
-// onAppReady: {
-// chatLogView.scrollToBottom(true)
-// }
-// }
+ // target: root.rootStore.chatsModelInst
- onContentYChanged: {
- scrollDownButton.visible = contentHeight - (scrollY + height) > 400
- let loadMore = scrollDownButton.visible && scrollY < 500
- if(loadMore){
- messageStore.loadMoreMessages()
- }
- }
-
- model: messageStore.messagesModel
-
- Component.onCompleted: chatLogView.scrollToBottom(true)
+ // onAppReady: {
+ // chatLogView.scrollToBottom(true)
+ // }
+ // }
delegate: MessageView {
id: msgDelegate
- store: root.store
+ width: ListView.view.width
+
+ newComponentEnabled: messageComponentSwitch.checked
+
+ rootStore: root.rootStore
messageStore: root.messageStore
usersStore: root.usersStore
contactsStore: root.contactsStore
@@ -253,7 +265,7 @@ Item {
isActiveChannel: root.isActiveChannel
isChatBlocked: root.isChatBlocked
- messageContextMenu: messageContextMenuInst
+ messageContextMenu: root.messageContextMenu
itemIndex: index
messageId: model.id
@@ -262,10 +274,11 @@ Item {
senderId: model.senderId
senderDisplayName: model.senderDisplayName
senderLocalName: model.senderLocalName
+ senderEnsName: model.senderEnsVerified ? model.senderDisplayName : ""
senderIcon: model.senderIcon
senderIsAdded: model.senderIsAdded
amISender: model.amISender
- message: model.messageText
+ messageText: model.messageText
messageImage: model.messageImage
messageTimestamp: model.timestamp
messageOutgoingStatus: model.outgoingStatus
@@ -301,7 +314,7 @@ Item {
root.showReplyArea(messageId, author)
}
- onImageClicked: Global.openImagePopup(image, messageContextMenuInst)
+ onImageClicked: Global.openImagePopup(image, messageContextMenu) // ✅
stickersLoaded: root.stickersLoaded
@@ -312,6 +325,17 @@ Item {
}
}
+ StatusSwitch {
+ id: messageComponentSwitch
+ anchors {
+ top: parent.top
+ right: parent.right
+ margins: 10
+
+ }
+ text: "Use StatusMessage"
+ }
+
MessageDialog {
id: sendingMsgFailedPopup
standardButtons: StandardButton.Ok
diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml
index b0a3a0c91fe..590498c76fa 100644
--- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml
+++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml
@@ -10,6 +10,7 @@ import shared.popups 1.0
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
+import StatusQ.Core.Utils 0.1 as StatusQUtils
import StatusQ.Layout 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
@@ -147,10 +148,10 @@ StatusAppTwoPanelLayout {
onEdited: {
const error = root.chatCommunitySectionModule.editCommunity(
- Utils.filterXSS(item.name),
- Utils.filterXSS(item.description),
- Utils.filterXSS(item.introMessage),
- Utils.filterXSS(item.outroMessage),
+ StatusQUtils.filterXSS(item.name),
+ StatusQUtils.filterXSS(item.description),
+ StatusQUtils.filterXSS(item.introMessage),
+ StatusQUtils.filterXSS(item.outroMessage),
item.options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess : Constants.communityChatPublicAccess,
item.color.toString().toUpperCase(),
item.selectedTags,
diff --git a/ui/app/AppLayouts/CommunitiesPortal/popups/CreateCommunityPopup.qml b/ui/app/AppLayouts/CommunitiesPortal/popups/CreateCommunityPopup.qml
index 6b792f300f7..a97452f7c4a 100644
--- a/ui/app/AppLayouts/CommunitiesPortal/popups/CreateCommunityPopup.qml
+++ b/ui/app/AppLayouts/CommunitiesPortal/popups/CreateCommunityPopup.qml
@@ -10,6 +10,7 @@ import shared.popups 1.0
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
+import StatusQ.Core.Utils 0.1 as StatusQUtils
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1
@@ -153,10 +154,10 @@ StatusStackModal {
function createCommunity() {
const error = store.createCommunity({
- name: Utils.filterXSS(nameInput.input.text),
- description: Utils.filterXSS(descriptionTextInput.input.text),
- introMessage: Utils.filterXSS(introMessageInput.input.text),
- outroMessage: Utils.filterXSS(outroMessageInput.input.text),
+ name: StatusQUtils.filterXSS(nameInput.input.text),
+ description: StatusQUtils.filterXSS(descriptionTextInput.input.text),
+ introMessage: StatusQUtils.filterXSS(introMessageInput.input.text),
+ outroMessage: StatusQUtils.filterXSS(outroMessageInput.input.text),
color: colorPicker.color.toString().toUpperCase(),
tags: communityTagsPicker.selectedTags,
image: {
diff --git a/ui/app/AppLayouts/Profile/views/AppearanceView.qml b/ui/app/AppLayouts/Profile/views/AppearanceView.qml
index c10d55ffbad..e586b1f8f24 100644
--- a/ui/app/AppLayouts/Profile/views/AppearanceView.qml
+++ b/ui/app/AppLayouts/Profile/views/AppearanceView.qml
@@ -88,7 +88,7 @@ SettingsContentBase {
messageTimestamp:Date.now()
senderDisplayName: "@vitalik"
senderIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAb0lEQVR4Ae3UQQqAIBRF0Wj9ba9Bq6l5JBQqfn/ngDMH3YS3AAB/tO3H+XRG3b9bR/+gVoREI2RapVXpfd5+X5oXERKNkHS+rk3tOpWkeREh0QiZVu91ql2zNC8iJBoh0yqtSqt1slpCghICANDPBc0ESPh0bHkHAAAAAElFTkSuQmCC"
- message: qsTr("Blockchains will drop search costs, causing a kind of decomposition that allows you to have markets of entities that are horizontally segregated and vertically segregated.")
+ messageText: qsTr("Blockchains will drop search costs, causing a kind of decomposition that allows you to have markets of entities that are horizontally segregated and vertically segregated.")
messageContentType: Constants.messageContentType.messageType
placeholderMessage: true
}
diff --git a/ui/imports/shared/panels/chat/ChatReplyPanel.qml b/ui/imports/shared/panels/chat/ChatReplyPanel.qml
index d52096e7d3e..5987696ee3a 100644
--- a/ui/imports/shared/panels/chat/ChatReplyPanel.qml
+++ b/ui/imports/shared/panels/chat/ChatReplyPanel.qml
@@ -34,7 +34,7 @@ Loader {
property int chatHorizontalPadding
property string stickerData
- signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker, bool isReply)
+ signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker)
signal scrollToBottom(bool isit, var container)
sourceComponent: Component {
@@ -110,7 +110,7 @@ Loader {
pubkey: repliedMessageSenderPubkey
image: repliedMessageSenderIcon
- onClicked: root.clickMessage(true, false, false, null, false, false, true)
+ onClicked: root.clickMessage(true, false, false, null, false, false)
}
StyledTextEdit {
@@ -169,9 +169,9 @@ Loader {
text: {
if (repliedMessageIsEdited){
let index = repliedMessageContent.length - 4
- return Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(Utils.linkifyAndXSS(repliedMessageContent.slice(0, index) + Constants.editLabel + repliedMessageContent.slice(index)), StatusQUtils.Emoji.size.small), amISenderOfTheRepliedMessage)
+ return Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(StatusQUtils.Utils.linkifyAndXSS(repliedMessageContent.slice(0, index) + Constants.editLabel + repliedMessageContent.slice(index)), StatusQUtils.Emoji.size.small), amISenderOfTheRepliedMessage)
} else {
- return Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(Utils.linkifyAndXSS(repliedMessageContent), StatusQUtils.Emoji.size.small), amISenderOfTheRepliedMessage)
+ return Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(StatusQUtils.Utils.linkifyAndXSS(repliedMessageContent), StatusQUtils.Emoji.size.small), amISenderOfTheRepliedMessage)
}
}
textFormat: Text.RichText
diff --git a/ui/imports/shared/popups/ContactVerificationRequestPopup.qml b/ui/imports/shared/popups/ContactVerificationRequestPopup.qml
index ccea7857873..84109446d46 100644
--- a/ui/imports/shared/popups/ContactVerificationRequestPopup.qml
+++ b/ui/imports/shared/popups/ContactVerificationRequestPopup.qml
@@ -68,7 +68,7 @@ StatusModal {
messageTimestamp: root.messageTimestamp
senderDisplayName: root.senderDisplayName
senderIcon: root.senderIcon
- message: root.challengeText
+ messageText: root.challengeText
messageContentType: Constants.messageContentType.messageType
placeholderMessage: true
}
@@ -97,7 +97,7 @@ StatusModal {
messageTimestamp: root.responseTimestamp
senderDisplayName: userProfile.name
senderIcon: userProfile.icon
- message: root.responseText
+ messageText: root.responseText
messageContentType: Constants.messageContentType.messageType
placeholderMessage: true
}
diff --git a/ui/imports/shared/qmldir b/ui/imports/shared/qmldir
index 186cb844ced..085a8629e7d 100644
--- a/ui/imports/shared/qmldir
+++ b/ui/imports/shared/qmldir
@@ -4,4 +4,3 @@ DelegateModelGeneralized 1.0 DelegateModelGeneralized.qml
LoadingAnimation 1.0 LoadingAnimation.qml
MacTrafficLights 1.0 MacTrafficLights.qml
NumberPolyFill 1.0 polyfill.number.toLocaleString.js
-XSS 1.0 xss.js
diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml
index b2531fb7ac5..4d7309671b9 100644
--- a/ui/imports/shared/status/StatusChatInput.qml
+++ b/ui/imports/shared/status/StatusChatInput.qml
@@ -23,6 +23,7 @@ import StatusQ.Controls 0.1 as StatusQ
Rectangle {
id: control
+
signal sendTransactionCommandButtonClicked()
signal receiveTransactionCommandButtonClicked()
signal stickerSelected(string hashId, string packId)
@@ -75,20 +76,50 @@ Rectangle {
Bottom
}
- height: {
- if (extendedArea.visible) {
- return messageInput.height + extendedArea.height + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding)
- }
- if (messageInput.height > messageInput.defaultInputFieldHeight) {
- if (messageInput.height >= messageInput.maxInputFieldHeight) {
- return messageInput.maxInputFieldHeight + (control.isStatusUpdateInput ? 0 : Style.current.bigPadding)
+ function parseMessage(message) {
+ let mentionsMap = new Map()
+ let index = 0
+ while (true) {
+ index = message.indexOf("", index) + 4
+ if (endIndex < 0) {
+ index += 8 // " '
+ mentionsMap.set(mentionLink, mentionTag)
+ index += linkTag.length
}
- return control.isStatusUpdateInput ? 56 : 64
+
+ let text = message;
+
+ for (let [key, value] of mentionsMap)
+ text = text.replace(new RegExp(key, 'g'), value)
+
+ textInput.text = text
+ textInput.cursorPosition = textInput.length
}
- anchors.left: parent.left
- anchors.right: parent.right
+
+ implicitWidth: layout.implicitWidth + layout.anchors.leftMargin + layout.anchors.rightMargin
+ implicitHeight: layout.implicitHeight + layout.anchors.topMargin + layout.anchors.bottomMargin
color: Style.current.transparent
@@ -269,7 +300,7 @@ Rectangle {
let lastCursorPosition = suggestionsBox.suggestionFilter.cursorPosition;
let lastAtPosition = suggestionsBox.suggestionFilter.lastAtPosition;
if (aliasName.toLowerCase() === suggestionsBox.suggestionsModel.get(suggestionsBox.listView.currentIndex).name.toLowerCase()
- && (event.key !== Qt.Key_Backspace) && (event.key !== Qt.Key_Delete)) {
+ && (event.key !== Qt.Key_Backspace) && (event.key !== Qt.Key_Delete)) {
insertMention(aliasName, lastAtPosition, lastCursorPosition);
} else if (event.key === Qt.Key_Space) {
var plainTextToReplace = messageInputField.getText(lastAtPosition, lastCursorPosition);
@@ -294,30 +325,30 @@ Rectangle {
}
function unwrapSelection(unwrapWith, selectedTextWithFormationChars) {
- if (messageInputField.selectionStart - messageInputField.selectionEnd === 0) return
+ if (messageInputField.selectionStart - messageInputField.selectionEnd === 0) return
- // calulate the new selection start and end positions
- var newSelectionStart = messageInputField.selectionStart - unwrapWith.length
- var newSelectionEnd = messageInputField.selectionEnd-messageInputField.selectionStart + newSelectionStart
+ // calulate the new selection start and end positions
+ var newSelectionStart = messageInputField.selectionStart - unwrapWith.length
+ var newSelectionEnd = messageInputField.selectionEnd-messageInputField.selectionStart + newSelectionStart
- selectedTextWithFormationChars = selectedTextWithFormationChars.trim()
- // Check if the selectedTextWithFormationChars has formation chars and if so, calculate how many so we can adapt the start and end pos
- const selectTextDiff = (selectedTextWithFormationChars.length - messageInputField.selectedText.length) / 2
+ selectedTextWithFormationChars = selectedTextWithFormationChars.trim()
+ // Check if the selectedTextWithFormationChars has formation chars and if so, calculate how many so we can adapt the start and end pos
+ const selectTextDiff = (selectedTextWithFormationChars.length - messageInputField.selectedText.length) / 2
- // Remove the deselected option from the before and after the selected text
- const prefixChars = messageInputField.getText((messageInputField.selectionStart - selectTextDiff), messageInputField.selectionStart)
- const updatedPrefixChars = prefixChars.replace(unwrapWith, '')
- const postfixChars = messageInputField.getText(messageInputField.selectionEnd, (messageInputField.selectionEnd + selectTextDiff))
- const updatedPostfixChars = postfixChars.replace(unwrapWith, '')
+ // Remove the deselected option from the before and after the selected text
+ const prefixChars = messageInputField.getText((messageInputField.selectionStart - selectTextDiff), messageInputField.selectionStart)
+ const updatedPrefixChars = prefixChars.replace(unwrapWith, '')
+ const postfixChars = messageInputField.getText(messageInputField.selectionEnd, (messageInputField.selectionEnd + selectTextDiff))
+ const updatedPostfixChars = postfixChars.replace(unwrapWith, '')
- // Create updated selected string with pre and post formatting characters
- const updatedSelectedStringWithFormatChars = updatedPrefixChars + messageInputField.selectedText + updatedPostfixChars
+ // Create updated selected string with pre and post formatting characters
+ const updatedSelectedStringWithFormatChars = updatedPrefixChars + messageInputField.selectedText + updatedPostfixChars
- messageInputField.remove(messageInputField.selectionStart - selectTextDiff, messageInputField.selectionEnd + selectTextDiff)
+ messageInputField.remove(messageInputField.selectionStart - selectTextDiff, messageInputField.selectionEnd + selectTextDiff)
- insertInTextInput(messageInputField.selectionStart, updatedSelectedStringWithFormatChars)
+ insertInTextInput(messageInputField.selectionStart, updatedSelectedStringWithFormatChars)
- messageInputField.select(newSelectionStart, newSelectionEnd)
+ messageInputField.select(newSelectionStart, newSelectionEnd)
}
function getPlainText() {
@@ -764,503 +795,512 @@ Rectangle {
}
}
- StatusQ.StatusFlatRoundButton {
- id: chatCommandsBtn
- width: 32
- height: 32
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 16
- icon.name: "chat-commands"
- type: StatusQ.StatusFlatRoundButton.Type.Tertiary
- visible: RootStore.isWalletEnabled && !isEdit && control.chatType === Constants.chatType.oneToOne && !control.isStatusUpdateInput
- enabled: !control.isContactBlocked
- onClicked: {
- chatCommandsPopup.opened ?
- chatCommandsPopup.close() :
- chatCommandsPopup.open()
- }
- }
-
- StatusQ.StatusFlatRoundButton {
- id: imageBtn
- width: 32
- height: 32
- anchors.left: chatCommandsBtn.visible ? chatCommandsBtn.right : parent.left
- anchors.leftMargin: chatCommandsBtn.visible ? 2 : 4
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 16
- icon.name: "image"
- type: StatusQ.StatusFlatRoundButton.Type.Tertiary
- visible: !isEdit && control.chatType !== Constants.chatType.publicChat && !control.isStatusUpdateInput
- enabled: !control.isContactBlocked
- onClicked: {
- highlighted = true
- imageDialog.open()
- }
- }
-
- Rectangle {
- id: messageInput
- enabled: !control.isContactBlocked
- property int maxInputFieldHeight: control.isStatusUpdateInput ? 124 : 112
- property int defaultInputFieldHeight: control.isStatusUpdateInput ? 56 : 40
- anchors.left: imageBtn.visible ? imageBtn.right : parent.left
- anchors.leftMargin: imageBtn.visible ? 5 : Style.current.smallPadding
- anchors.top: control.isStatusUpdateInput ? parent.top : undefined
- anchors.bottom: !control.isStatusUpdateInput ? parent.bottom : undefined
- anchors.bottomMargin: control.isStatusUpdateInput ? 0 : 12
- anchors.right: unblockBtn.visible ? unblockBtn.left : parent.right
- anchors.rightMargin: Style.current.smallPadding
- height: {
- if (messageInputField.implicitHeight <= messageInput.defaultInputFieldHeight) {
- return messageInput.defaultInputFieldHeight
+ RowLayout {
+ id: layout
+ anchors.fill: parent
+// anchors.margins: 8
+// anchors.rightMargin: Style.current.halfPadding
+ spacing: 4
+
+ StatusQ.StatusFlatRoundButton {
+ id: chatCommandsBtn
+ Layout.preferredWidth: 32
+ Layout.preferredHeight: 32
+ Layout.alignment: Qt.AlignBottom
+ icon.name: "chat-commands"
+ type: StatusQ.StatusFlatRoundButton.Type.Tertiary
+ visible: RootStore.isWalletEnabled && !isEdit && control.chatType === Constants.chatType.oneToOne && !control.isStatusUpdateInput
+ enabled: !control.isContactBlocked
+ onClicked: {
+ chatCommandsPopup.opened ?
+ chatCommandsPopup.close() :
+ chatCommandsPopup.open()
}
- if (messageInputField.implicitHeight >= messageInput.maxInputFieldHeight) {
- return messageInput.maxInputFieldHeight
- }
- return messageInputField.implicitHeight
}
- color: isEdit ? Theme.palette.statusChatInput.secondaryBackgroundColor : Style.current.inputBackground
- radius: control.isStatusUpdateInput ? 36 :
- height > defaultInputFieldHeight + 1 || extendedArea.visible ? 16 : 32
-
- ColumnLayout {
- id: validators
- anchors.bottom: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Top ? extendedArea.top : undefined
- anchors.bottomMargin: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Top ? -4 : undefined
- anchors.top: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Bottom ? extendedArea.bottom : undefined
- anchors.topMargin: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Bottom ? (isImage ? -4 : 4) : undefined
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width
- z: 1
- StatusChatImageExtensionValidator {
- Layout.alignment: Qt.AlignHCenter
- }
- StatusChatImageSizeValidator {
- Layout.alignment: Qt.AlignHCenter
- }
- StatusChatImageQtyValidator {
- Layout.alignment: Qt.AlignHCenter
+ StatusQ.StatusFlatRoundButton {
+ id: imageBtn
+ Layout.preferredWidth: 32
+ Layout.preferredHeight: 32
+ Layout.alignment: Qt.AlignBottom
+ Layout.bottomMargin: 4
+ icon.name: "image"
+ type: StatusQ.StatusFlatRoundButton.Type.Tertiary
+ visible: !isEdit && control.chatType !== Constants.chatType.publicChat && !control.isStatusUpdateInput
+ enabled: !control.isContactBlocked
+ onClicked: {
+ highlighted = true
+ imageDialog.open()
}
}
Rectangle {
- id: extendedArea
- visible: isImage || isReply
- height: {
- if (visible) {
- if (isImage) {
- return imageArea.height
- }
-
- if (isReply) {
- return replyArea.height + replyArea.anchors.topMargin
- }
+ id: messageInput
+ Layout.fillWidth: true
+ enabled: !control.isContactBlocked
+
+ readonly property int maxInputFieldHeight: control.isStatusUpdateInput ? 124 : 112
+ readonly property int defaultInputFieldHeight: control.isStatusUpdateInput ? 56 : 40
+
+ // anchors.left: imageBtn.visible ? imageBtn.right : parent.left
+ // anchors.right: unblockBtn.visible ? unblockBtn.left : parent.right
+ // anchors.top: control.isStatusUpdateInput ? parent.top : undefined
+ // anchors.bottom: !control.isStatusUpdateInput ? parent.bottom : undefined
+ // anchors.leftMargin: imageBtn.visible ? 5 : Style.current.smallPadding
+ // anchors.bottomMargin: control.isStatusUpdateInput ? 0 : 12
+ // anchors.rightMargin: Style.current.smallPadding
+
+ // implicitHeight: {
+ // if (messageInputField.implicitHeight <= messageInput.defaultInputFieldHeight) {
+ // return messageInput.defaultInputFieldHeight
+ // }
+ // if (messageInputField.implicitHeight >= messageInput.maxInputFieldHeight) {
+ // return messageInput.maxInputFieldHeight
+ // }
+ // return messageInputField.implicitHeight
+ // }
+
+ Layout.preferredHeight: Math.min(Math.max(messageInputField.implicitHeight,
+ messageInputField.implicitHeight),
+ messageInput.maxInputFieldHeight)
+
+ color: isEdit ? Theme.palette.statusChatInput.secondaryBackgroundColor : Style.current.inputBackground
+ radius: control.isStatusUpdateInput ? 36 :
+ height > defaultInputFieldHeight + 1 || extendedArea.visible ? 16 : 32
+
+ ColumnLayout {
+ id: validators
+ anchors.bottom: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Top ? extendedArea.top : undefined
+ anchors.bottomMargin: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Top ? -4 : undefined
+ anchors.top: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Bottom ? extendedArea.bottom : undefined
+ anchors.topMargin: control.imageErrorMessageLocation === StatusChatInput.ImageErrorMessageLocation.Bottom ? (isImage ? -4 : 4) : undefined
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: parent.width
+ z: 1
+ StatusChatImageExtensionValidator {
+ Layout.alignment: Qt.AlignHCenter
+ }
+ StatusChatImageSizeValidator {
+ Layout.alignment: Qt.AlignHCenter
+ }
+ StatusChatImageQtyValidator {
+ Layout.alignment: Qt.AlignHCenter
}
- return 0
}
- anchors.left: messageInput.left
- anchors.right: messageInput.right
- anchors.bottom: control.isStatusUpdateInput ? undefined : messageInput.top
- anchors.top: control.isStatusUpdateInput ? messageInput.bottom : undefined
- anchors.topMargin: control.isStatusUpdateInput ? -Style.current.halfPadding : 0
- color: isEdit ? Style.current.secondaryInputBackground : Style.current.inputBackground
- radius: control.isStatusUpdateInput ? 36 : 16
Rectangle {
- color: parent.color
- anchors.right: parent.right
- anchors.left: parent.left
- height: control.isStatusUpdateInput ? 64 : 30
- anchors.top: control.isStatusUpdateInput ? parent.top : undefined
- anchors.topMargin: control.isStatusUpdateInput ? -24 : 0
- anchors.bottom: control.isStatusUpdateInput ? undefined : parent.bottom
- anchors.bottomMargin: control.isStatusUpdateInput ? 0 : -height/2
- }
+ id: extendedArea
+ visible: isImage || isReply
+ height: {
+ if (visible) {
+ if (isImage) {
+ return imageArea.height
+ }
- StatusChatInputImageArea {
- id: imageArea
- anchors.left: parent.left
- anchors.leftMargin: control.isStatusUpdateInput ? profileImage.width + Style.current.padding : Style.current.halfPadding
- anchors.right: parent.right
- anchors.rightMargin: control.isStatusUpdateInput ? actions.width + 2* Style.current.padding : Style.current.halfPadding
- anchors.top: parent.top
- anchors.topMargin: Style.current.halfPadding
- visible: isImage
- width: messageInputField.width - actions.width
- onImageClicked: Global.openImagePopup(chatImage, messageContextMenu)
- onImageRemoved: {
- if (control.fileUrls.length > index && control.fileUrls[index]) {
- control.fileUrls.splice(index, 1)
+ if (isReply) {
+ return replyArea.height + replyArea.anchors.topMargin
+ }
+ }
+ return 0
+ }
+ anchors.left: messageInput.left
+ anchors.right: messageInput.right
+ anchors.bottom: control.isStatusUpdateInput ? undefined : messageInput.top
+ anchors.top: control.isStatusUpdateInput ? messageInput.bottom : undefined
+ anchors.topMargin: control.isStatusUpdateInput ? -Style.current.halfPadding : 0
+ color: isEdit ? Style.current.secondaryInputBackground : Style.current.inputBackground
+ radius: control.isStatusUpdateInput ? 36 : 16
+
+ Rectangle {
+ color: parent.color
+ anchors.right: parent.right
+ anchors.left: parent.left
+ height: control.isStatusUpdateInput ? 64 : 30
+ anchors.top: control.isStatusUpdateInput ? parent.top : undefined
+ anchors.topMargin: control.isStatusUpdateInput ? -24 : 0
+ anchors.bottom: control.isStatusUpdateInput ? undefined : parent.bottom
+ anchors.bottomMargin: control.isStatusUpdateInput ? 0 : -height/2
+ }
+
+ StatusChatInputImageArea {
+ id: imageArea
+ anchors.left: parent.left
+ anchors.leftMargin: control.isStatusUpdateInput ? profileImage.width + Style.current.padding : Style.current.halfPadding
+ anchors.right: parent.right
+ anchors.rightMargin: control.isStatusUpdateInput ? actions.width + 2* Style.current.padding : Style.current.halfPadding
+ anchors.top: parent.top
+ anchors.topMargin: Style.current.halfPadding
+ visible: isImage
+ width: messageInputField.width - actions.width
+ onImageClicked: Global.openImagePopup(chatImage, messageContextMenu)
+ onImageRemoved: {
+ if (control.fileUrls.length > index && control.fileUrls[index]) {
+ control.fileUrls.splice(index, 1)
+ }
+ isImage = control.fileUrls.length > 0
+ validateImages(control.fileUrls)
+ }
+ }
+
+ StatusChatInputReplyArea {
+ id: replyArea
+ visible: isReply
+ anchors.left: parent.left
+ anchors.leftMargin: 2
+ anchors.right: parent.right
+ anchors.rightMargin: 2
+ anchors.top: parent.top
+ anchors.topMargin: 2
+ // Not Refactored Yet
+ // stickerData: sticker
+ onCloseButtonClicked: {
+ isReply = false
}
- isImage = control.fileUrls.length > 0
- validateImages(control.fileUrls)
}
}
- StatusChatInputReplyArea {
- id: replyArea
- visible: isReply
+ StatusSmartIdenticon {
+ id: profileImage
anchors.left: parent.left
- anchors.leftMargin: 2
- anchors.right: parent.right
- anchors.rightMargin: 2
+ anchors.leftMargin: Style.current.smallPadding
anchors.top: parent.top
- anchors.topMargin: 2
- // Not Refactored Yet
-// stickerData: sticker
- onCloseButtonClicked: {
- isReply = false
- }
+ anchors.topMargin: Style.current.halfPadding
+ image.source: userProfile.icon
+ visible: control.isStatusUpdateInput
}
- }
-
- StatusSmartIdenticon {
- id: profileImage
- anchors.left: parent.left
- anchors.leftMargin: Style.current.smallPadding
- anchors.top: parent.top
- anchors.topMargin: Style.current.halfPadding
- image.source: userProfile.icon
- visible: control.isStatusUpdateInput
- }
- ScrollView {
- id: scrollView
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.left: profileImage.visible ? profileImage.right : parent.left
- anchors.leftMargin: Style.current.smallPadding
- anchors.right: actions.left
- anchors.rightMargin: Style.current.halfPadding
- ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
-
- TextArea {
- id: messageInputField
- property var lastClick: 0
- property int cursorWhenPressed: 0
- textFormat: Text.RichText
- font.pixelSize: 15
- font.family: Style.current.fontRegular.name
- wrapMode: TextArea.Wrap
- placeholderText: control.chatInputPlaceholder
- placeholderTextColor: Style.current.secondaryText
- selectByMouse: true
- color: isEdit ? Theme.palette.directColor1 : Style.current.textColor
- topPadding: control.isStatusUpdateInput ? 18 : Style.current.smallPadding
- bottomPadding: control.isStatusUpdateInput ? 14 : 12
- Keys.onPressed: {
- keyEvent = event;
- onKeyPress(event)
- cursorWhenPressed = cursorPosition;
- }
- Keys.onReleased: onRelease(event) // gives much more up to date cursorPosition
- Keys.onShortcutOverride: event.accepted = isUploadFilePressed(event)
- leftPadding: 0
- selectionColor: Style.current.primarySelectionColor
- persistentSelection: true
- property var keyEvent
- onCursorPositionChanged: {
- if (mentionsPos.length > 0) {
- for (var i = 0; i < mentionsPos.length; i++) {
- if ((messageInputField.cursorPosition === (mentionsPos[i].leftIndex + 1)) && (keyEvent.key === Qt.Key_Right)) {
- messageInputField.cursorPosition = mentionsPos[i].rightIndex;
- } else if (messageInputField.cursorPosition === (mentionsPos[i].rightIndex - 1)) {
- if (keyEvent.key === Qt.Key_Left) {
+ ScrollView {
+ id: scrollView
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: profileImage.visible ? profileImage.right : parent.left
+ anchors.leftMargin: Style.current.smallPadding
+ anchors.right: actions.left
+ anchors.rightMargin: Style.current.halfPadding
+ ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
+
+ TextArea {
+ id: messageInputField
+ property var lastClick: 0
+ property int cursorWhenPressed: 0
+ textFormat: Text.RichText
+ font.pixelSize: 15
+ font.family: Style.current.fontRegular.name
+ wrapMode: TextArea.Wrap
+ placeholderText: control.chatInputPlaceholder
+ placeholderTextColor: Style.current.secondaryText
+ selectByMouse: true
+ color: isEdit ? Theme.palette.directColor1 : Style.current.textColor
+ topPadding: control.isStatusUpdateInput ? 18 : Style.current.smallPadding
+ bottomPadding: control.isStatusUpdateInput ? 14 : 12
+ Keys.onPressed: {
+ keyEvent = event;
+ onKeyPress(event)
+ cursorWhenPressed = cursorPosition;
+ }
+ Keys.onReleased: onRelease(event) // gives much more up to date cursorPosition
+ Keys.onShortcutOverride: event.accepted = isUploadFilePressed(event)
+ leftPadding: 0
+ selectionColor: Style.current.primarySelectionColor
+ persistentSelection: true
+ property var keyEvent
+ onCursorPositionChanged: {
+ if (mentionsPos.length > 0) {
+ for (var i = 0; i < mentionsPos.length; i++) {
+ if ((messageInputField.cursorPosition === (mentionsPos[i].leftIndex + 1)) && (keyEvent.key === Qt.Key_Right)) {
+ messageInputField.cursorPosition = mentionsPos[i].rightIndex;
+ } else if (messageInputField.cursorPosition === (mentionsPos[i].rightIndex - 1)) {
+ if (keyEvent.key === Qt.Key_Left) {
+ messageInputField.cursorPosition = mentionsPos[i].leftIndex;
+ } else if ((keyEvent.key === Qt.Key_Backspace) || (keyEvent.key === Qt.Key_Delete)) {
+ messageInputField.remove(mentionsPos[i].rightIndex, mentionsPos[i].leftIndex);
+ mentionsPos.pop(i);
+ }
+ } else if (((messageInputField.cursorPosition > mentionsPos[i].leftIndex) &&
+ (messageInputField.cursorPosition < mentionsPos[i].rightIndex)) &&
+ ((keyEvent.key === Qt.Key_Left) && ((keyEvent.modifiers & Qt.AltModifier) ||
+ (keyEvent.modifiers & Qt.ControlModifier)))) {
messageInputField.cursorPosition = mentionsPos[i].leftIndex;
- } else if ((keyEvent.key === Qt.Key_Backspace) || (keyEvent.key === Qt.Key_Delete)) {
- messageInputField.remove(mentionsPos[i].rightIndex, mentionsPos[i].leftIndex);
- mentionsPos.pop(i);
+ } else if ((keyEvent.key === Qt.Key_Up) || (keyEvent.key === Qt.Key_Down)) {
+ if (messageInputField.cursorPosition >= mentionsPos[i].leftIndex &&
+ messageInputField.cursorPosition <= (((mentionsPos[i].leftIndex + mentionsPos[i].rightIndex)/2))) {
+ messageInputField.cursorPosition = mentionsPos[i].leftIndex;
+ } else if (messageInputField.cursorPosition <= mentionsPos[i].rightIndex &&
+ messageInputField.cursorPosition > (((mentionsPos[i].leftIndex + mentionsPos[i].rightIndex)/2))) {
+ messageInputField.cursorPosition = mentionsPos[i].rightIndex;
+ }
}
- } else if (((messageInputField.cursorPosition > mentionsPos[i].leftIndex) &&
- (messageInputField.cursorPosition < mentionsPos[i].rightIndex)) &&
- ((keyEvent.key === Qt.Key_Left) && ((keyEvent.modifiers & Qt.AltModifier) ||
- (keyEvent.modifiers & Qt.ControlModifier)))) {
- messageInputField.cursorPosition = mentionsPos[i].leftIndex;
- } else if ((keyEvent.key === Qt.Key_Up) || (keyEvent.key === Qt.Key_Down)) {
- if (messageInputField.cursorPosition >= mentionsPos[i].leftIndex &&
- messageInputField.cursorPosition <= (((mentionsPos[i].leftIndex + mentionsPos[i].rightIndex)/2))) {
- messageInputField.cursorPosition = mentionsPos[i].leftIndex;
- } else if (messageInputField.cursorPosition <= mentionsPos[i].rightIndex &&
- messageInputField.cursorPosition > (((mentionsPos[i].leftIndex + mentionsPos[i].rightIndex)/2))) {
- messageInputField.cursorPosition = mentionsPos[i].rightIndex;
+ }
+ }
+ if ((mentionsPos.length > 0) && (cursorPosition < length) && getText(cursorPosition, length).includes("@")
+ && (keyEvent.key !== Qt.Key_Right) && (keyEvent.key !== Qt.Key_Left) && (keyEvent.key !== Qt.Key_Up)
+ && (keyEvent.key !== Qt.Key_Down)) {
+ var unformattedText = getText(cursorPosition, length);
+ for (var k = 0; k < mentionsPos.length; k++) {
+ if ((unformattedText.indexOf(mentionsPos[k].name) !== -1) && (unformattedText.indexOf(mentionsPos[k].name) !== mentionsPos[k].leftIndex)) {
+ mentionsPos[k].leftIndex = (cursorPosition + unformattedText.indexOf(mentionsPos[k].name) - 1);
+ mentionsPos[k].rightIndex = (cursorPosition + unformattedText.indexOf(mentionsPos[k].name) + mentionsPos[k].name.length);
}
}
}
}
- if ((mentionsPos.length > 0) && (cursorPosition < length) && getText(cursorPosition, length).includes("@")
- && (keyEvent.key !== Qt.Key_Right) && (keyEvent.key !== Qt.Key_Left) && (keyEvent.key !== Qt.Key_Up)
- && (keyEvent.key !== Qt.Key_Down)) {
- var unformattedText = getText(cursorPosition, length);
- for (var k = 0; k < mentionsPos.length; k++) {
- if ((unformattedText.indexOf(mentionsPos[k].name) !== -1) && (unformattedText.indexOf(mentionsPos[k].name) !== mentionsPos[k].leftIndex)) {
- mentionsPos[k].leftIndex = (cursorPosition + unformattedText.indexOf(mentionsPos[k].name) - 1);
- mentionsPos[k].rightIndex = (cursorPosition + unformattedText.indexOf(mentionsPos[k].name) + mentionsPos[k].name.length);
+ onTextChanged: {
+ if (length <= control.messageLimit) {
+ var symbols = ":='xX><0O;*dB8-D#%\\";
+ if ((length > 1) && (symbols.indexOf(getText((cursorPosition - 2), (cursorPosition - 1))) !== -1)
+ && (!getText((cursorPosition - 7), cursorPosition).includes("http"))) {
+ const emojis = EmojiJSON.emoji_json.filter(function (emoji) {
+ if (emoji.aliases_ascii.includes(getText((cursorPosition - 2), cursorPosition)) ||
+ emoji.aliases_ascii.includes(getText((cursorPosition - 3), cursorPosition))) {
+ var has2Chars = emoji.aliases_ascii.includes(getText((cursorPosition - 2), cursorPosition));
+ replaceWithEmoji("", getText(cursorPosition - (has2Chars ? 2 : 3), cursorPosition), emoji.unicode);
+ }
+ })
+ }
+ if (text === "") {
+ mentionsPos = [];
}
+ } else {
+ var removeFrom = (cursorPosition < messageLimit) ? cursorWhenPressed : messageLimit;
+ remove(removeFrom, cursorPosition);
}
+ messageLengthLimit.remainingChars = (messageLimit - length);
}
- }
- onTextChanged: {
- if (length <= control.messageLimit) {
- var symbols = ":='xX><0O;*dB8-D#%\\";
- if ((length > 1) && (symbols.indexOf(getText((cursorPosition - 2), (cursorPosition - 1))) !== -1)
- && (!getText((cursorPosition - 7), cursorPosition).includes("http"))) {
- const emojis = EmojiJSON.emoji_json.filter(function (emoji) {
- if (emoji.aliases_ascii.includes(getText((cursorPosition - 2), cursorPosition)) ||
- emoji.aliases_ascii.includes(getText((cursorPosition - 3), cursorPosition))) {
- var has2Chars = emoji.aliases_ascii.includes(getText((cursorPosition - 2), cursorPosition));
- replaceWithEmoji("", getText(cursorPosition - (has2Chars ? 2 : 3), cursorPosition), emoji.unicode);
- }
- })
- }
- if (text === "") {
- mentionsPos = [];
+
+ onReleased: function (event) {
+ const now = Date.now()
+ if (messageInputField.selectedText.trim() !== "") {
+ // If it's a double click, just check the mouse position
+ // If it's a mouse select, use the start and end position average)
+ let x = now < messageInputField.lastClick + 500 ? x = event.x :
+ (messageInputField.cursorRectangle.x + event.x) / 2
+ x -= textFormatMenu.width / 2
+
+ textFormatMenu.popup(x, -messageInputField.height-2)
+ messageInputField.forceActiveFocus();
}
- } else {
- var removeFrom = (cursorPosition < messageLimit) ? cursorWhenPressed : messageLimit;
- remove(removeFrom, cursorPosition);
+ lastClick = now
}
- messageLengthLimit.remainingChars = (messageLimit - length);
- }
- onReleased: function (event) {
- const now = Date.now()
- if (messageInputField.selectedText.trim() !== "") {
- // If it's a double click, just check the mouse position
- // If it's a mouse select, use the start and end position average)
- let x = now < messageInputField.lastClick + 500 ? x = event.x :
- (messageInputField.cursorRectangle.x + event.x) / 2
- x -= textFormatMenu.width / 2
-
- textFormatMenu.popup(x, -messageInputField.height-2)
- messageInputField.forceActiveFocus();
+ StatusSyntaxHighlighter {
+ quickTextDocument: messageInputField.textDocument
+ }
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.NoButton
+ enabled: parent.hoveredLink
+ cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
+ }
+ StatusTextFormatMenu {
+ id: textFormatMenu
+
+ StatusChatInputTextFormationAction {
+ wrapper: "**"
+ icon.name: "bold"
+ text: qsTr("Bold")
+ selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
+ onActionTriggered: checked ?
+ unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
+ wrapSelection(wrapper)
+ }
+ StatusChatInputTextFormationAction {
+ wrapper: "*"
+ icon.name: "italic"
+ text: qsTr("Italic")
+ selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
+ checked: (surroundedBy("*") && !surroundedBy("**")) || surroundedBy("***")
+ onActionTriggered: checked ?
+ unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
+ wrapSelection(wrapper)
+ }
+ StatusChatInputTextFormationAction {
+ wrapper: "~~"
+ icon.name: "strikethrough"
+ text: qsTr("Strikethrough")
+ selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
+ onActionTriggered: checked ?
+ unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
+ wrapSelection(wrapper)
+ }
+ StatusChatInputTextFormationAction {
+ wrapper: "`"
+ icon.name: "code"
+ text: qsTr("Code")
+ selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
+ onActionTriggered: checked ?
+ unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
+ wrapSelection(wrapper)
+ }
+ onClosed: {
+ messageInputField.deselect();
+ }
}
- lastClick = now
}
- StatusSyntaxHighlighter {
- quickTextDocument: messageInputField.textDocument
+ Shortcut {
+ enabled: messageInputField.activeFocus
+ sequence: StandardKey.Bold
+ onActivated: wrapSelection("**")
}
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.NoButton
- enabled: parent.hoveredLink
- cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
+ Shortcut {
+ enabled: messageInputField.activeFocus
+ sequence: StandardKey.Italic
+ onActivated: wrapSelection("*")
}
- StatusTextFormatMenu {
- id: textFormatMenu
-
- StatusChatInputTextFormationAction {
- wrapper: "**"
- icon.name: "bold"
- text: qsTr("Bold")
- selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
- onActionTriggered: checked ?
- unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
- wrapSelection(wrapper)
- }
- StatusChatInputTextFormationAction {
- wrapper: "*"
- icon.name: "italic"
- text: qsTr("Italic")
- selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
- checked: (surroundedBy("*") && !surroundedBy("**")) || surroundedBy("***")
- onActionTriggered: checked ?
- unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
- wrapSelection(wrapper)
- }
- StatusChatInputTextFormationAction {
- wrapper: "~~"
- icon.name: "strikethrough"
- text: qsTr("Strikethrough")
- selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
- onActionTriggered: checked ?
- unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
- wrapSelection(wrapper)
- }
- StatusChatInputTextFormationAction {
- wrapper: "`"
- icon.name: "code"
- text: qsTr("Code")
- selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
- onActionTriggered: checked ?
- unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
- wrapSelection(wrapper)
- }
- onClosed: {
- messageInputField.deselect();
- }
+ Shortcut {
+ enabled: messageInputField.activeFocus
+ sequence: "Ctrl+Shift+Alt+C"
+ onActivated: wrapSelection("```")
+ }
+ Shortcut {
+ enabled: messageInputField.activeFocus
+ sequence: "Ctrl+Shift+C"
+ onActivated: wrapSelection("`")
+ }
+ Shortcut {
+ enabled: messageInputField.activeFocus
+ sequence: "Ctrl+Alt+-"
+ onActivated: wrapSelection("~~")
+ }
+ Shortcut {
+ enabled: messageInputField.activeFocus
+ sequence: "Ctrl+Shift+X"
+ onActivated: wrapSelection("~~")
+ }
+ Shortcut {
+ enabled: messageInputField.activeFocus
+ sequence: "Ctrl+Meta+Space"
+ onActivated: emojiBtn.clicked(null)
}
- }
- Shortcut {
- enabled: messageInputField.activeFocus
- sequence: StandardKey.Bold
- onActivated: wrapSelection("**")
}
- Shortcut {
- enabled: messageInputField.activeFocus
- sequence: StandardKey.Italic
- onActivated: wrapSelection("*")
- }
- Shortcut {
- enabled: messageInputField.activeFocus
- sequence: "Ctrl+Shift+Alt+C"
- onActivated: wrapSelection("```")
- }
- Shortcut {
- enabled: messageInputField.activeFocus
- sequence: "Ctrl+Shift+C"
- onActivated: wrapSelection("`")
- }
- Shortcut {
- enabled: messageInputField.activeFocus
- sequence: "Ctrl+Alt+-"
- onActivated: wrapSelection("~~")
- }
- Shortcut {
- enabled: messageInputField.activeFocus
- sequence: "Ctrl+Shift+X"
- onActivated: wrapSelection("~~")
- }
- Shortcut {
- enabled: messageInputField.activeFocus
- sequence: "Ctrl+Meta+Space"
- onActivated: emojiBtn.clicked(null)
- }
-
- }
-
- Rectangle {
- color: parent.color
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- visible: !control.isStatusUpdateInput
- height: parent.height / 2
- width: 32
- radius: Style.current.radius
- }
- StyledText {
- id: messageLengthLimit
- property int remainingChars: -1
- anchors.right: parent.right
- anchors.bottom: actions.top
- anchors.rightMargin: control.isStatusUpdateInput ? Style.current.padding : Style.current.radius
- leftPadding: Style.current.halfPadding
- rightPadding: Style.current.halfPadding
- visible: ((messageInputField.length >= control.messageLimitVisible) && (messageInputField.length <= control.messageLimit))
- color: (remainingChars <= messageLimitVisible) ? Style.current.danger : Style.current.textColor
- text: visible ? remainingChars.toString() : ""
- }
-
- Item {
- id: actions
- width: control.isStatusUpdateInput ?
- imageBtn2.width + sendBtn.anchors.leftMargin + sendBtn.width :
- emojiBtn.width + stickersBtn.anchors.leftMargin + stickersBtn.width
- anchors.bottom: control.isStatusUpdateInput && extendedArea.visible ? extendedArea.bottom : parent.bottom
- anchors.bottomMargin: control.isStatusUpdateInput ? Style.current.smallPadding+2: 4
- anchors.right: parent.right
- anchors.rightMargin: Style.current.radius
- height: emojiBtn.height
-
- StatusQ.StatusFlatRoundButton {
- id: imageBtn2
- implicitHeight: 32
- implicitWidth: 32
- anchors.right: sendBtn.left
- anchors.rightMargin: 2
+ Rectangle {
+ color: parent.color
anchors.bottom: parent.bottom
- icon.name: "image"
- type: StatusQ.StatusFlatRoundButton.Type.Tertiary
- visible: control.isStatusUpdateInput
+ anchors.right: parent.right
+ visible: !control.isStatusUpdateInput
+ height: parent.height / 2
+ width: 32
+ radius: Style.current.radius
+ }
- onClicked: {
- highlighted = true
- imageDialog.open()
- }
+ StyledText {
+ id: messageLengthLimit
+ property int remainingChars: -1
+ anchors.right: parent.right
+ anchors.bottom: actions.top
+ anchors.rightMargin: control.isStatusUpdateInput ? Style.current.padding : Style.current.radius
+ leftPadding: Style.current.halfPadding
+ rightPadding: Style.current.halfPadding
+ visible: ((messageInputField.length >= control.messageLimitVisible) && (messageInputField.length <= control.messageLimit))
+ color: (remainingChars <= messageLimitVisible) ? Style.current.danger : Style.current.textColor
+ text: visible ? remainingChars.toString() : ""
}
- StatusQ.StatusFlatButton {
- id: sendBtn
- icon.name: "send"
- text: qsTr("Send")
- size: StatusQ.StatusBaseButton.Size.Small
+ Item {
+ id: actions
+ width: control.isStatusUpdateInput ?
+ imageBtn2.width + sendBtn.anchors.leftMargin + sendBtn.width :
+ emojiBtn.width + stickersBtn.anchors.leftMargin + stickersBtn.width
+ anchors.bottom: control.isStatusUpdateInput && extendedArea.visible ? extendedArea.bottom : parent.bottom
+ anchors.bottomMargin: control.isStatusUpdateInput ? Style.current.smallPadding+2: 4
anchors.right: parent.right
- anchors.rightMargin: Style.current.halfPadding
- anchors.verticalCenter: parent.verticalCenter
- visible: imageBtn2.visible
- enabled: (globalUtils.plainText(StatusQUtils.Emoji.deparse(messageInputField.text)).length > 0 || isImage) && messageInputField.length < messageLimit
- onClicked: function (event) {
- control.sendMessage(event)
- control.hideExtendedArea();
+ anchors.rightMargin: Style.current.radius
+ height: emojiBtn.height
+
+ StatusQ.StatusFlatRoundButton {
+ id: imageBtn2
+ implicitHeight: 32
+ implicitWidth: 32
+ anchors.right: sendBtn.left
+ anchors.rightMargin: 2
+ anchors.bottom: parent.bottom
+ icon.name: "image"
+ type: StatusQ.StatusFlatRoundButton.Type.Tertiary
+ visible: control.isStatusUpdateInput
+
+ onClicked: {
+ highlighted = true
+ imageDialog.open()
+ }
}
- }
- StatusQ.StatusFlatRoundButton {
- id: emojiBtn
- enabled: !control.emojiPopupOpened
- implicitHeight: 32
- implicitWidth: 32
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- visible: !imageBtn2.visible
- icon.name: "emojis"
- type: StatusQ.StatusFlatRoundButton.Type.Tertiary
- color: "transparent"
- onClicked: {
- control.emojiPopupOpened = true
- togglePopup(emojiPopup, emojiBtn)
- emojiPopup.x = Global.applicationWindow.width - emojiPopup.width - Style.current.halfPadding
- emojiPopup.y = Global.applicationWindow.height - emojiPopup.height - control.height
+ StatusQ.StatusFlatButton {
+ id: sendBtn
+ icon.name: "send"
+ text: qsTr("Send")
+ size: StatusQ.StatusBaseButton.Size.Small
+ anchors.right: parent.right
+ anchors.rightMargin: Style.current.halfPadding
+ anchors.verticalCenter: parent.verticalCenter
+ visible: imageBtn2.visible
+ enabled: (globalUtils.plainText(StatusQUtils.Emoji.deparse(messageInputField.text)).length > 0 || isImage) && messageInputField.length < messageLimit
+ onClicked: function (event) {
+ control.sendMessage(event)
+ control.hideExtendedArea();
+ }
}
- }
- StatusQ.StatusFlatRoundButton {
- id: gifBtn
- implicitHeight: 32
- implicitWidth: 32
- anchors.right: emojiBtn.left
- anchors.rightMargin: 2
- anchors.bottom: parent.bottom
- visible: !isEdit && RootStore.isGifWidgetEnabled
- icon.name: "gif"
- type: StatusQ.StatusFlatRoundButton.Type.Tertiary
- color: "transparent"
- onClicked: togglePopup(gifPopup, gifBtn)
- }
+ StatusQ.StatusFlatRoundButton {
+ id: emojiBtn
+ enabled: !control.emojiPopupOpened
+ implicitHeight: 32
+ implicitWidth: 32
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ visible: !imageBtn2.visible
+ icon.name: "emojis"
+ type: StatusQ.StatusFlatRoundButton.Type.Tertiary
+ color: "transparent"
+ onClicked: {
+ control.emojiPopupOpened = true
+ togglePopup(emojiPopup, emojiBtn)
+ emojiPopup.x = Global.applicationWindow.width - emojiPopup.width - Style.current.halfPadding
+ emojiPopup.y = Global.applicationWindow.height - emojiPopup.height - control.height
+ }
+ }
- StatusQ.StatusFlatRoundButton {
- id: stickersBtn
- implicitHeight: 32
- implicitWidth: 32
- width: visible ? 32 : 0
- anchors.left: emojiBtn.right
- anchors.leftMargin: 2
- anchors.bottom: parent.bottom
- icon.name: "stickers"
- type: StatusQ.StatusFlatRoundButton.Type.Tertiary
- visible: !isEdit && emojiBtn.visible
- color: "transparent"
- onClicked: togglePopup(stickersPopup, stickersBtn)
+ StatusQ.StatusFlatRoundButton {
+ id: gifBtn
+ implicitHeight: 32
+ implicitWidth: 32
+ anchors.right: emojiBtn.left
+ anchors.rightMargin: 2
+ anchors.bottom: parent.bottom
+ visible: !isEdit && RootStore.isGifWidgetEnabled
+ icon.name: "gif"
+ type: StatusQ.StatusFlatRoundButton.Type.Tertiary
+ color: "transparent"
+ onClicked: togglePopup(gifPopup, gifBtn)
+ }
+
+ StatusQ.StatusFlatRoundButton {
+ id: stickersBtn
+ implicitHeight: 32
+ implicitWidth: 32
+ width: visible ? 32 : 0
+ anchors.left: emojiBtn.right
+ anchors.leftMargin: 2
+ anchors.bottom: parent.bottom
+ icon.name: "stickers"
+ type: StatusQ.StatusFlatRoundButton.Type.Tertiary
+ visible: !isEdit && emojiBtn.visible
+ color: "transparent"
+ onClicked: togglePopup(stickersPopup, stickersBtn)
+ }
}
}
- }
- StatusQ.StatusButton {
- id: unblockBtn
- visible: control.isContactBlocked
- anchors.right: parent.right
- anchors.rightMargin: Style.current.halfPadding
- anchors.bottom: messageInput.bottom
- text: qsTr("Unblock")
- type: StatusQ.StatusBaseButton.Type.Danger
- onClicked: function (event) {
- control.unblockChat()
+ StatusQ.StatusButton {
+ id: unblockBtn
+ visible: control.isContactBlocked
+ text: qsTr("Unblock")
+ type: StatusQ.StatusBaseButton.Type.Danger
+ onClicked: function (event) {
+ control.unblockChat()
+ }
}
}
+
}
diff --git a/ui/imports/shared/status/StatusChatInputReplyArea.qml b/ui/imports/shared/status/StatusChatInputReplyArea.qml
index 5436d8162ea..b612149d871 100644
--- a/ui/imports/shared/status/StatusChatInputReplyArea.qml
+++ b/ui/imports/shared/status/StatusChatInputReplyArea.qml
@@ -61,7 +61,7 @@ Rectangle {
StyledText {
id: replyText
- text: Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(Utils.linkifyAndXSS(message)), false)
+ text: Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(StatusQUtils.Utils.linkifyAndXSS(message)), false)
anchors.fill: parent
elide: Text.ElideRight
font.pixelSize: 13
diff --git a/ui/imports/shared/views/ProfileView.qml b/ui/imports/shared/views/ProfileView.qml
index 51ef1c7c67a..43f7bd41ff2 100644
--- a/ui/imports/shared/views/ProfileView.qml
+++ b/ui/imports/shared/views/ProfileView.qml
@@ -355,7 +355,7 @@ Rectangle {
messageTimestamp: root.verificationRequestedAt
senderDisplayName: userProfile.name
senderIcon: userProfile.icon
- message: root.verificationChallenge
+ messageText: root.verificationChallenge
messageContentType: Constants.messageContentType.messageType
placeholderMessage: true
}
@@ -369,7 +369,7 @@ Rectangle {
messageTimestamp: root.verificationRepliedAt
senderDisplayName: root.verificationResponseDisplayName
senderIcon: root.verificationResponseIcon
- message: root.verificationResponse
+ messageText: root.verificationResponse
messageContentType: Constants.messageContentType.messageType
placeholderMessage: true
}
diff --git a/ui/imports/shared/views/chat/ChatTextView.qml b/ui/imports/shared/views/chat/ChatTextView.qml
index b8ff3a34010..2ea0cae626d 100644
--- a/ui/imports/shared/views/chat/ChatTextView.qml
+++ b/ui/imports/shared/views/chat/ChatTextView.qml
@@ -113,16 +113,16 @@ Item {
}
text: {
- if (contentType === Constants.messageContentType.stickerType) return "";
- let msg = Utils.linkifyAndXSS(message);
+ if (contentType === Constants.messageContentType.stickerType)
+ return "";
+ let msg = StatusQUtils.Utils.linkifyAndXSS(message);
if (isEmoji)
return StatusQUtils.Emoji.parse(msg, StatusQUtils.Emoji.size.middle, StatusQUtils.Emoji.format.png);
if (isEdited) {
let index = msg.endsWith("code>") ? msg.length : msg.length - 4
- return Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg.slice(0, index) + Constants.editLabel + msg.slice(index)), isCurrentUser, hoveredLink)
+ return StatusQUtils.Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg.slice(0, index) + Constants.editLabel + msg.slice(index)), isCurrentUser, hoveredLink)
}
- return Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg), isCurrentUser, hoveredLink)
-
+ return StatusQUtils.Utils.getMessageWithStyle(StatusQUtils.Emoji.parse(msg), isCurrentUser, hoveredLink)
}
}
diff --git a/ui/imports/shared/views/chat/CompactMessageView.qml b/ui/imports/shared/views/chat/CompactMessageView.qml
index 8c18dc8a304..08fa6958a8c 100644
--- a/ui/imports/shared/views/chat/CompactMessageView.qml
+++ b/ui/imports/shared/views/chat/CompactMessageView.qml
@@ -346,7 +346,7 @@ Item {
}
onClickMessage: {
- root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, isReply, false, "")
+ root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, true, false, "")
}
}
@@ -425,67 +425,30 @@ Item {
suggestionsOpened = false
}
- StatusChatInput {
- id: editTextInput
+// StatusChatInput {
+// id: editTextInput
- store: root.store
- usersStore: root.usersStore
+// store: root.store
+// usersStore: root.usersStore
- chatInputPlaceholder: qsTr("Pinned by %1")
- chatType: messageStore.getChatType()
- isEdit: true
- emojiPopup: root.emojiPopup
- messageContextMenu: root.messageContextMenu
- onSendMessage: {
- saveBtn.clicked(null)
- }
- suggestions.onVisibleChanged: {
- if (suggestions.visible) {
- editText.suggestionsOpened = true
- }
- }
+// chatType: messageStore.getChatType()
+// isEdit: true
+// emojiPopup: root.emojiPopup
+// messageContextMenu: root.messageContextMenu
- Component.onCompleted: {
- let mentionsMap = new Map()
- let index = 0
- while (true) {
- index = message.indexOf("", index) + 4
- if (endIndex < 0) {
- index += 8 // " '
- mentionsMap.set(mentionLink, mentionTag)
- index += linkTag.length
- }
+// onSendMessage: {
+// saveBtn.clicked(null)
+// }
+// suggestions.onVisibleChanged: {
+// if (suggestions.visible) {
+// editText.suggestionsOpened = true
+// }
+// }
- var text = message
- for (let [key, value] of mentionsMap) {
- text = text.replace(new RegExp(key, 'g'), value)
- }
- editTextInput.textInput.text = text
- editTextInput.textInput.cursorPosition = editTextInput.textInput.length
- }
- }
+// Component.onCompleted: {
+// parseMessage(message);
+// }
+// }
StatusQControls.StatusFlatButton {
id: cancelBtn
@@ -699,7 +662,6 @@ Item {
}
}
-
Retry {
id: retry
height: visible ? implicitHeight : 0
diff --git a/ui/imports/shared/views/chat/MessageContextMenuView.qml b/ui/imports/shared/views/chat/MessageContextMenuView.qml
index 045b069ef1e..8e1f4d21acb 100644
--- a/ui/imports/shared/views/chat/MessageContextMenuView.qml
+++ b/ui/imports/shared/views/chat/MessageContextMenuView.qml
@@ -100,12 +100,12 @@ StatusPopupMenu {
selectedUserPublicKey = ""
}
- onHeightChanged: { root.y = setYPosition(); }
- onWidthChanged: { root.x = setXPosition(); }
+// onHeightChanged: { root.y = setYPosition(); }
+// onWidthChanged: { root.x = setXPosition(); }
onOpened: {
// Trigger x and y position:
- x = setXPosition()
- y = setYPosition()
+// x = setXPosition()
+// y = setYPosition()
}
width: Math.max(emojiContainer.visible ? emojiContainer.width : 0, 200)
diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml
index f10df7d87d7..6d8fa664b65 100644
--- a/ui/imports/shared/views/chat/MessageView.qml
+++ b/ui/imports/shared/views/chat/MessageView.qml
@@ -1,38 +1,46 @@
import QtQuick 2.13
-import StatusQ.Components 0.1
-
import utils 1.0
import shared.panels 1.0
import shared.status 1.0
import shared.controls 1.0
+import shared.popups 1.0
import shared.panels.chat 1.0
import shared.views.chat 1.0
import shared.controls.chat 1.0
+import StatusQ.Core 0.1
+import StatusQ.Core.Theme 0.1
+import StatusQ.Core.Utils 0.1 as StatusQUtils
+import StatusQ.Controls 0.1
+import StatusQ.Components 0.1
+
Loader {
id: root
- width: parent.width
+ // width: parent.width
z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index)
sourceComponent: {
switch(contentType) {
- case Constants.messageContentType.chatIdentifier:
- return channelIdentifierComponent
- case Constants.messageContentType.fetchMoreMessagesButton:
- return fetchMoreMessagesButtonComponent
- case Constants.messageContentType.systemMessagePrivateGroupType:
- return privateGroupHeaderComponent
- case Constants.messageContentType.gapType:
- return gapComponent
- default:
- return compactMessageComponent
+ case Constants.messageContentType.chatIdentifier:
+ return channelIdentifierComponent
+ case Constants.messageContentType.fetchMoreMessagesButton:
+ return fetchMoreMessagesButtonComponent
+ case Constants.messageContentType.systemMessagePrivateGroupType:
+ return privateGroupHeaderComponent
+ case Constants.messageContentType.gapType:
+ return gapComponent
+ default:
+ return root.newComponentEnabled ? newMessageComponent
+ : compactMessageComponent
}
}
+
+ property bool newComponentEnabled: false
- property var store
+ property var rootStore
property var messageStore
property var usersStore
property var contactsStore
@@ -53,19 +61,20 @@ Loader {
property string senderId: ""
property string senderDisplayName: ""
property string senderLocalName: ""
+ property string senderEnsName: ""
property string senderIcon: ""
property bool amISender: false
property bool senderIsAdded: false
property int senderTrustStatus: Constants.trustStatus.unknown
readonly property string senderIconToShow: {
if ((!senderIsAdded &&
- Global.privacyModuleInst.profilePicturesVisibility !==
- Constants.profilePicturesVisibility.everyone)) {
+ Global.privacyModuleInst.profilePicturesVisibility !==
+ Constants.profilePicturesVisibility.everyone)) {
return ""
}
return senderIcon
}
- property string message: ""
+ property string messageText: ""
property string messageImage: ""
property string messageTimestamp: ""
property string messageOutgoingStatus: ""
@@ -100,18 +109,19 @@ Loader {
}
}
- // Legacy
property string responseTo: responseToMessageWithId
+ property string timestamp: messageTimestamp
+
+ // Legacy
property bool isCurrentUser: amISender
property int contentType: messageContentType
- property string timestamp: messageTimestamp
property string displayUserName: senderDisplayName
property string outgoingStatus: messageOutgoingStatus
property string authorCurrentMsg: senderId
property string authorPrevMsg: {
if(!prevMessageAsJsonObj ||
- // The system message for private groups appear as created by the group host, but it shouldn't
- prevMessageAsJsonObj.contentType === Constants.messageContentType.systemMessagePrivateGroupType) {
+ // The system message for private groups appear as created by the group host, but it shouldn't
+ prevMessageAsJsonObj.contentType === Constants.messageContentType.systemMessagePrivateGroupType) {
return ""
}
@@ -143,10 +153,11 @@ Loader {
property bool read: true
property bool forceHoverHandler: false // Used to force the HoverHandler to be active (useful for messages in popups)
property string replaces: ""
- property bool isEdited: false
property bool stickersLoaded: false
//////////////////////////////////////
+ property bool isEdited: false
+
property string sticker: "Qme8vJtyrEHxABcSVGPF95PtozDgUyfr1xGjePmFdZgk9v"
property int stickerPack: -1
property bool isEmoji: contentType === Constants.messageContentType.emojiType
@@ -164,15 +175,17 @@ Loader {
signal imageClicked(var image)
property var scrollToBottom: function () {}
- property var clickMessage: function(isProfileClick,
- isSticker = false,
- isImage = false,
- image = null,
- isEmoji = false,
- hideEmojiPicker = false,
- isReply = false,
- isRightClickOnImage = false,
- imageSource = "") {
+
+ // WARNING: To much arguments here. Create an object argument.
+ property var messageClickHandler: function(isProfileClick,
+ isSticker = false,
+ isImage = false,
+ image = null,
+ isEmoji = false,
+ hideEmojiPicker = false,
+ isReply = false,
+ isRightClickOnImage = false,
+ imageSource = "") {
if (placeholderMessage || activityCenterMessage) {
return
@@ -187,7 +200,7 @@ Loader {
messageContextMenu.messageSenderId = root.senderId
messageContextMenu.messageContentType = root.messageContentType
messageContextMenu.pinnedMessage = root.pinnedMessage
- messageContextMenu.canPin = messageStore.getNumberOfPinnedMessages() < Constants.maxNumberOfPins
+ messageContextMenu.canPin = d.canPin
messageContextMenu.selectedUserPublicKey = root.senderId
messageContextMenu.selectedUserDisplayName = root.senderDisplayName
@@ -201,7 +214,7 @@ Loader {
messageContextMenu.isSticker = isSticker
messageContextMenu.hideEmojiPicker = hideEmojiPicker
- if(isReply){
+ if (isReply){
let obj = messageStore.getMessageByIdAsJson(responseTo)
if(!obj)
return
@@ -212,15 +225,17 @@ Loader {
messageContextMenu.selectedUserIcon = obj.senderIconToShow
}
- messageContextMenu.popup()
+ console.log("Opening messageContextMenu: ", messageContextMenu.isProfile, messageContextMenu.imageSource);
+
+ messageContextMenu.popup(4, 4)
}
signal showReplyArea(string messageId, string author)
-// function showReactionAuthors(fromAccounts, emojiId) {
-// return root.rootStore.showReactionAuthors(fromAccounts, emojiId)
-// }
+ // function showReactionAuthors(fromAccounts, emojiId) {
+ // return root.rootStore.showReactionAuthors(fromAccounts, emojiId)
+ // }
function startMessageFoundAnimation() {
root.item.startMessageFoundAnimation();
@@ -230,23 +245,43 @@ Loader {
signal openStickerPackPopup(string stickerPackId)
// Not Refactored Yet
-// Connections {
-// enabled: (!placeholderMessage && !!root.rootStore)
-// target: !!root.rootStore ? root.rootStore.allContacts : null
-// onContactChanged: {
-// if (pubkey === fromAuthor) {
-// const img = appMain.getProfileImage(userPubKey, isCurrentUser, useLargeImage)
-// if (img) {
-// profileImageSource = img
-// }
-// } else if (replyMessageIndex > -1 && pubkey === repliedMessageAuthorPubkey) {
-// const imgReply = appMain.getProfileImage(repliedMessageAuthorPubkey, repliedMessageAuthorIsCurrentUser, false)
-// if (imgReply) {
-// repliedMessageUserImage = imgReply
-// }
-// }
-// }
-// }
+ // Connections {
+ // enabled: (!placeholderMessage && !!root.rootStore)
+ // target: !!root.rootStore ? root.rootStore.allContacts : null
+ // onContactChanged: {
+ // if (pubkey === fromAuthor) {
+ // const img = appMain.getProfileImage(userPubKey, isCurrentUser, useLargeImage)
+ // if (img) {
+ // profileImageSource = img
+ // }
+ // } else if (replyMessageIndex > -1 && pubkey === repliedMessageAuthorPubkey) {
+ // const imgReply = appMain.getProfileImage(repliedMessageAuthorPubkey, repliedMessageAuthorIsCurrentUser, false)
+ // if (imgReply) {
+ // repliedMessageUserImage = imgReply
+ // }
+ // }
+ // }
+ // }
+
+ function setMessageActive(messageId, active) {
+ if (active) {
+ activeMessage = messageId;
+ return;
+ }
+ if (activeMessage === messageId) {
+ activeMessage = "";
+ return;
+ }
+ }
+
+ QtObject {
+ id: d
+
+ readonly property bool canPin: !!messageStore &&
+ messageStore.getNumberOfPinnedMessages() < Constants.maxNumberOfPins
+
+ readonly property int chatButtonSize: 32
+ }
Component {
id: gapComponent
@@ -292,18 +327,18 @@ Loader {
wrapMode: Text.Wrap
text: {
return ``+
- ``+
- ``+
- ``+
- ``+
- `${message}`+
- ``+
- ``;
+ `}`+
+ ``+
+ ``+
+ ``+
+ `${messageText}`+
+ ``+
+ `