Display group information for anonymous messages
This commit is contained in:
parent
039aca14bf
commit
ff399a524c
3 changed files with 9 additions and 7 deletions
|
@ -36,7 +36,7 @@ Row {
|
||||||
|
|
||||||
onInReplyToMessageChanged: {
|
onInReplyToMessageChanged: {
|
||||||
if (inReplyToMessage) {
|
if (inReplyToMessage) {
|
||||||
inReplyToUserText.text = (inReplyToRow.inReplyToMessage.sender.user_id !== inReplyToRow.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(inReplyToRow.inReplyToMessage.sender.user_id)), inReplyToUserText.font.pixelSize) : qsTr("You");
|
inReplyToUserText.text = (inReplyToMessage.sender["@type"] === "messageSenderChat" ? page.chatInformation.title : (inReplyToRow.inReplyToMessage.sender.user_id !== inReplyToRow.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(inReplyToRow.inReplyToMessage.sender.user_id)), inReplyToUserText.font.pixelSize) : qsTr("You"));
|
||||||
inReplyToMessageText.text = Emoji.emojify(Functions.getMessageText(inReplyToRow.inReplyToMessage, true, inReplyToRow.inReplyToMessage.sender.user_id === inReplyToRow.myUserId, false), inReplyToMessageText.font.pixelSize);
|
inReplyToMessageText.text = Emoji.emojify(Functions.getMessageText(inReplyToRow.inReplyToMessage, true, inReplyToRow.inReplyToMessage.sender.user_id === inReplyToRow.myUserId, false), inReplyToMessageText.font.pixelSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ ListItem {
|
||||||
property var messageId
|
property var messageId
|
||||||
property var myMessage
|
property var myMessage
|
||||||
property bool canReplyToMessage
|
property bool canReplyToMessage
|
||||||
|
readonly property bool isAnonymous: myMessage.sender["@type"] === "messageSenderChat"
|
||||||
readonly property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender.user_id)
|
readonly property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender.user_id)
|
||||||
property QtObject precalculatedValues: ListView.view.precalculatedValues
|
property QtObject precalculatedValues: ListView.view.precalculatedValues
|
||||||
readonly property color textColor: isOwnMessage ? Theme.highlightColor : Theme.primaryColor
|
readonly property color textColor: isOwnMessage ? Theme.highlightColor : Theme.primaryColor
|
||||||
|
@ -218,14 +219,14 @@ ListItem {
|
||||||
sourceComponent: Component {
|
sourceComponent: Component {
|
||||||
ProfileThumbnail {
|
ProfileThumbnail {
|
||||||
id: messagePictureThumbnail
|
id: messagePictureThumbnail
|
||||||
photoData: (typeof messageListItem.userInformation.profile_photo !== "undefined") ? messageListItem.userInformation.profile_photo.small : ({})
|
photoData: messageListItem.isAnonymous ? ((typeof page.chatInformation.photo !== "undefined") ? page.chatInformation.photo.small : {}) : ((typeof messageListItem.userInformation.profile_photo !== "undefined") ? messageListItem.userInformation.profile_photo.small : ({}))
|
||||||
replacementStringHint: userText.text
|
replacementStringHint: userText.text
|
||||||
width: Theme.itemSizeSmall
|
width: Theme.itemSizeSmall
|
||||||
height: Theme.itemSizeSmall
|
height: Theme.itemSizeSmall
|
||||||
visible: precalculatedValues.showUserInfo
|
visible: precalculatedValues.showUserInfo
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: !messageListItem.precalculatedValues.pageIsSelecting
|
enabled: !(messageListItem.precalculatedValues.pageIsSelecting || messageListItem.isAnonymous)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tdLibWrapper.createPrivateChat(messageListItem.userInformation.id);
|
tdLibWrapper.createPrivateChat(messageListItem.userInformation.id);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +273,7 @@ ListItem {
|
||||||
id: userText
|
id: userText
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: messageListItem.isOwnMessage ? qsTr("You") : Emoji.emojify(Functions.getUserName(messageListItem.userInformation), font.pixelSize)
|
text: messageListItem.isOwnMessage ? qsTr("You") : Emoji.emojify(messageListItem.isAnonymous ? page.chatInformation.title : Functions.getUserName(messageListItem.userInformation), font.pixelSize)
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
font.weight: Font.ExtraBold
|
font.weight: Font.ExtraBold
|
||||||
color: messageListItem.textColor
|
color: messageListItem.textColor
|
||||||
|
@ -283,7 +284,7 @@ ListItem {
|
||||||
visible: precalculatedValues.showUserInfo
|
visible: precalculatedValues.showUserInfo
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: !messageListItem.precalculatedValues.pageIsSelecting
|
enabled: !(messageListItem.precalculatedValues.pageIsSelecting || messageListItem.isAnonymous)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tdLibWrapper.createPrivateChat(messageListItem.userInformation.id);
|
tdLibWrapper.createPrivateChat(messageListItem.userInformation.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ Flickable {
|
||||||
property bool showHeader: true
|
property bool showHeader: true
|
||||||
readonly property var userInformation: tdLibWrapper.getUserInformation(overlayMessage.sender.user_id);
|
readonly property var userInformation: tdLibWrapper.getUserInformation(overlayMessage.sender.user_id);
|
||||||
readonly property bool isOwnMessage: tdLibWrapper.getUserInformation().id === overlayMessage.sender.user_id;
|
readonly property bool isOwnMessage: tdLibWrapper.getUserInformation().id === overlayMessage.sender.user_id;
|
||||||
|
readonly property bool isAnonymous: overlayMessage.sender["@type"] === "messageSenderChat"
|
||||||
readonly property string extraContentComponentName: (typeof overlayMessage.content !== "undefined" && typeof chatView.contentComponentNames[overlayMessage.content['@type']] !== "undefined" )
|
readonly property string extraContentComponentName: (typeof overlayMessage.content !== "undefined" && typeof chatView.contentComponentNames[overlayMessage.content['@type']] !== "undefined" )
|
||||||
? chatView.contentComponentNames[overlayMessage.content['@type']] : ""
|
? chatView.contentComponentNames[overlayMessage.content['@type']] : ""
|
||||||
signal requestClose;
|
signal requestClose;
|
||||||
|
@ -104,7 +105,7 @@ Flickable {
|
||||||
spacing: Theme.paddingMedium
|
spacing: Theme.paddingMedium
|
||||||
ProfileThumbnail {
|
ProfileThumbnail {
|
||||||
id: overlayMessagePictureThumbnail
|
id: overlayMessagePictureThumbnail
|
||||||
photoData: (typeof messageOverlayFlickable.userInformation.profile_photo !== "undefined") ? messageOverlayFlickable.userInformation.profile_photo.small : ({})
|
photoData: messageOverlayFlickable.isAnonymous ? ((typeof chatPage.chatInformation.photo !== "undefined") ? chatPage.chatInformation.photo.small : {}) : ((typeof messageOverlayFlickable.userInformation.profile_photo !== "undefined") ? messageOverlayFlickable.userInformation.profile_photo.small : ({}))
|
||||||
replacementStringHint: overlayMessageUserText.text
|
replacementStringHint: overlayMessageUserText.text
|
||||||
width: Theme.itemSizeLarge
|
width: Theme.itemSizeLarge
|
||||||
height: Theme.itemSizeLarge
|
height: Theme.itemSizeLarge
|
||||||
|
@ -114,7 +115,7 @@ Flickable {
|
||||||
|
|
||||||
width: parent.width - overlayMessagePictureThumbnail.width
|
width: parent.width - overlayMessagePictureThumbnail.width
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: messageOverlayFlickable.isOwnMessage ? qsTr("You") : Emoji.emojify(Functions.getUserName(messageOverlayFlickable.userInformation), font.pixelSize)
|
text: messageOverlayFlickable.isOwnMessage ? qsTr("You") : Emoji.emojify(messageOverlayFlickable.isAnonymous ? chatPage.chatInformation.title : Functions.getUserName(messageOverlayFlickable.userInformation), font.pixelSize)
|
||||||
font.pixelSize: Theme.fontSizeExtraLarge
|
font.pixelSize: Theme.fontSizeExtraLarge
|
||||||
font.weight: Font.ExtraBold
|
font.weight: Font.ExtraBold
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
|
|
Loading…
Reference in a new issue