Add option to close a secret chat

This commit is contained in:
Sebastian Wolf 2020-11-26 16:11:12 +01:00
parent 6f889437ed
commit 7ab58d3730
14 changed files with 111 additions and 0 deletions

View file

@ -577,6 +577,19 @@ Page {
PullDownMenu {
visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active && !messageOverlayLoader.active
MenuItem {
id: closeSecretChatMenuItem
visible: chatPage.isSecretChat && chatPage.secretChatDetails.state["@type"] !== "secretChatStateClosed"
onClicked: {
var remorse = Remorse.popupAction(appWindow, qsTr("Closing chat"), (function(secretChatId) {
return function() {
tdLibWrapper.closeSecretChat(secretChatId);
};
}(chatPage.secretChatDetails.id)))
}
text: qsTr("Close Chat")
}
MenuItem {
id: joinLeaveChatMenuItem
visible: (chatPage.isSuperGroup || chatPage.isBasicGroup) && chatGroupInformation && chatGroupInformation.status["@type"] !== "chatMemberStatusBanned"

View file

@ -833,6 +833,15 @@ void TDLibWrapper::getSecretChat(const QString &secretChatId)
this->sendRequest(requestObject);
}
void TDLibWrapper::closeSecretChat(const QString &secretChatId)
{
LOG("Closing secret chat" << secretChatId);
QVariantMap requestObject;
requestObject.insert(_TYPE, "closeSecretChat");
requestObject.insert("secret_chat_id", secretChatId);
this->sendRequest(requestObject);
}
void TDLibWrapper::searchEmoji(const QString &queryString)
{
LOG("Searching emoji" << queryString);

View file

@ -175,6 +175,7 @@ public:
Q_INVOKABLE void getDeepLinkInfo(const QString &link);
Q_INVOKABLE void getContacts();
Q_INVOKABLE void getSecretChat(const QString &secretChatId);
Q_INVOKABLE void closeSecretChat(const QString &secretChatId);
// Others (candidates for extraction ;))
Q_INVOKABLE void searchEmoji(const QString &queryString);

View file

@ -383,6 +383,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation>Dieser geheime Chat ist noch nicht bereit. Ihr Chatpartner muss erst noch online gehen.</translation>
</message>
<message>
<source>Closing chat</source>
<translation>Schließe Chat</translation>
</message>
<message>
<source>Close Chat</source>
<translation>Chat schließen</translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -383,6 +383,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation>This secret chat is not yet ready. Your chat partner needs to go online first.</translation>
</message>
<message>
<source>Closing chat</source>
<translation>Closing chat</translation>
</message>
<message>
<source>Close Chat</source>
<translation>Close Chat</translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -373,6 +373,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -383,6 +383,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -373,6 +373,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -383,6 +383,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -393,6 +393,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -393,6 +393,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -383,6 +383,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -373,6 +373,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>

View file

@ -383,6 +383,14 @@
<source>This secret chat is not yet ready. Your chat partner needs to go online first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closing chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close Chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatSelectionPage</name>