upstream_fixes_28112023 #15
3 changed files with 45 additions and 6 deletions
|
@ -705,12 +705,25 @@ ListItem {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tdLibWrapper.setMessageReaction(messageListItem.chatId, messageListItem.messageId, modelData);
|
for (var i = 0; i < reactions.length; i++) {
|
||||||
messageListItem.messageReactions = null;
|
var reaction = reactions[i]
|
||||||
|
var reactionText = reaction.reaction ? reaction.reaction : (reaction.type && reaction.type.emoji) ? reaction.type.emoji : ""
|
||||||
|
if (reactionText === modelData) {
|
||||||
|
if (reaction.is_chosen) {
|
||||||
|
// Reaction is already selected
|
||||||
|
tdLibWrapper.removeMessageReaction(chatId, messageId, reactionText)
|
||||||
|
messageReactions = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Reaction is not yet selected
|
||||||
|
tdLibWrapper.addMessageReaction(chatId, messageId, modelData)
|
||||||
|
messageReactions = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1462,9 +1462,8 @@ void TDLibWrapper::getPageSource(const QString &address)
|
||||||
connect(reply, SIGNAL(finished()), this, SLOT(handleGetPageSourceFinished()));
|
connect(reply, SIGNAL(finished()), this, SLOT(handleGetPageSourceFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDLibWrapper::setMessageReaction(qlonglong chatId, qlonglong messageId, const QString &reaction)
|
void TDLibWrapper::addMessageReaction(qlonglong chatId, qlonglong messageId, const QString &reaction)
|
||||||
{
|
{
|
||||||
LOG("Set message reaction" << chatId << messageId << reaction);
|
|
||||||
QVariantMap requestObject;
|
QVariantMap requestObject;
|
||||||
requestObject.insert(CHAT_ID, chatId);
|
requestObject.insert(CHAT_ID, chatId);
|
||||||
requestObject.insert(MESSAGE_ID, messageId);
|
requestObject.insert(MESSAGE_ID, messageId);
|
||||||
|
@ -1479,9 +1478,35 @@ void TDLibWrapper::setMessageReaction(qlonglong chatId, qlonglong messageId, con
|
||||||
reactionType.insert(EMOJI, reaction);
|
reactionType.insert(EMOJI, reaction);
|
||||||
requestObject.insert(REACTION_TYPE, reactionType);
|
requestObject.insert(REACTION_TYPE, reactionType);
|
||||||
requestObject.insert(_TYPE, "addMessageReaction");
|
requestObject.insert(_TYPE, "addMessageReaction");
|
||||||
|
LOG("Add message reaction" << chatId << messageId << reaction);
|
||||||
} else {
|
} else {
|
||||||
requestObject.insert("reaction", reaction);
|
requestObject.insert("reaction", reaction);
|
||||||
requestObject.insert(_TYPE, "setMessageReaction");
|
requestObject.insert(_TYPE, "setMessageReaction");
|
||||||
|
LOG("Toggle message reaction" << chatId << messageId << reaction);
|
||||||
|
}
|
||||||
|
this->sendRequest(requestObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDLibWrapper::removeMessageReaction(qlonglong chatId, qlonglong messageId, const QString &reaction)
|
||||||
|
{
|
||||||
|
QVariantMap requestObject;
|
||||||
|
requestObject.insert(CHAT_ID, chatId);
|
||||||
|
requestObject.insert(MESSAGE_ID, messageId);
|
||||||
|
if (versionNumber > VERSION_NUMBER(1,8,5)) {
|
||||||
|
// "reaction_type": {
|
||||||
|
// "@type": "reactionTypeEmoji",
|
||||||
|
// "emoji": "..."
|
||||||
|
// }
|
||||||
|
QVariantMap reactionType;
|
||||||
|
reactionType.insert(_TYPE, REACTION_TYPE_EMOJI);
|
||||||
|
reactionType.insert(EMOJI, reaction);
|
||||||
|
requestObject.insert(REACTION_TYPE, reactionType);
|
||||||
|
requestObject.insert(_TYPE, "removeMessageReaction");
|
||||||
|
LOG("Remove message reaction" << chatId << messageId << reaction);
|
||||||
|
} else {
|
||||||
|
requestObject.insert("reaction", reaction);
|
||||||
|
requestObject.insert(_TYPE, "setMessageReaction");
|
||||||
|
LOG("Toggle message reaction" << chatId << messageId << reaction);
|
||||||
}
|
}
|
||||||
this->sendRequest(requestObject);
|
this->sendRequest(requestObject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,8 @@ public:
|
||||||
Q_INVOKABLE void terminateSession(const QString &sessionId);
|
Q_INVOKABLE void terminateSession(const QString &sessionId);
|
||||||
Q_INVOKABLE void getMessageAvailableReactions(qlonglong chatId, qlonglong messageId);
|
Q_INVOKABLE void getMessageAvailableReactions(qlonglong chatId, qlonglong messageId);
|
||||||
Q_INVOKABLE void getPageSource(const QString &address);
|
Q_INVOKABLE void getPageSource(const QString &address);
|
||||||
Q_INVOKABLE void setMessageReaction(qlonglong chatId, qlonglong messageId, const QString &reaction);
|
Q_INVOKABLE void addMessageReaction(qlonglong chatId, qlonglong messageId, const QString &reaction);
|
||||||
|
Q_INVOKABLE void removeMessageReaction(qlonglong chatId, qlonglong messageId, const QString &reaction);
|
||||||
Q_INVOKABLE void setNetworkType(NetworkType networkType);
|
Q_INVOKABLE void setNetworkType(NetworkType networkType);
|
||||||
Q_INVOKABLE void setInactiveSessionTtl(int days);
|
Q_INVOKABLE void setInactiveSessionTtl(int days);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue