From 7ab58d3730569c4ba36ff9ac2d1ad95b31f8f1e8 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Thu, 26 Nov 2020 16:11:12 +0100 Subject: [PATCH] Add option to close a secret chat --- qml/pages/ChatPage.qml | 13 +++++++++++++ src/tdlibwrapper.cpp | 9 +++++++++ src/tdlibwrapper.h | 1 + translations/harbour-fernschreiber-de.ts | 8 ++++++++ translations/harbour-fernschreiber-en.ts | 8 ++++++++ translations/harbour-fernschreiber-es.ts | 8 ++++++++ translations/harbour-fernschreiber-fi.ts | 8 ++++++++ translations/harbour-fernschreiber-hu.ts | 8 ++++++++ translations/harbour-fernschreiber-it.ts | 8 ++++++++ translations/harbour-fernschreiber-pl.ts | 8 ++++++++ translations/harbour-fernschreiber-ru.ts | 8 ++++++++ translations/harbour-fernschreiber-sv.ts | 8 ++++++++ translations/harbour-fernschreiber-zh_CN.ts | 8 ++++++++ translations/harbour-fernschreiber.ts | 8 ++++++++ 14 files changed, 111 insertions(+) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index d7e885c..244baa8 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -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" diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index dfc1dde..b774f1c 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -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); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 426d5c6..734a186 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -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); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index f567081..efdc353 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -383,6 +383,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. Dieser geheime Chat ist noch nicht bereit. Ihr Chatpartner muss erst noch online gehen. + + Closing chat + Schließe Chat + + + Close Chat + Chat schließen + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index d9aad5d..a94105c 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -383,6 +383,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + Closing chat + + + Close Chat + Close Chat + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 8949356..2e23061 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -373,6 +373,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 22ace3a..cd35d38 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -383,6 +383,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 0fbcec8..c9e57e5 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -373,6 +373,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 3cabd13..e05cadc 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -383,6 +383,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index ff4c3c6..0a52400 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -393,6 +393,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 74c69a9..a169b83 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -393,6 +393,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 2724b54..e69719b 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -383,6 +383,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 0bf69e7..6b95c79 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -373,6 +373,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 5d67afc..4437afa 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -383,6 +383,14 @@ This secret chat is not yet ready. Your chat partner needs to go online first. + + Closing chat + + + + Close Chat + + ChatSelectionPage