Start work on un/muting chats
This commit is contained in:
parent
0daea61bd9
commit
1a5aa9de3f
5 changed files with 44 additions and 1 deletions
|
@ -223,6 +223,21 @@ Page {
|
|||
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : display });
|
||||
}
|
||||
|
||||
menu: ContextMenu {
|
||||
MenuItem {
|
||||
onClicked: {
|
||||
var newNotificationSettings = display.notification_settings;
|
||||
if (newNotificationSettings.mute_for > 0) {
|
||||
newNotificationSettings.mute_for = 0;
|
||||
} else {
|
||||
newNotificationSettings.mute_for = 666666;
|
||||
}
|
||||
tdLibWrapper.setChatNotificationSettings(display.id, newNotificationSettings);
|
||||
}
|
||||
text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat")
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: chatListModel
|
||||
onChatChanged: {
|
||||
|
|
|
@ -90,6 +90,7 @@ void TDLibWrapper::sendRequest(const QVariantMap &requestObject)
|
|||
{
|
||||
qDebug() << "[TDLibWrapper] Sending request to TD Lib, object type name: " << requestObject.value("@type").toString();
|
||||
QJsonDocument requestDocument = QJsonDocument::fromVariant(requestObject);
|
||||
qDebug().noquote() << requestDocument.toJson();
|
||||
td_json_client_send(this->tdLibClient, requestDocument.toJson().constData());
|
||||
}
|
||||
|
||||
|
@ -227,7 +228,7 @@ void TDLibWrapper::getMessage(const QString &chatId, const QString &messageId)
|
|||
|
||||
void TDLibWrapper::setOptionInteger(const QString &optionName, const int &optionValue)
|
||||
{
|
||||
qDebug() << "[TDLibWrapper] Setting integet option " << optionName << optionValue;
|
||||
qDebug() << "[TDLibWrapper] Setting integer option " << optionName << optionValue;
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert("@type", "setOption");
|
||||
requestObject.insert("name", optionName);
|
||||
|
@ -238,6 +239,16 @@ void TDLibWrapper::setOptionInteger(const QString &optionName, const int &option
|
|||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::setChatNotificationSettings(const QString &chatId, const QVariantMap ¬ificationSettings)
|
||||
{
|
||||
qDebug() << "[TDLibWrapper] Notification settings for chat " << chatId << notificationSettings;
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert("@type", "setChatNotificationSettings");
|
||||
requestObject.insert("chat_id", chatId);
|
||||
requestObject.insert("notification_settings", notificationSettings);
|
||||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
QVariantMap TDLibWrapper::getUserInformation()
|
||||
{
|
||||
return this->userInformation;
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0");
|
||||
Q_INVOKABLE void getMessage(const QString &chatId, const QString &messageId);
|
||||
Q_INVOKABLE void setOptionInteger(const QString &optionName, const int &optionValue);
|
||||
Q_INVOKABLE void setChatNotificationSettings(const QString &chatId, const QVariantMap ¬ificationSettings);
|
||||
|
||||
signals:
|
||||
void versionDetected(const QString &version);
|
||||
|
|
|
@ -358,6 +358,14 @@
|
|||
<source>Loading chat list...</source>
|
||||
<translation>Lade Chatliste...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unmute Chat</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mute Chat</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
|
|
|
@ -358,6 +358,14 @@
|
|||
<source>Loading chat list...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unmute Chat</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Mute Chat</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoPage</name>
|
||||
|
|
Loading…
Reference in a new issue