fix: fix emojis on normal mode and replies on compact

This commit is contained in:
Jonathan Rainville 2021-02-08 13:46:20 -05:00 committed by Iuri Matias
parent 1616ae255b
commit cabc82782c
6 changed files with 23 additions and 12 deletions

View File

@ -98,7 +98,10 @@ Item {
target: profileModel.contacts.list
onContactChanged: {
if (pubkey === fromAuthor) {
profileImageSource = appMain.getProfileImage(userPubKey, isCurrentUser, useLargeImage)
const img = appMain.getProfileImage(userPubKey, isCurrentUser, useLargeImage)
if (img) {
profileImageSource = img
}
}
}
}

View File

@ -4,6 +4,7 @@ import "../../../../../imports"
Loader {
property int textFieldWidth: item ? item.textField.width : 0
property int textFieldImplicitWidth: 0
property int authorWidth: item ? item.authorMetrics.width : 0
property bool longReply: false
@ -15,15 +16,13 @@ Loader {
active: responseTo != "" && replyMessageIndex > -1
sourceComponent: Component {
Rectangle {
Item {
property alias textField: lblReplyMessage
property alias authorMetrics: txtAuthorMetrics
id: chatReply
visible: responseTo != "" && replyMessageIndex > -1
// childrenRect.height shows a binding loop for soem reason, so we use heights instead
height: this.visible ? lblReplyAuthor.height + ((repliedMessageType === Constants.imageType ? imgReplyImage.height : lblReplyMessage.height) + 5 + 8) : 0
color: Style.current.transparent
// childrenRect.height shows a binding loop for some reason, so we use heights instead
height: lblReplyAuthor.height + ((repliedMessageType === Constants.imageType ? imgReplyImage.height : lblReplyMessage.height) + 5 + 8)
TextMetrics {
id: txtAuthorMetrics
@ -57,6 +56,7 @@ Loader {
StyledTextEdit {
id: lblReplyMessage
visible: repliedMessageType != Constants.imageType
Component.onCompleted: textFieldImplicitWidth = implicitWidth
anchors.top: lblReplyAuthor.bottom
anchors.topMargin: 5
text: `<style type="text/css">`+
@ -79,7 +79,7 @@ Loader {
wrapMode: Text.Wrap
font.pixelSize: Style.current.secondaryTextFontSize
anchors.left: parent.left
anchors.right: root.longReply ? parent.right : undefined
width: root.longReply ? parent.width : implicitWidth
z: 51
}

View File

@ -104,8 +104,10 @@ Item {
ChatReply {
id: chatReply
longReply: active && textFieldImplicitWidth > width
container: root.container
chatHorizontalPadding: root.chatHorizontalPadding
width: parent.width
}
ChatText {

View File

@ -208,7 +208,9 @@ Item {
onEntered: addEmojiBtn.isHovered = true
onExited: addEmojiBtn.isHovered = false
onClicked: {
isMessageActive = true
if (typeof isMessageActive !== "undefined") {
isMessageActive = true
}
clickMessage(false, false, false, null, true)
}
}

View File

@ -10,7 +10,9 @@ MouseArea {
onClicked: {
if(mouse.button & Qt.RightButton) {
clickMessage(false, isSticker, false);
isMessageActive = true
if (typeof isMessageActive !== "undefined") {
isMessageActive = true
}
return;
}
if (mouse.button & Qt.LeftButton) {

View File

@ -44,7 +44,7 @@ Item {
readonly property int maxMessageChars: (defaultMaxMessageChars * messageWidth) / defaultMessageWidth
property int chatVerticalPadding: isImage ? 4 : 6
property int chatHorizontalPadding: isImage ? 0 : 12
property bool longReply: chatReply.visible && repliedMessageContent.length > maxMessageChars
property bool longReply: chatReply.active && repliedMessageContent.length > maxMessageChars
property bool longChatText: chatsModel.plainText(message).split('\n').some(function (messagePart) {
return messagePart.length > maxMessageChars
})
@ -125,7 +125,7 @@ Item {
anchors.right: parent.right
anchors.rightMargin: chatBox.chatHorizontalPadding
container: root.container
chatHorizontalPadding: chatBox.chatHorizontalPadding
chatHorizontalPadding: chatBox.chatHorizontalPadding
}
ChatText {
@ -235,6 +235,7 @@ Item {
ChatTime {
id: chatTime
visible: isMessage && !emojiReactionLoader.active
anchors.top: isImage ? undefined : (linksLoader.active ? linksLoader.bottom : chatBox.bottom)
anchors.topMargin: isImage ? 0 : 4
anchors.verticalCenter: isImage ? dateTimeBackground.verticalCenter : undefined
@ -281,7 +282,8 @@ Item {
id: emojiReactionLoader
active: emojiReactions !== ""
sourceComponent: emojiReactionsComponent
anchors.left: chatBox.left
anchors.left: root.isCurrentUser ? undefined : chatBox.left
anchors.right: root.isCurrentUser ? chatBox.right : undefined
anchors.leftMargin: root.isCurrentUser ? Style.current.halfPadding : 1
anchors.top: chatBox.bottom
anchors.topMargin: 2