More tweaks for reactions

This commit is contained in:
Sebastian Wolf 2023-11-26 23:36:29 +01:00
parent 24edb17347
commit 61faf0f407
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
6 changed files with 39 additions and 13 deletions

View file

@ -115,6 +115,19 @@ ListItem {
return interactionText;
}
function openReactions() {
if (messageListItem.chatReactions) {
Debug.log("Using chat reactions")
messageListItem.messageReactions = chatReactions
showItemCompletelyTimer.requestedIndex = index;
showItemCompletelyTimer.start();
} else {
Debug.log("Obtaining message reactions")
tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId);
}
selectReactionBubble.visible = false;
}
onClicked: {
if (messageListItem.precalculatedValues.pageIsSelecting) {
page.toggleMessageSelection(myMessage);
@ -134,11 +147,17 @@ ListItem {
messageListItem.messageReactions = null;
selectReactionBubble.visible = false;
} else {
selectReactionBubble.visible = !selectReactionBubble.visible;
if (messageListItem.chatReactions) {
selectReactionBubble.visible = !selectReactionBubble.visible;
}
}
}
}
onDoubleClicked: {
openReactions();
}
onPressAndHold: {
if (openMenuOnPressAndHold) {
openContextMenu()
@ -643,6 +662,17 @@ ListItem {
textFormat: Text.StyledText
maximumLineCount: 1
elide: Text.ElideRight
MouseArea {
anchors.fill: parent
onClicked: {
if (messageListItem.messageReactions) {
messageListItem.messageReactions = null;
selectReactionBubble.visible = false;
} else {
openReactions();
}
}
}
}
}
}
@ -672,16 +702,7 @@ ListItem {
icon.source: "image://theme/icon-s-favorite"
anchors.centerIn: selectReactionBubble
onClicked: {
if (messageListItem.chatReactions) {
Debug.log("Using chat reactions")
messageListItem.messageReactions = chatReactions
showItemCompletelyTimer.requestedIndex = index;
showItemCompletelyTimer.start();
} else {
Debug.log("Obtaining message reactions")
tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId);
}
selectReactionBubble.visible = false;
openReactions();
}
}

View file

@ -576,6 +576,9 @@ Page {
onSponsoredMessageReceived: {
chatPage.containsSponsoredMessages = true;
}
onReactionsUpdated: {
availableReactions = tdLibWrapper.getChatReactions(chatInformation.id);
}
}
Connections {

View file

@ -12,7 +12,7 @@ Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.17
Release: 7
Release: 8
Group: Qt/Qt
License: LICENSE
URL: http://werkwolf.eu/

View file

@ -1,7 +1,7 @@
Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.17
Release: 7
Release: 8
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt

View file

@ -2093,6 +2093,7 @@ void TDLibWrapper::handleActiveEmojiReactionsUpdated(const QStringList& emojis)
if (activeEmojiReactions != emojis) {
activeEmojiReactions = emojis;
LOG(emojis.count() << "reaction(s) available");
emit reactionsUpdated();
}
}

View file

@ -339,6 +339,7 @@ signals:
void chatUnreadMentionCountUpdated(qlonglong chatId, int unreadMentionCount);
void chatUnreadReactionCountUpdated(qlonglong chatId, int unreadReactionCount);
void tgUrlFound(const QString &tgUrl);
void reactionsUpdated();
public slots:
void handleVersionDetected(const QString &version);