From 1ee8d134bcec5914a921be4ca49331cf79599cab Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 18 Nov 2023 15:45:22 +0200 Subject: [PATCH 01/52] Adapt to changes in TdLib (#524) * Adapt setTdlibParameters for TdLib > 1.8.5 For some reason tdlibParameters were inlined between 1.8.5 and 1.8.6 See https://github.com/tdlib/td/commit/f6a2ecd * sponsoredMessage => sponsoredMessages in TdLib 1.8.8 See https://github.com/tdlib/td/commit/ec1310a * Support another variant of messageReaction The reaction field has changed from string to ReactionType somewhere between 1.8.5 and 1.8.6 See https://github.com/tdlib/td/commit/b14708f * Add support for new message reactions API It has changed between 1.8.5 and 1.8.6 https://github.com/tdlib/td/commit/b14708f (ReactionType) https://github.com/tdlib/td/commit/0b8e143 (ChatAvailableReactions) https://github.com/tdlib/td/commit/6b2f6b4 (addMessageReaction) https://github.com/tdlib/td/commit/d29d367 (updateActiveEmojiReactions) etc. * Highlight chosen reaction * Support username in the new format username attribute has been replaced with usernames in 1.8.8 and now looks like this: "usernames": { "@type": "usernames", "active_usernames": [ "whatever" ], "disabled_usernames": [ ], "editable_username": "whatever" } See https://github.com/tdlib/td/commit/897032e * Support new reply_to message attribute Since 1.8.15 it replaces reply_to_message_id and reply_in_chat_id. Looks like this: "reply_to": { "@type": "messageReplyToMessage", "chat_id": -1001234567890, "is_quote_manual": false, "message_id": 234567890, "origin_send_date": 0 }, See https://github.com/tdlib/td/commit/6116573 * Added support for MessageOrigin values All of a sudden MessageForwardOrigin has been renamed into MessageOrigin in TdLib 1.8.20 just because why not: https://github.com/tdlib/td/commit/10c9e40 --- qml/components/MessageListViewItem.qml | 26 ++- qml/components/MessageOverlayFlickable.qml | 2 + .../ChatInformationTabItemMembersGroups.qml | 5 +- qml/pages/ChatPage.qml | 4 +- src/tdlibreceiver.cpp | 69 ++++++- src/tdlibreceiver.h | 3 + src/tdlibwrapper.cpp | 179 +++++++++++++----- src/tdlibwrapper.h | 8 +- 8 files changed, 235 insertions(+), 61 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 88ab301..b01a39a 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -64,6 +64,7 @@ ListItem { readonly property bool showForwardMessageMenuItem: (baseContextMenuItemCount + 2) <= maxContextMenuItemCount // And don't count "More Options..." for "Delete Message" if "Delete Message" is the only extra option readonly property bool haveSpaceForDeleteMessageMenuItem: (baseContextMenuItemCount + 3 - (deleteMessageIsOnlyExtraOption ? 1 : 0)) <= maxContextMenuItemCount + property var chatReactions property var messageReactions highlighted: (down || isSelected || additionalOptionsOpened) && !menuOpen @@ -94,15 +95,21 @@ ListItem { } } - function getInteractionText(viewCount, reactions) { + function getInteractionText(viewCount, reactions, size, highlightColor) { var interactionText = ""; if (viewCount > 0) { - interactionText = Emoji.emojify("👁️", Theme.fontSizeTiny) + Functions.getShortenedCount(viewCount); + interactionText = Emoji.emojify("👁️ ", size) + Functions.getShortenedCount(viewCount); } for (var i = 0; i < reactions.length; i++) { - interactionText += ( " " + Emoji.emojify(reactions[i].reaction, Theme.fontSizeTiny) ); - if (!chatPage.isPrivateChat) { - interactionText += ( " " + Functions.getShortenedCount(reactions[i].total_count) ); + var reaction = reactions[i] + var reactionText = reaction.reaction ? reaction.reaction : (reaction.type && reaction.type.emoji) ? reaction.type.emoji : "" + if (reactionText) { + interactionText += ( " " + Emoji.emojify(reactionText, size) ); + if (!chatPage.isPrivateChat) { + var count = Functions.getShortenedCount(reaction.total_count) + interactionText += " " + interactionText += (reaction.is_chosen ? ( "" + count + "" ) : count) + } } } return interactionText; @@ -125,6 +132,8 @@ ListItem { if (messageListItem.messageReactions) { messageListItem.messageReactions = null; + } else if (messageListItem.chatReactions) { + messageListItem.messageReactions = chatReactions } else { tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId); } @@ -467,11 +476,12 @@ ListItem { width: parent.width Component.onCompleted: { - if (myMessage.forward_info.origin["@type"] === "messageForwardOriginChannel") { + var originType = myMessage.forward_info.origin["@type"] + if (originType === "messageOriginChannel" || originType === "messageForwardOriginChannel") { var otherChatInformation = tdLibWrapper.getChat(myMessage.forward_info.origin.chat_id); forwardedThumbnail.photoData = (typeof otherChatInformation.photo !== "undefined") ? otherChatInformation.photo.small : {}; forwardedChannelText.text = Emoji.emojify(otherChatInformation.title, Theme.fontSizeExtraSmall); - } else if (myMessage.forward_info.origin["@type"] === "messageForwardOriginUser") { + } else if (originType === "messageOriginUser" || originType === "messageForwardOriginUser") { var otherUserInformation = tdLibWrapper.getUserInformation(myMessage.forward_info.origin.sender_user_id); forwardedThumbnail.photoData = (typeof otherUserInformation.profile_photo !== "undefined") ? otherUserInformation.profile_photo.small : {}; forwardedChannelText.text = Emoji.emojify(Functions.getUserName(otherUserInformation), Theme.fontSizeExtraSmall); @@ -625,7 +635,7 @@ ListItem { height: ( ( chatPage.isChannel && messageViewCount > 0 ) || reactions.length > 0 ) ? ( Theme.fontSizeExtraSmall + Theme.paddingSmall ) : 0 sourceComponent: Component { Label { - text: getInteractionText(messageViewCount, reactions) + text: getInteractionText(messageViewCount, reactions, font.pixelSize, Theme.highlightColor) width: parent.width font.pixelSize: Theme.fontSizeTiny color: messageListItem.isOwnMessage ? Theme.secondaryHighlightColor : Theme.secondaryColor diff --git a/qml/components/MessageOverlayFlickable.qml b/qml/components/MessageOverlayFlickable.qml index 274a284..b5d8915 100644 --- a/qml/components/MessageOverlayFlickable.qml +++ b/qml/components/MessageOverlayFlickable.qml @@ -40,9 +40,11 @@ Flickable { function getOriginalAuthor(forwardInformation, fontSize) { switch (forwardInformation.origin["@type"]) { + case "messageOriginChannel": case "messageForwardOriginChannel": var otherChatInformation = tdLibWrapper.getChat(forwardInformation.origin.chat_id); return Emoji.emojify(otherChatInformation.title, fontSize); + case "messageOriginUser": case "messageForwardOriginUser": var otherUserInformation = tdLibWrapper.getUserInformation(forwardInformation.origin.sender_id.user_id); return Emoji.emojify(Functions.getUserName(otherUserInformation), fontSize); diff --git a/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml b/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml index b4280b5..2b12c6f 100644 --- a/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml +++ b/qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml @@ -79,7 +79,7 @@ ChatInformationTabItemBase { // chat title primaryText.text: Emoji.emojify(Functions.getUserName(user), primaryText.font.pixelSize) // last user - prologSecondaryText.text: "@"+(user.username !== "" ? user.username : member_id.user_id) + (member_id.user_id === chatInformationPage.myUserId ? " " + qsTr("You") : "") + prologSecondaryText.text: "@"+(user.username ? user.username : member_id.user_id) + (member_id.user_id === chatInformationPage.myUserId ? " " + qsTr("You") : "") secondaryText { horizontalAlignment: Text.AlignRight property string statusText: Functions.getChatMemberStatusText(model.status["@type"]) @@ -180,6 +180,9 @@ ChatInformationTabItemBase { for(var memberIndex in members) { var memberData = members[memberIndex]; var userInfo = tdLibWrapper.getUserInformation(memberData.member_id.user_id) || {user:{}, bot_info:{}}; + if (!userInfo.username && userInfo.usernames && userInfo.usernames.active_usernames) { + userInfo.username = userInfo.usernames.active_usernames[0] + } memberData.user = userInfo; memberData.bot_info = memberData.bot_info || {}; pageContent.membersList.append(memberData); diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index acfec79..c4bb440 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -66,6 +66,7 @@ Page { readonly property bool canSendMessages: hasSendPrivilege("can_send_messages") property bool doSendBotStartMessage property string sendBotStartMessageParameter + property var availableReactions states: [ State { @@ -184,7 +185,7 @@ Page { } tdLibWrapper.getChatPinnedMessage(chatInformation.id); tdLibWrapper.toggleChatIsMarkedAsUnread(chatInformation.id, false); - + availableReactions = tdLibWrapper.getChatReactions(chatInformation.id); } function getMessageStatusText(message, listItemIndex, lastReadSentIndex, useElapsed) { @@ -1348,6 +1349,7 @@ Page { messageId: model.message_id messageViewCount: model.view_count reactions: model.reactions + chatReactions: availableReactions messageIndex: model.index hasContentComponent: !!myMessage.content && chatView.delegateMessagesContent.indexOf(model.content_type) > -1 canReplyToMessage: chatPage.canSendMessages diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index 985e7b7..ba035e9 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -60,6 +60,10 @@ namespace { const QString CONTENT("content"); const QString NEW_CONTENT("new_content"); const QString SETS("sets"); + const QString EMOJIS("emojis"); + const QString REPLY_TO("reply_to"); + const QString REPLY_IN_CHAT_ID("reply_in_chat_id"); + const QString REPLY_TO_MESSAGE_ID("reply_to_message_id"); const QString _TYPE("@type"); const QString _EXTRA("@extra"); @@ -70,6 +74,7 @@ namespace { const QString TYPE_MESSAGE("message"); const QString TYPE_STICKER("sticker"); const QString TYPE_MESSAGE_STICKER("messageSticker"); + const QString TYPE_MESSAGE_REPLY_TO_MESSAGE("messageReplyToMessage"); const QString TYPE_MESSAGE_ANIMATED_EMOJI("messageAnimatedEmoji"); const QString TYPE_ANIMATED_EMOJI("animatedEmoji"); } @@ -119,7 +124,8 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("updateSupergroup", &TDLibReceiver::processUpdateSuperGroup); handlers.insert("updateChatOnlineMemberCount", &TDLibReceiver::processChatOnlineMemberCountUpdated); handlers.insert("messages", &TDLibReceiver::processMessages); - handlers.insert("sponsoredMessage", &TDLibReceiver::processSponsoredMessage); + handlers.insert("sponsoredMessage", &TDLibReceiver::processSponsoredMessage); // TdLib <= 1.8.7 + handlers.insert("sponsoredMessages", &TDLibReceiver::processSponsoredMessages); // TdLib >= 1.8.8 handlers.insert("updateNewMessage", &TDLibReceiver::processUpdateNewMessage); handlers.insert("message", &TDLibReceiver::processMessage); handlers.insert("messageLinkInfo", &TDLibReceiver::processMessageLinkInfo); @@ -167,6 +173,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("availableReactions", &TDLibReceiver::processAvailableReactions); handlers.insert("updateChatUnreadMentionCount", &TDLibReceiver::processUpdateChatUnreadMentionCount); handlers.insert("updateChatUnreadReactionCount", &TDLibReceiver::processUpdateChatUnreadReactionCount); + handlers.insert("updateActiveEmojiReactions", &TDLibReceiver::processUpdateActiveEmojiReactions); } void TDLibReceiver::setActive(bool active) @@ -382,11 +389,24 @@ void TDLibReceiver::processMessages(const QVariantMap &receivedInformation) void TDLibReceiver::processSponsoredMessage(const QVariantMap &receivedInformation) { + // TdLib <= 1.8.7 const qlonglong chatId = receivedInformation.value(_EXTRA).toLongLong(); // See TDLibWrapper::getChatSponsoredMessage LOG("Received sponsored message for chat" << chatId); emit sponsoredMessageReceived(chatId, receivedInformation); } +void TDLibReceiver::processSponsoredMessages(const QVariantMap &receivedInformation) +{ + // TdLib >= 1.8.8 + const qlonglong chatId = receivedInformation.value(_EXTRA).toLongLong(); // See TDLibWrapper::getChatSponsoredMessage + const QVariantList messages(receivedInformation.value(MESSAGES).toList()); + LOG("Received" << messages.count() << "sponsored messages for chat" << chatId); + QListIterator it(messages); + while (it.hasNext()) { + emit sponsoredMessageReceived(chatId, it.next().toMap()); + } +} + void TDLibReceiver::processUpdateNewMessage(const QVariantMap &receivedInformation) { const QVariantMap message = receivedInformation.value(MESSAGE).toMap(); @@ -400,7 +420,7 @@ void TDLibReceiver::processMessage(const QVariantMap &receivedInformation) const qlonglong chatId = receivedInformation.value(CHAT_ID).toLongLong(); const qlonglong messageId = receivedInformation.value(ID).toLongLong(); LOG("Received message " << chatId << messageId); - emit messageInformation(chatId, messageId, receivedInformation); + emit messageInformation(chatId, messageId, cleanupMap(receivedInformation)); } void TDLibReceiver::processMessageLinkInfo(const QVariantMap &receivedInformation) @@ -718,6 +738,13 @@ void TDLibReceiver::processUpdateChatUnreadReactionCount(const QVariantMap &rece emit chatUnreadReactionCountUpdated(chatId, unreadReactionCount); } +void TDLibReceiver::processUpdateActiveEmojiReactions(const QVariantMap &receivedInformation) +{ + // updateActiveEmojiReactions was introduced between 1.8.5 and 1.8.6 + // See https://github.com/tdlib/td/commit/d29d367 + emit activeEmojiReactionsUpdated(receivedInformation.value(EMOJIS).toStringList()); +} + // Recursively removes (some) unused entries from QVariantMaps to reduce // memory usage. QStrings allocated by QVariantMaps are the top consumers // of memory. The biggest saving is achieved by removing "outline" from @@ -747,12 +774,42 @@ const QVariantMap TDLibReceiver::cleanupMap(const QVariantMap& map, bool *update return animated_emoji; } } else if (type == TYPE_MESSAGE) { - bool cleaned = false; - const QVariantMap content(cleanupMap(map.value(CONTENT).toMap(), &cleaned)); - if (cleaned) { - QVariantMap message(map); + QVariantMap message(map); + bool messageChanged = false; + const QVariantMap content(cleanupMap(map.value(CONTENT).toMap(), &messageChanged)); + if (messageChanged) { message.remove(CONTENT); message.insert(CONTENT, content); + } + if (map.contains(REPLY_TO)) { + // In TdLib 1.8.15 reply_to_message_id and reply_in_chat_id attributes + // had been replaced with reply_to structure, e.g: + // + // "reply_to": { + // "@type": "messageReplyToMessage", + // "chat_id": -1001234567890, + // "is_quote_manual": false, + // "message_id": 234567890, + // "origin_send_date": 0 + // } + // + QVariantMap reply_to(message.value(REPLY_TO).toMap()); + if (reply_to.value(_TYPE).toString() == TYPE_MESSAGE_REPLY_TO_MESSAGE) { + if (reply_to.contains(MESSAGE_ID) && + !message.contains(REPLY_TO_MESSAGE_ID)) { + message.insert(REPLY_TO_MESSAGE_ID, reply_to.value(MESSAGE_ID)); + } + if (reply_to.contains(CHAT_ID) && + !message.contains(REPLY_IN_CHAT_ID)) { + message.insert(REPLY_IN_CHAT_ID, reply_to.value(CHAT_ID)); + } + reply_to.remove(_TYPE); + reply_to.insert(_TYPE, TYPE_MESSAGE_REPLY_TO_MESSAGE); + message.insert(REPLY_TO, reply_to); + messageChanged = true; + } + } + if (messageChanged) { message.remove(_TYPE); message.insert(_TYPE, TYPE_MESSAGE); // Replace with a shared value if (updated) *updated = true; diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index b033d9d..a13ae04 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -105,6 +105,7 @@ signals: void availableReactionsReceived(qlonglong messageId, const QStringList &reactions); void chatUnreadMentionCountUpdated(qlonglong chatId, int unreadMentionCount); void chatUnreadReactionCountUpdated(qlonglong chatId, int unreadReactionCount); + void activeEmojiReactionsUpdated(const QStringList& emojis); private: typedef void (TDLibReceiver::*Handler)(const QVariantMap &); @@ -139,6 +140,7 @@ private: void processChatOnlineMemberCountUpdated(const QVariantMap &receivedInformation); void processMessages(const QVariantMap &receivedInformation); void processSponsoredMessage(const QVariantMap &receivedInformation); + void processSponsoredMessages(const QVariantMap &receivedInformation); void processUpdateNewMessage(const QVariantMap &receivedInformation); void processMessage(const QVariantMap &receivedInformation); void processMessageLinkInfo(const QVariantMap &receivedInformation); @@ -186,6 +188,7 @@ private: void processAvailableReactions(const QVariantMap &receivedInformation); void processUpdateChatUnreadMentionCount(const QVariantMap &receivedInformation); void processUpdateChatUnreadReactionCount(const QVariantMap &receivedInformation); + void processUpdateActiveEmojiReactions(const QVariantMap &receivedInformation); }; #endif // TDLIBRECEIVER_H diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 53be644..6cedc4d 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -36,6 +36,9 @@ #define DEBUG_MODULE TDLibWrapper #include "debuglog.h" +#define VERSION_NUMBER(x,y,z) \ + ((((x) & 0x3ff) << 20) | (((y) & 0x3ff) << 10) | ((z) & 0x3ff)) + namespace { const QString STATUS("status"); const QString ID("id"); @@ -51,20 +54,28 @@ namespace { const QString _TYPE("@type"); const QString _EXTRA("@extra"); const QString CHAT_LIST_MAIN("chatListMain"); + const QString CHAT_AVAILABLE_REACTIONS("available_reactions"); + const QString CHAT_AVAILABLE_REACTIONS_ALL("chatAvailableReactionsAll"); + const QString CHAT_AVAILABLE_REACTIONS_SOME("chatAvailableReactionsSome"); + const QString REACTIONS("reactions"); + const QString REACTION_TYPE("reaction_type"); + const QString REACTION_TYPE_EMOJI("reactionTypeEmoji"); + const QString EMOJI("emoji"); } -TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface, QObject *parent) +TDLibWrapper::TDLibWrapper(AppSettings *settings, MceInterface *mce, QObject *parent) : QObject(parent) + , tdLibClient(td_json_client_create()) , manager(new QNetworkAccessManager(this)) , networkConfigurationManager(new QNetworkConfigurationManager(this)) + , appSettings(settings) + , mceInterface(mce) + , authorizationState(AuthorizationState::Closed) + , versionNumber(0) , joinChatRequested(false) + , isLoggingOut(false) { LOG("Initializing TD Lib..."); - this->appSettings = appSettings; - this->mceInterface = mceInterface; - this->tdLibClient = td_json_client_create(); - this->authorizationState = AuthorizationState::Closed; - this->isLoggingOut = false; initializeTDLibReceiver(); @@ -174,6 +185,7 @@ void TDLibWrapper::initializeTDLibReceiver() { connect(this->tdLibReceiver, SIGNAL(availableReactionsReceived(qlonglong, QStringList)), this, SIGNAL(availableReactionsReceived(qlonglong, QStringList))); connect(this->tdLibReceiver, SIGNAL(chatUnreadMentionCountUpdated(qlonglong, int)), this, SIGNAL(chatUnreadMentionCountUpdated(qlonglong, int))); connect(this->tdLibReceiver, SIGNAL(chatUnreadReactionCountUpdated(qlonglong, int)), this, SIGNAL(chatUnreadReactionCountUpdated(qlonglong, int))); + connect(this->tdLibReceiver, SIGNAL(activeEmojiReactionsUpdated(QStringList)), this, SLOT(handleActiveEmojiReactionsUpdated(QStringList))); this->tdLibReceiver->start(); } @@ -192,7 +204,7 @@ void TDLibWrapper::sendRequest(const QVariantMap &requestObject) QString TDLibWrapper::getVersion() { - return this->version; + return this->versionString; } TDLibWrapper::AuthorizationState TDLibWrapper::getAuthorizationState() @@ -255,7 +267,7 @@ void TDLibWrapper::logout() { LOG("Logging out"); QVariantMap requestObject; - requestObject.insert("@type", "logOut"); + requestObject.insert(_TYPE, "logOut"); this->sendRequest(requestObject); this->isLoggingOut = true; @@ -436,7 +448,7 @@ void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message QVariantMap entityType; entityType.insert(_TYPE, "textEntityTypeMentionName"); entityType.insert("user_id", nextReplacement.value("userId").toString()); - entity.insert("type", entityType); + entity.insert(TYPE, entityType); entities.append(entity); offsetCorrection += replacementLength - replacementPlainText.length(); } @@ -586,7 +598,7 @@ void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &file QVariantMap stickerInputFile; stickerInputFile.insert(_TYPE, "inputFileRemote"); - stickerInputFile.insert("id", fileId); + stickerInputFile.insert(ID, fileId); inputMessageContent.insert("sticker", stickerInputFile); @@ -620,7 +632,7 @@ void TDLibWrapper::sendPollMessage(const QString &chatId, const QString &questio pollType.insert("allow_multiple_answers", multiple); } - inputMessageContent.insert("type", pollType); + inputMessageContent.insert(TYPE, pollType); inputMessageContent.insert("question", question); inputMessageContent.insert("options", options); inputMessageContent.insert("is_anonymous", anonymous); @@ -709,7 +721,11 @@ void TDLibWrapper::getChatSponsoredMessage(qlonglong chatId) { LOG("Retrieving sponsored message" << chatId); QVariantMap requestObject; - requestObject.insert(_TYPE, "getChatSponsoredMessage"); + // getChatSponsoredMessage has been replaced with getChatSponsoredMessages + // between 1.8.7 and 1.8.8 + // See https://github.com/tdlib/td/commit/ec1310a + requestObject.insert(_TYPE, QString((versionNumber > VERSION_NUMBER(1,8,7)) ? + "getChatSponsoredMessages" : "getChatSponsoredMessage")); requestObject.insert(CHAT_ID, chatId); requestObject.insert(_EXTRA, chatId); // see TDLibReceiver::processSponsoredMessage this->sendRequest(requestObject); @@ -1433,8 +1449,8 @@ void TDLibWrapper::getMessageAvailableReactions(qlonglong chatId, qlonglong mess QVariantMap requestObject; requestObject.insert(_TYPE, "getMessageAvailableReactions"); requestObject.insert(_EXTRA, QString::number(messageId)); - requestObject.insert("chat_id", chatId); - requestObject.insert("message_id", messageId); + requestObject.insert(CHAT_ID, chatId); + requestObject.insert(MESSAGE_ID, messageId); this->sendRequest(requestObject); } @@ -1457,11 +1473,23 @@ void TDLibWrapper::setMessageReaction(qlonglong chatId, qlonglong messageId, con { LOG("Set message reaction" << chatId << messageId << reaction); QVariantMap requestObject; - requestObject.insert(_TYPE, "setMessageReaction"); - requestObject.insert("chat_id", chatId); - requestObject.insert("message_id", messageId); - requestObject.insert("reaction", reaction); + requestObject.insert(CHAT_ID, chatId); + requestObject.insert(MESSAGE_ID, messageId); requestObject.insert("is_big", false); + 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, "addMessageReaction"); + } else { + requestObject.insert("reaction", reaction); + requestObject.insert(_TYPE, "setMessageReaction"); + } this->sendRequest(requestObject); } @@ -1494,7 +1522,7 @@ void TDLibWrapper::setNetworkType(NetworkType networkType) break; } - requestObject.insert("type", networkTypeObject); + requestObject.insert(TYPE, networkTypeObject); this->sendRequest(requestObject); } @@ -1575,6 +1603,43 @@ QVariantMap TDLibWrapper::getChat(const QString &chatId) return this->chats.value(chatId).toMap(); } +QStringList TDLibWrapper::getChatReactions(const QString &chatId) +{ + const QVariant available_reactions(chats.value(chatId).toMap().value(CHAT_AVAILABLE_REACTIONS)); + const QVariantMap map(available_reactions.toMap()); + const QString reactions_type(map.value(_TYPE).toString()); + if (reactions_type == CHAT_AVAILABLE_REACTIONS_ALL) { + return activeEmojiReactions; + } else if (reactions_type == CHAT_AVAILABLE_REACTIONS_SOME) { + const QVariantList reactions(map.value(REACTIONS).toList()); + const int n = reactions.count(); + QStringList emojis; + + // "available_reactions": { + // "@type": "chatAvailableReactionsSome", + // "reactions": [ + // { + // "@type": "reactionTypeEmoji", + // "emoji": "..." + // }, + emojis.reserve(n); + for (int i = 0; i < n; i++) { + const QVariantMap reaction(reactions.at(i).toMap()); + if (reaction.value(_TYPE).toString() == REACTION_TYPE_EMOJI) { + const QString emoji(reaction.value(EMOJI).toString()); + if (!emoji.isEmpty()) { + emojis.append(emoji); + } + } + } + return emojis; + } else if (reactions_type.isEmpty()) { + return available_reactions.toStringList(); + } else { + return QStringList(); + } +} + QVariantMap TDLibWrapper::getSecretChatFromCache(qlonglong secretChatId) { return this->secretChats.value(secretChatId); @@ -1645,7 +1710,16 @@ DBusAdaptor *TDLibWrapper::getDBusAdaptor() void TDLibWrapper::handleVersionDetected(const QString &version) { - this->version = version; + this->versionString = version; + const QStringList parts(version.split('.')); + uint major, minor, release; + bool ok; + if (parts.count() >= 3 && + (major = parts.at(0).toInt(&ok), ok) && + (minor = parts.at(1).toInt(&ok), ok) && + (release = parts.at(2).toInt(&ok), ok)) { + versionNumber = VERSION_NUMBER(major, minor, release); + } emit versionDetected(version); } @@ -1758,7 +1832,7 @@ void TDLibWrapper::handleConnectionStateChanged(const QString &connectionState) void TDLibWrapper::handleUserUpdated(const QVariantMap &userInformation) { - QString updatedUserId = userInformation.value("id").toString(); + QString updatedUserId = userInformation.value(ID).toString(); if (updatedUserId == this->options.value("my_id").toString()) { LOG("Own user information updated :)"); this->userInformation = userInformation; @@ -1774,11 +1848,11 @@ void TDLibWrapper::handleUserStatusUpdated(const QString &userId, const QVariant { if (userId == this->options.value("my_id").toString()) { LOG("Own user status information updated :)"); - this->userInformation.insert("status", userStatusInformation); + this->userInformation.insert(STATUS, userStatusInformation); } LOG("User status information updated:" << userId << userStatusInformation.value(_TYPE).toString()); QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap(); - updatedUserInformation.insert("status", userStatusInformation); + updatedUserInformation.insert(STATUS, userStatusInformation); this->allUsers.insert(userId, updatedUserInformation); this->allUserNames.insert(userInformation.value(USERNAME).toString(), userInformation); emit userUpdated(userId, updatedUserInformation); @@ -1786,12 +1860,12 @@ void TDLibWrapper::handleUserStatusUpdated(const QString &userId, const QVariant void TDLibWrapper::handleFileUpdated(const QVariantMap &fileInformation) { - emit fileUpdated(fileInformation.value("id").toInt(), fileInformation); + emit fileUpdated(fileInformation.value(ID).toInt(), fileInformation); } void TDLibWrapper::handleNewChatDiscovered(const QVariantMap &chatInformation) { - QString chatId = chatInformation.value("id").toString(); + QString chatId = chatInformation.value(ID).toString(); this->chats.insert(chatId, chatInformation); emit newChatDiscovered(chatId, chatInformation); } @@ -1856,7 +1930,7 @@ void TDLibWrapper::handleStickerSets(const QVariantList &stickerSets) QListIterator stickerSetIterator(stickerSets); while (stickerSetIterator.hasNext()) { QVariantMap stickerSet = stickerSetIterator.next().toMap(); - this->getStickerSet(stickerSet.value("id").toString()); + this->getStickerSet(stickerSet.value(ID).toString()); } emit this->stickerSetsReceived(stickerSets); } @@ -1988,6 +2062,13 @@ void TDLibWrapper::handleSponsoredMessage(qlonglong chatId, const QVariantMap &m } } +void TDLibWrapper::handleActiveEmojiReactionsUpdated(const QStringList& emojis) +{ + if (activeEmojiReactions != emojis) { + activeEmojiReactions = emojis; + LOG(emojis.count() << "reaction(s) available"); + } +} void TDLibWrapper::handleNetworkConfigurationChanged(const QNetworkConfiguration &config) { @@ -2077,28 +2158,40 @@ void TDLibWrapper::handleGetPageSourceFinished() } } +QVariantMap& TDLibWrapper::fillTdlibParameters(QVariantMap& parameters) +{ + parameters.insert("api_id", TDLIB_API_ID); + parameters.insert("api_hash", TDLIB_API_HASH); + parameters.insert("database_directory", QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/tdlib"); + bool onlineOnlyMode = this->appSettings->onlineOnlyMode(); + parameters.insert("use_file_database", !onlineOnlyMode); + parameters.insert("use_chat_info_database", !onlineOnlyMode); + parameters.insert("use_message_database", !onlineOnlyMode); + parameters.insert("use_secret_chats", true); + parameters.insert("system_language_code", QLocale::system().name()); + QSettings hardwareSettings("/etc/hw-release", QSettings::NativeFormat); + parameters.insert("device_model", hardwareSettings.value("NAME", "Unknown Mobile Device").toString()); + parameters.insert("system_version", QSysInfo::prettyProductName()); + parameters.insert("application_version", "0.17"); + parameters.insert("enable_storage_optimizer", appSettings->storageOptimizer()); + // parameters.insert("use_test_dc", true); + return parameters; +} + void TDLibWrapper::setInitialParameters() { LOG("Sending initial parameters to TD Lib"); QVariantMap requestObject; requestObject.insert(_TYPE, "setTdlibParameters"); - QVariantMap initialParameters; - initialParameters.insert("api_id", TDLIB_API_ID); - initialParameters.insert("api_hash", TDLIB_API_HASH); - initialParameters.insert("database_directory", QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/tdlib"); - bool onlineOnlyMode = this->appSettings->onlineOnlyMode(); - initialParameters.insert("use_file_database", !onlineOnlyMode); - initialParameters.insert("use_chat_info_database", !onlineOnlyMode); - initialParameters.insert("use_message_database", !onlineOnlyMode); - initialParameters.insert("use_secret_chats", true); - initialParameters.insert("system_language_code", QLocale::system().name()); - QSettings hardwareSettings("/etc/hw-release", QSettings::NativeFormat); - initialParameters.insert("device_model", hardwareSettings.value("NAME", "Unknown Mobile Device").toString()); - initialParameters.insert("system_version", QSysInfo::prettyProductName()); - initialParameters.insert("application_version", "0.17"); - initialParameters.insert("enable_storage_optimizer", appSettings->storageOptimizer()); - // initialParameters.insert("use_test_dc", true); - requestObject.insert("parameters", initialParameters); + // tdlibParameters were inlined between 1.8.5 and 1.8.6 + // See https://github.com/tdlib/td/commit/f6a2ecd + if (versionNumber > VERSION_NUMBER(1,8,5)) { + fillTdlibParameters(requestObject); + } else { + QVariantMap initialParameters; + fillTdlibParameters(initialParameters); + requestObject.insert("parameters", initialParameters); + } this->sendRequest(requestObject); } diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 1d1ec6d..4caff11 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -148,6 +148,7 @@ public: Q_INVOKABLE QVariantMap getSuperGroup(qlonglong groupId) const; Q_INVOKABLE QVariantMap getChat(const QString &chatId); Q_INVOKABLE QVariantMap getSecretChatFromCache(qlonglong secretChatId); + Q_INVOKABLE QStringList getChatReactions(const QString &chatId); Q_INVOKABLE QString getOptionString(const QString &optionName); Q_INVOKABLE void copyFileToDownloads(const QString &filePath, bool openAfterCopy = false); Q_INVOKABLE void openFileOnDevice(const QString &filePath); @@ -364,7 +365,7 @@ public slots: void handleUpdatedUserPrivacySettingRules(const QVariantMap &updatedRules); void handleSponsoredMessage(qlonglong chatId, const QVariantMap &message); void handleNetworkConfigurationChanged(const QNetworkConfiguration &config); - + void handleActiveEmojiReactionsUpdated(const QStringList& emojis); void handleGetPageSourceFinished(); private: @@ -372,6 +373,7 @@ private: void setInitialParameters(); void setEncryptionKey(); void setLogVerbosityLevel(); + QVariantMap &fillTdlibParameters(QVariantMap ¶meters); const Group *updateGroup(qlonglong groupId, const QVariantMap &groupInfo, QHash *groups); void initializeTDLibReceiver(); @@ -383,7 +385,7 @@ private: MceInterface *mceInterface; TDLibReceiver *tdLibReceiver; DBusInterface *dbusInterface; - QString version; + QString versionString; TDLibWrapper::AuthorizationState authorizationState; QVariantMap authorizationStateData; TDLibWrapper::ConnectionState connectionState; @@ -399,7 +401,9 @@ private: QHash basicGroups; QHash superGroups; EmojiSearchWorker emojiSearchWorker; + QStringList activeEmojiReactions; + int versionNumber; QString activeChatSearchName; bool joinChatRequested; bool isLoggingOut; From 2b5140574352f841b873c1110a13578f2a2cfc05 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 18 Nov 2023 15:35:02 +0100 Subject: [PATCH 02/52] Only expect chat partner information in private chats --- qml/pages/ChatPage.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index c4bb440..8363c35 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -563,12 +563,12 @@ Page { } } onUserFullInfoReceived: { - if(userFullInfo["@extra"] === chatPartnerInformation.id.toString()) { + if ((isPrivateChat || isSecretChat) && userFullInfo["@extra"] === chatPartnerInformation.id.toString()) { chatPage.botInformation = userFullInfo; } } onUserFullInfoUpdated: { - if(userId === chatPartnerInformation.id) { + if ((isPrivateChat || isSecretChat) && userId === chatPartnerInformation.id) { chatPage.botInformation = userFullInfo; } } From 527b2c3c9a5534d1f75b6d707c47384b83bbbe00 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 18 Nov 2023 23:14:59 +0200 Subject: [PATCH 03/52] Adapt to changes in reply message info (#525) 1.8.14: https://github.com/tdlib/td/commit/fa94aba 1.8.21: https://github.com/tdlib/td/commit/811a7c6 https://github.com/tdlib/td/commit/5216ea1 --- qml/pages/ChatPage.qml | 3 +- src/tdlibreceiver.cpp | 25 ++++++++- src/tdlibwrapper.cpp | 116 ++++++++++++++++++++--------------------- src/tdlibwrapper.h | 17 +++--- 4 files changed, 92 insertions(+), 69 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 8363c35..e126281 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -440,7 +440,8 @@ Page { Component.onDestruction: { if (chatPage.canSendMessages && !chatPage.isDeletedUser) { - tdLibWrapper.setChatDraftMessage(chatInformation.id, 0, newMessageColumn.replyToMessageId, newMessageTextField.text); + tdLibWrapper.setChatDraftMessage(chatInformation.id, 0, newMessageColumn.replyToMessageId, newMessageTextField.text, + newMessageInReplyToRow.inReplyToMessage ? newMessageInReplyToRow.inReplyToMessage.id : 0); } fernschreiberUtils.stopGeoLocationUpdates(); tdLibWrapper.closeChat(chatInformation.id); diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index ba035e9..11a46dc 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -64,6 +64,7 @@ namespace { const QString REPLY_TO("reply_to"); const QString REPLY_IN_CHAT_ID("reply_in_chat_id"); const QString REPLY_TO_MESSAGE_ID("reply_to_message_id"); + const QString DRAFT_MESSAGE("draft_message"); const QString _TYPE("@type"); const QString _EXTRA("@extra"); @@ -77,6 +78,8 @@ namespace { const QString TYPE_MESSAGE_REPLY_TO_MESSAGE("messageReplyToMessage"); const QString TYPE_MESSAGE_ANIMATED_EMOJI("messageAnimatedEmoji"); const QString TYPE_ANIMATED_EMOJI("animatedEmoji"); + const QString TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE("inputMessageReplyToMessage"); + const QString TYPE_DRAFT_MESSAGE("draftMessage"); } static QString getChatPositionOrder(const QVariantMap &position) @@ -445,7 +448,7 @@ void TDLibReceiver::processMessageSendSucceeded(const QVariantMap &receivedInfor const QVariantMap message = receivedInformation.value(MESSAGE).toMap(); const qlonglong messageId = message.value(ID).toLongLong(); LOG("Message send succeeded" << messageId << oldMessageId); - emit messageSendSucceeded(messageId, oldMessageId, message); + emit messageSendSucceeded(messageId, oldMessageId, cleanupMap(message)); } void TDLibReceiver::processUpdateActiveNotifications(const QVariantMap &receivedInformation) @@ -672,7 +675,7 @@ void TDLibReceiver::processUpdateChatIsMarkedAsUnread(const QVariantMap &receive void TDLibReceiver::processUpdateChatDraftMessage(const QVariantMap &receivedInformation) { LOG("Draft message was updated"); - emit chatDraftMessageUpdated(receivedInformation.value(CHAT_ID).toLongLong(), receivedInformation.value("draft_message").toMap(), findChatPositionOrder(receivedInformation.value(POSITIONS).toList())); + emit chatDraftMessageUpdated(receivedInformation.value(CHAT_ID).toLongLong(), cleanupMap(receivedInformation.value(DRAFT_MESSAGE).toMap()), findChatPositionOrder(receivedInformation.value(POSITIONS).toList())); } void TDLibReceiver::processInlineQueryResults(const QVariantMap &receivedInformation) @@ -815,6 +818,24 @@ const QVariantMap TDLibReceiver::cleanupMap(const QVariantMap& map, bool *update if (updated) *updated = true; return message; } + } else if (type == TYPE_DRAFT_MESSAGE) { + QVariantMap draftMessage(map); + QVariantMap reply_to(draftMessage.value(REPLY_TO).toMap()); + // In TdLib 1.8.21 reply_to_message_id has been replaced with reply_to + if (reply_to.value(_TYPE).toString() == TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE) { + if (reply_to.contains(MESSAGE_ID) && + !draftMessage.contains(REPLY_TO_MESSAGE_ID)) { + // reply_to_message_id is what QML (still) expects + draftMessage.insert(REPLY_TO_MESSAGE_ID, reply_to.value(MESSAGE_ID)); + } + reply_to.remove(_TYPE); + reply_to.insert(_TYPE, TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE); // Shared value + draftMessage.insert(REPLY_TO, reply_to); + draftMessage.remove(_TYPE); + draftMessage.insert(_TYPE, DRAFT_MESSAGE); // Shared value + if (updated) *updated = true; + return draftMessage; + } } else if (type == TYPE_MESSAGE_STICKER) { bool cleaned = false; const QVariantMap content(cleanupMap(map.value(CONTENT).toMap(), &cleaned)); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 6cedc4d..509e7cc 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -51,6 +51,8 @@ namespace { const QString THREAD_ID("thread_id"); const QString VALUE("value"); const QString CHAT_LIST_TYPE("chat_list_type"); + const QString REPLY_TO_MESSAGE_ID("reply_to_message_id"); + const QString REPLY_TO("reply_to"); const QString _TYPE("@type"); const QString _EXTRA("@extra"); const QString CHAT_LIST_MAIN("chatListMain"); @@ -61,6 +63,8 @@ namespace { const QString REACTION_TYPE("reaction_type"); const QString REACTION_TYPE_EMOJI("reactionTypeEmoji"); const QString EMOJI("emoji"); + const QString TYPE_MESSAGE_REPLY_TO_MESSAGE("messageReplyToMessage"); + const QString TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE("inputMessageReplyToMessage"); } TDLibWrapper::TDLibWrapper(AppSettings *settings, MceInterface *mce, QObject *parent) @@ -401,15 +405,33 @@ static bool compareReplacements(const QVariant &replacement1, const QVariant &re } } -void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId) +QVariantMap TDLibWrapper::newSendMessageRequest(qlonglong chatId, qlonglong replyToMessageId) +{ + QVariantMap request; + request.insert(_TYPE, "sendMessage"); + request.insert(CHAT_ID, chatId); + if (replyToMessageId) { + if (versionNumber > VERSION_NUMBER(1,8,14)) { + QVariantMap replyTo; + if (versionNumber > VERSION_NUMBER(1,8,20)) { + replyTo.insert(_TYPE, TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE); + } else { + replyTo.insert(_TYPE, TYPE_MESSAGE_REPLY_TO_MESSAGE); + } + replyTo.insert(CHAT_ID, chatId); + replyTo.insert(MESSAGE_ID, replyToMessageId); + request.insert(REPLY_TO, replyTo); + } else { + request.insert(REPLY_TO_MESSAGE_ID, replyToMessageId); + } + } + return request; +} + +void TDLibWrapper::sendTextMessage(qlonglong chatId, const QString &message, qlonglong replyToMessageId) { LOG("Sending text message" << chatId << message << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessageText"); @@ -462,17 +484,13 @@ void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message this->sendRequest(requestObject); } -void TDLibWrapper::sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId) +void TDLibWrapper::sendPhotoMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId) { LOG("Sending photo message" << chatId << filePath << message << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessagePhoto"); + QVariantMap formattedText; formattedText.insert("text", message); formattedText.insert(_TYPE, "formattedText"); @@ -486,17 +504,13 @@ void TDLibWrapper::sendPhotoMessage(const QString &chatId, const QString &filePa this->sendRequest(requestObject); } -void TDLibWrapper::sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId) +void TDLibWrapper::sendVideoMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId) { LOG("Sending video message" << chatId << filePath << message << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessageVideo"); + QVariantMap formattedText; formattedText.insert("text", message); formattedText.insert(_TYPE, "formattedText"); @@ -510,17 +524,13 @@ void TDLibWrapper::sendVideoMessage(const QString &chatId, const QString &filePa this->sendRequest(requestObject); } -void TDLibWrapper::sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId) +void TDLibWrapper::sendDocumentMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId) { LOG("Sending document message" << chatId << filePath << message << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessageDocument"); + QVariantMap formattedText; formattedText.insert("text", message); formattedText.insert(_TYPE, "formattedText"); @@ -534,17 +544,13 @@ void TDLibWrapper::sendDocumentMessage(const QString &chatId, const QString &fil this->sendRequest(requestObject); } -void TDLibWrapper::sendVoiceNoteMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId) +void TDLibWrapper::sendVoiceNoteMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId) { LOG("Sending voice note message" << chatId << filePath << message << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessageVoiceNote"); + QVariantMap formattedText; formattedText.insert("text", message); formattedText.insert(_TYPE, "formattedText"); @@ -558,24 +564,19 @@ void TDLibWrapper::sendVoiceNoteMessage(const QString &chatId, const QString &fi this->sendRequest(requestObject); } -void TDLibWrapper::sendLocationMessage(const QString &chatId, double latitude, double longitude, double horizontalAccuracy, const QString &replyToMessageId) +void TDLibWrapper::sendLocationMessage(qlonglong chatId, double latitude, double longitude, double horizontalAccuracy, qlonglong replyToMessageId) { LOG("Sending location message" << chatId << latitude << longitude << horizontalAccuracy << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessageLocation"); + QVariantMap location; location.insert("latitude", latitude); location.insert("longitude", longitude); location.insert("horizontal_accuracy", horizontalAccuracy); location.insert(_TYPE, "location"); inputMessageContent.insert("location", location); - inputMessageContent.insert("live_period", 0); inputMessageContent.insert("heading", 0); inputMessageContent.insert("proximity_alert_radius", 0); @@ -584,15 +585,10 @@ void TDLibWrapper::sendLocationMessage(const QString &chatId, double latitude, d this->sendRequest(requestObject); } -void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId) +void TDLibWrapper::sendStickerMessage(qlonglong chatId, const QString &fileId, qlonglong replyToMessageId) { LOG("Sending sticker message" << chatId << fileId << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessageSticker"); @@ -606,15 +602,10 @@ void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &file this->sendRequest(requestObject); } -void TDLibWrapper::sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &explanation, const QString &replyToMessageId) +void TDLibWrapper::sendPollMessage(qlonglong chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &explanation, qlonglong replyToMessageId) { LOG("Sending poll message" << chatId << question << replyToMessageId); - QVariantMap requestObject; - requestObject.insert(_TYPE, "sendMessage"); - requestObject.insert(CHAT_ID, chatId); - if (replyToMessageId != "0") { - requestObject.insert("reply_to_message_id", replyToMessageId); - } + QVariantMap requestObject(newSendMessageRequest(chatId, replyToMessageId)); QVariantMap inputMessageContent; inputMessageContent.insert(_TYPE, "inputMessagePoll"); @@ -1187,9 +1178,18 @@ void TDLibWrapper::setChatDraftMessage(qlonglong chatId, qlonglong threadId, qlo inputMessageContent.insert(_TYPE, "inputMessageText"); inputMessageContent.insert("text", formattedText); draftMessage.insert(_TYPE, "draftMessage"); - draftMessage.insert("reply_to_message_id", replyToMessageId); draftMessage.insert("input_message_text", inputMessageContent); + if (versionNumber > VERSION_NUMBER(1,8,20)) { + QVariantMap replyTo; + replyTo.insert(_TYPE, TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE); + replyTo.insert(CHAT_ID, chatId); + replyTo.insert(MESSAGE_ID, replyToMessageId); + draftMessage.insert(REPLY_TO, replyTo); + } else { + draftMessage.insert(REPLY_TO_MESSAGE_ID, replyToMessageId); + } + requestObject.insert("draft_message", draftMessage); this->sendRequest(requestObject); } diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 4caff11..33e29b4 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -176,14 +176,14 @@ public: Q_INVOKABLE void viewMessage(qlonglong chatId, qlonglong messageId, bool force); Q_INVOKABLE void pinMessage(const QString &chatId, const QString &messageId, bool disableNotification = false); Q_INVOKABLE void unpinMessage(const QString &chatId, const QString &messageId); - Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0"); - Q_INVOKABLE void sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); - Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); - Q_INVOKABLE void sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); - Q_INVOKABLE void sendVoiceNoteMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); - Q_INVOKABLE void sendLocationMessage(const QString &chatId, double latitude, double longitude, double horizontalAccuracy, const QString &replyToMessageId = "0"); - Q_INVOKABLE void sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId = "0"); - Q_INVOKABLE void sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &explanation, const QString &replyToMessageId = "0"); + Q_INVOKABLE void sendTextMessage(qlonglong chatId, const QString &message, qlonglong replyToMessageId = 0); + Q_INVOKABLE void sendPhotoMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId = 0); + Q_INVOKABLE void sendVideoMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId = 0); + Q_INVOKABLE void sendDocumentMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId = 0); + Q_INVOKABLE void sendVoiceNoteMessage(qlonglong chatId, const QString &filePath, const QString &message, qlonglong replyToMessageId = 0); + Q_INVOKABLE void sendLocationMessage(qlonglong chatId, double latitude, double longitude, double horizontalAccuracy, qlonglong replyToMessageId = 0); + Q_INVOKABLE void sendStickerMessage(qlonglong chatId, const QString &fileId, qlonglong replyToMessageId = 0); + Q_INVOKABLE void sendPollMessage(qlonglong chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &explanation, qlonglong replyToMessageId = 0); Q_INVOKABLE void forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, bool sendCopy, bool removeCaption); Q_INVOKABLE void getMessage(qlonglong chatId, qlonglong messageId); Q_INVOKABLE void getMessageLinkInfo(const QString &url, const QString &extra = ""); @@ -375,6 +375,7 @@ private: void setLogVerbosityLevel(); QVariantMap &fillTdlibParameters(QVariantMap ¶meters); const Group *updateGroup(qlonglong groupId, const QVariantMap &groupInfo, QHash *groups); + QVariantMap newSendMessageRequest(qlonglong chatId, qlonglong replyToMessageId); void initializeTDLibReceiver(); private: From de7b119941b4e27a22db60767381c6558ece79ad Mon Sep 17 00:00:00 2001 From: Peter G Date: Sat, 18 Nov 2023 21:18:47 +0000 Subject: [PATCH 04/52] Move macros to yaml (#523) Co-authored-by: nephros --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index c482b80..b5eb5c1 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -6,9 +6,9 @@ Name: harbour-fernschreiber # >> macros +# << macros %define __provides_exclude_from ^%{_datadir}/.*$ %define __requires_exclude ^libtdjson.*$ -# << macros Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 9a4782a..c5e2948 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -30,6 +30,11 @@ PkgConfigBR: - nemonotifications-qt5 - openssl +# NB: spectacle has a bug where it will remove custom "#<< macros" lines, so define them here: +Macros: + - '__provides_exclude_from;^%{_datadir}/.*$' + - '__requires_exclude;^libtdjson.*$' + # Build dependencies without a pkgconfig setup can be listed here PkgBR: - gperf From 6b0e54ec65850d2ec97e2ce662112d1354e8af9a Mon Sep 17 00:00:00 2001 From: okruhliak <47862310+okruhliak@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:19:35 +0100 Subject: [PATCH 05/52] Update harbour-fernschreiber-sk.ts (#520) * Update harbour-fernschreiber-sk.ts * Update harbour-fernschreiber-sk.ts --- translations/harbour-fernschreiber-sk.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index ba07b3e..a7930ac 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -1583,7 +1583,7 @@ Use non-graphical feedback (sound, vibration) for notifications - Pre upozornenia použiť negrafickú reakciu (zvuk, vibrovanie) + Pre oznamy použiť negrafickú reakciu (zvuk, vibrovanie) All events @@ -1603,11 +1603,11 @@ Enable notification sounds - Povoliť zvukové upozornenia + Povoliť zvukové oznamy When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. - Keď sú povolené zvukové upozornenia, Fernschreiber použije aktuálne zvukové upozornenia Sailfish OS pre čety, ktoré môžu byť upravené v nastaveniach systému. + Keď sú povolené zvukové oznamy, Fernschreiber použije aktuálne zvukové oznamy Sailfish OS pre čety, ktoré môžu byť upravené v nastaveniach systému. From 1ffcfb48cacd576b1f8113f4962edcffb8beb6e7 Mon Sep 17 00:00:00 2001 From: jgibbon <99138+jgibbon@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:24:27 +0100 Subject: [PATCH 06/52] Add specific unread info for higher counts of unread messages (#516) --- qml/components/PhotoTextsListItem.qml | 3 ++- qml/js/functions.js | 8 ++++++++ qml/pages/ChatPage.qml | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 62f431a..dadb1bd 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -1,6 +1,7 @@ import QtQuick 2.6 import Sailfish.Silica 1.0 import WerkWolf.Fernschreiber 1.0 +import "../js/functions.js" as Functions ListItem { id: chatListViewItem @@ -103,7 +104,7 @@ ListItem { anchors.centerIn: chatUnreadMessagesCountBackground visible: chatListViewItem.unreadCount > 0 opacity: isMuted ? Theme.opacityHigh : 1.0 - text: chatListViewItem.unreadCount > 99 ? "99+" : chatListViewItem.unreadCount + text: Functions.formatUnreadCount(chatListViewItem.unreadCount) } Rectangle { diff --git a/qml/js/functions.js b/qml/js/functions.js index dd6093d..7299b0d 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -27,6 +27,14 @@ function setGlobals(globals) { tdLibWrapper = globals.tdLibWrapper; appNotification = globals.appNotification; } +function formatUnreadCount(value) { + if(value < 1000) { + return value; + } else if(value > 9000) { + return '9k+'; + } + return ''+Math.floor(value / 1000)+'k'+((value % 1000)>0 ? '+' : ''); +} function getUserName(userInformation) { return ((userInformation.first_name || "") + " " + (userInformation.last_name || "")).trim(); diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index e126281..b816fe3 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -620,8 +620,8 @@ Page { onUnreadCountUpdated: { Debug.log("[ChatPage] Unread count updated, new count: ", unreadCount); chatInformation.unread_count = unreadCount; - chatUnreadMessagesItem.visible = ( !chatPage.loading && chatInformation.unread_count > 0 && chatOverviewItem.visible ); - chatUnreadMessagesCount.text = unreadCount > 99 ? "99+" : unreadCount; + chatUnreadMessagesItem.visible = ( !chatPage.loading && unreadCount > 0 && chatOverviewItem.visible ); + chatUnreadMessagesCount.text = Functions.formatUnreadCount(unreadCount) } onLastReadSentMessageUpdated: { Debug.log("[ChatPage] Updating last read sent index, new index: ", lastReadSentIndex); @@ -1430,7 +1430,7 @@ Page { color: Theme.primaryColor anchors.centerIn: chatUnreadMessagesCountBackground visible: chatUnreadMessagesItem.visible - text: chatInformation.unread_count > 99 ? "99+" : chatInformation.unread_count + text: Functions.formatUnreadCount(chatInformation.unread_count) } MouseArea { anchors.fill: parent From 3ab0b948311109003de65ab84c58324968754caf Mon Sep 17 00:00:00 2001 From: Peter G Date: Sat, 18 Nov 2023 21:40:12 +0000 Subject: [PATCH 07/52] Highlight unread Converstations (#513) * Highlight unread conversations See: #512 * make highlighting configurable * more verbose variable names * remove the rectangle gain, it is too annoying * respect the setting --------- Co-authored-by: nephros --- qml/components/PhotoTextsListItem.qml | 3 +++ qml/components/settingsPage/SettingsBehavior.qml | 12 ++++++++++++ src/appsettings.cpp | 15 +++++++++++++++ src/appsettings.h | 5 +++++ 4 files changed, 35 insertions(+) diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index dadb1bd..959fdd5 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -151,6 +151,9 @@ ListItem { truncationMode: TruncationMode.Fade anchors.verticalCenter: parent.verticalCenter width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0) - (mutedImage.visible ? (mutedImage.width + primaryTextRow.spacing) : 0), implicitWidth) + font.bold: appSettings.highlightUnreadConversations && ( !chatListViewItem.isMuted && (chatListViewItem.unreadCount > 0 || chatListViewItem.isMarkedAsUnread) ) + font.italic: appSettings.highlightUnreadConversations && (chatListViewItem.unreadReactionCount > 0) + color: (appSettings.highlightUnreadConversations && (chatListViewItem.unreadCount > 0)) ? Theme.highlightColor : Theme.primaryColor } Image { diff --git a/qml/components/settingsPage/SettingsBehavior.qml b/qml/components/settingsPage/SettingsBehavior.qml index f0b2ea2..8ec3aec 100644 --- a/qml/components/settingsPage/SettingsBehavior.qml +++ b/qml/components/settingsPage/SettingsBehavior.qml @@ -70,6 +70,18 @@ AccordionItem { } } + TextSwitch { + width: parent.columnWidth + checked: appSettings.highlightUnreadConversations + text: qsTr("Highlight unread messages") + description: qsTr("Highlight Conversations with unread messages") + automaticCheck: false + onClicked: { + appSettings.highlightUnreadConversations = !checked + } + } + + TextSwitch { width: parent.columnWidth checked: appSettings.useOpenWith diff --git a/src/appsettings.cpp b/src/appsettings.cpp index c5af969..d749f93 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -37,6 +37,7 @@ namespace { const QString KEY_DELAY_MESSAGE_READ("delayMessageRead"); const QString KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN("focusTextAreaOnChatOpen"); const QString KEY_SPONSORED_MESS("sponsoredMess"); + const QString KEY_HIGHLIGHT_UNREADCONVS("highlightUnreadConversations"); } AppSettings::AppSettings(QObject *parent) : QObject(parent), settings(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/de.ygriega/fernschreiber/settings.conf", QSettings::NativeFormat) @@ -240,6 +241,20 @@ void AppSettings::setDelayMessageRead(bool enable) } } +bool AppSettings::highlightUnreadConversations() const +{ + return settings.value(KEY_HIGHLIGHT_UNREADCONVS, true).toBool(); +} + +void AppSettings::setHighlightUnreadConversations(bool enable) +{ + if (highlightUnreadConversations() != enable) { + LOG(KEY_HIGHLIGHT_UNREADCONVS << enable); + settings.setValue(KEY_HIGHLIGHT_UNREADCONVS, enable); + emit highlightUnreadConversationsChanged(); + } +} + bool AppSettings::getFocusTextAreaOnChatOpen() const { return settings.value(KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN, false).toBool(); diff --git a/src/appsettings.h b/src/appsettings.h index fbd5709..8071b44 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -40,6 +40,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged) Q_PROPERTY(bool focusTextAreaOnChatOpen READ getFocusTextAreaOnChatOpen WRITE setFocusTextAreaOnChatOpen NOTIFY focusTextAreaOnChatOpenChanged) Q_PROPERTY(SponsoredMess sponsoredMess READ getSponsoredMess WRITE setSponsoredMess NOTIFY sponsoredMessChanged) + Q_PROPERTY(bool highlightUnreadConversations READ highlightUnreadConversations WRITE setHighlightUnreadConversations NOTIFY highlightUnreadConversationsChanged) public: enum SponsoredMess { @@ -107,6 +108,9 @@ public: SponsoredMess getSponsoredMess() const; void setSponsoredMess(SponsoredMess sponsoredMess); + bool highlightUnreadConversations() const; + void setHighlightUnreadConversations(bool enable); + signals: void sendByEnterChanged(); void focusTextAreaAfterSendChanged(); @@ -124,6 +128,7 @@ signals: void delayMessageReadChanged(); void focusTextAreaOnChatOpenChanged(); void sponsoredMessChanged(); + void highlightUnreadConversationsChanged(); private: QSettings settings; From e44c69281cf8cbdb7cb85f418b71963a1640cfe9 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 18 Nov 2023 22:44:49 +0100 Subject: [PATCH 08/52] Don't enable highlight conversations by default --- src/appsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/appsettings.cpp b/src/appsettings.cpp index d749f93..bee5b00 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -243,7 +243,7 @@ void AppSettings::setDelayMessageRead(bool enable) bool AppSettings::highlightUnreadConversations() const { - return settings.value(KEY_HIGHLIGHT_UNREADCONVS, true).toBool(); + return settings.value(KEY_HIGHLIGHT_UNREADCONVS, false).toBool(); } void AppSettings::setHighlightUnreadConversations(bool enable) From 3620b8ed03db2c11ff6434042f0023b9610467bb Mon Sep 17 00:00:00 2001 From: Peter G Date: Sat, 18 Nov 2023 21:58:05 +0000 Subject: [PATCH 09/52] Add option to suppress notification previews (#521) * Add Switch in Settings * Don't set notification preview body * Support the setting in appSettings * fixup! Add Switch in Settings * Just show message count * Also show only when notifications are enabled at all --------- Co-authored-by: nephros --- qml/components/settingsPage/SettingsBehavior.qml | 14 ++++++++++++++ src/appsettings.cpp | 15 +++++++++++++++ src/appsettings.h | 5 +++++ src/notificationmanager.cpp | 6 +++++- 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/qml/components/settingsPage/SettingsBehavior.qml b/qml/components/settingsPage/SettingsBehavior.qml index 8ec3aec..17746f7 100644 --- a/qml/components/settingsPage/SettingsBehavior.qml +++ b/qml/components/settingsPage/SettingsBehavior.qml @@ -147,6 +147,20 @@ AccordionItem { } } + TextSwitch { + width: parent.columnWidth + checked: appSettings.notificationSuppressContent && enabled + text: qsTr("Hide content in Notifications") + enabled: appSettings.notificationFeedback !== AppSettings.NotificationFeedbackNone + clip: height < implicitHeight + visible: height > 0 + automaticCheck: false + onClicked: { + appSettings.notificationSuppressContent = !checked + } + Behavior on height { SmoothedAnimation { duration: 200 } } + } + TextSwitch { width: parent.columnWidth checked: appSettings.notificationTurnsDisplayOn && enabled diff --git a/src/appsettings.cpp b/src/appsettings.cpp index bee5b00..776c6ae 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -29,6 +29,7 @@ namespace { const QString KEY_ANIMATE_STICKERS("animateStickers"); const QString KEY_NOTIFICATION_TURNS_DISPLAY_ON("notificationTurnsDisplayOn"); const QString KEY_NOTIFICATION_SOUNDS_ENABLED("notificationSoundsEnabled"); + const QString KEY_NOTIFICATION_SUPPRESS_ENABLED("notificationSuppressContent"); const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback"); const QString KEY_STORAGE_OPTIMIZER("useStorageOptimizer"); const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess"); @@ -156,6 +157,20 @@ void AppSettings::setNotificationSoundsEnabled(bool enable) } } +bool AppSettings::notificationSuppressContent() const +{ + return settings.value(KEY_NOTIFICATION_SUPPRESS_ENABLED, false).toBool(); +} + +void AppSettings::setNotificationSuppressContent(bool enable) +{ + if (notificationSuppressContent() != enable) { + LOG(KEY_NOTIFICATION_SUPPRESS_ENABLED << enable); + settings.setValue(KEY_NOTIFICATION_SUPPRESS_ENABLED, enable); + emit notificationSuppressContentChanged(); + } +} + AppSettings::NotificationFeedback AppSettings::notificationFeedback() const { return (NotificationFeedback) settings.value(KEY_NOTIFICATION_FEEDBACK, (int) NotificationFeedbackAll).toInt(); diff --git a/src/appsettings.h b/src/appsettings.h index 8071b44..7ddc7ca 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -32,6 +32,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool animateStickers READ animateStickers WRITE setAnimateStickers NOTIFY animateStickersChanged) Q_PROPERTY(bool notificationTurnsDisplayOn READ notificationTurnsDisplayOn WRITE setNotificationTurnsDisplayOn NOTIFY notificationTurnsDisplayOnChanged) Q_PROPERTY(bool notificationSoundsEnabled READ notificationSoundsEnabled WRITE setNotificationSoundsEnabled NOTIFY notificationSoundsEnabledChanged) + Q_PROPERTY(bool notificationSuppressContent READ notificationSuppressContent WRITE setNotificationSuppressContent NOTIFY notificationSuppressContentChanged) Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged) Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) Q_PROPERTY(bool allowInlineBotLocationAccess READ allowInlineBotLocationAccess WRITE setAllowInlineBotLocationAccess NOTIFY allowInlineBotLocationAccessChanged) @@ -84,6 +85,9 @@ public: bool notificationSoundsEnabled() const; void setNotificationSoundsEnabled(bool enable); + bool notificationSuppressContent() const; + void setNotificationSuppressContent(bool enable); + NotificationFeedback notificationFeedback() const; void setNotificationFeedback(NotificationFeedback feedback); @@ -120,6 +124,7 @@ signals: void animateStickersChanged(); void notificationTurnsDisplayOnChanged(); void notificationSoundsEnabledChanged(); + void notificationSuppressContentChanged(); void notificationFeedbackChanged(); void storageOptimizerChanged(); void allowInlineBotLocationAccessChanged(); diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index f45f743..2bd4bd8 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -377,7 +377,11 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat nemoNotification->setHintValue(HINT_VISIBILITY, QString()); nemoNotification->setUrgency(Notification::Low); } else { - nemoNotification->setPreviewBody(notificationBody); + if (!appSettings->notificationSuppressContent()) { + nemoNotification->setPreviewBody(notificationBody); + } else { + nemoNotification->setPreviewBody(tr("%Ln unread messages", "", notificationGroup->totalCount)); + } nemoNotification->setPreviewSummary(summary); nemoNotification->setHintValue(HINT_SUPPRESS_SOUND, !appSettings->notificationSoundsEnabled()); nemoNotification->setHintValue(HINT_DISPLAY_ON, appSettings->notificationTurnsDisplayOn()); From b11f7dd8b130131d98a04c82520863a837ef7622 Mon Sep 17 00:00:00 2001 From: Johannes Bachmann <45299708+dscheinah@users.noreply.github.com> Date: Sat, 18 Nov 2023 23:11:17 +0100 Subject: [PATCH 10/52] Always append last message content to notifications (#514) * always append last message content to notifications * make "always show notification" configurable * add unfinished translations * Fix spacing if no sender is printed --- .../settingsPage/SettingsBehavior.qml | 11 ++++++++++ src/appsettings.cpp | 15 ++++++++++++++ src/appsettings.h | 5 +++++ src/notificationmanager.cpp | 20 +++++++++++-------- 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-fr.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-sk.ts | 8 ++++++++ translations/harbour-fernschreiber-sv.ts | 8 ++++++++ translations/harbour-fernschreiber-zh_CN.ts | 8 ++++++++ translations/harbour-fernschreiber.ts | 8 ++++++++ 17 files changed, 147 insertions(+), 8 deletions(-) diff --git a/qml/components/settingsPage/SettingsBehavior.qml b/qml/components/settingsPage/SettingsBehavior.qml index 17746f7..9c6b961 100644 --- a/qml/components/settingsPage/SettingsBehavior.qml +++ b/qml/components/settingsPage/SettingsBehavior.qml @@ -191,6 +191,17 @@ AccordionItem { } Behavior on height { SmoothedAnimation { duration: 200 } } } + + TextSwitch { + width: parent.columnWidth + checked: appSettings.notificationAlwaysShowPreview + text: qsTr("Always append message preview to notifications") + description: qsTr("In addition to showing the number of unread messages, the latest message will also be appended to notifications.") + automaticCheck: false + onClicked: { + appSettings.notificationAlwaysShowPreview = !checked + } + } } } } diff --git a/src/appsettings.cpp b/src/appsettings.cpp index 776c6ae..efd5b33 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -31,6 +31,7 @@ namespace { const QString KEY_NOTIFICATION_SOUNDS_ENABLED("notificationSoundsEnabled"); const QString KEY_NOTIFICATION_SUPPRESS_ENABLED("notificationSuppressContent"); const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback"); + const QString KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW("notificationAlwaysShowPreview"); const QString KEY_STORAGE_OPTIMIZER("useStorageOptimizer"); const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess"); const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); @@ -185,6 +186,20 @@ void AppSettings::setNotificationFeedback(NotificationFeedback feedback) } } +bool AppSettings::notificationAlwaysShowPreview() const +{ + return settings.value(KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW, false).toBool(); +} + +void AppSettings::setNotificationAlwaysShowPreview(bool enable) +{ + if (notificationAlwaysShowPreview() != enable) { + LOG(KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW << enable); + settings.setValue(KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW, enable); + emit notificationAlwaysShowPreviewChanged(); + } +} + bool AppSettings::storageOptimizer() const { return settings.value(KEY_STORAGE_OPTIMIZER, true).toBool(); diff --git a/src/appsettings.h b/src/appsettings.h index 7ddc7ca..e4a1a2d 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -34,6 +34,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool notificationSoundsEnabled READ notificationSoundsEnabled WRITE setNotificationSoundsEnabled NOTIFY notificationSoundsEnabledChanged) Q_PROPERTY(bool notificationSuppressContent READ notificationSuppressContent WRITE setNotificationSuppressContent NOTIFY notificationSuppressContentChanged) Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged) + Q_PROPERTY(bool notificationAlwaysShowPreview READ notificationAlwaysShowPreview WRITE setNotificationAlwaysShowPreview NOTIFY notificationAlwaysShowPreviewChanged) Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) Q_PROPERTY(bool allowInlineBotLocationAccess READ allowInlineBotLocationAccess WRITE setAllowInlineBotLocationAccess NOTIFY allowInlineBotLocationAccessChanged) Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) @@ -91,6 +92,9 @@ public: NotificationFeedback notificationFeedback() const; void setNotificationFeedback(NotificationFeedback feedback); + bool notificationAlwaysShowPreview() const; + void setNotificationAlwaysShowPreview(bool enable); + bool storageOptimizer() const; void setStorageOptimizer(bool enable); @@ -126,6 +130,7 @@ signals: void notificationSoundsEnabledChanged(); void notificationSuppressContentChanged(); void notificationFeedbackChanged(); + void notificationAlwaysShowPreviewChanged(); void storageOptimizerChanged(); void allowInlineBotLocationAccessChanged(); void remainingInteractionHintsChanged(); diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index 2bd4bd8..f4d6127 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -341,8 +341,18 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat QString notificationBody; const QVariantMap senderInformation = messageMap.value(SENDER_ID).toMap(); - if (notificationGroup->totalCount == 1 && !messageMap.isEmpty()) { + bool outputMessageCount = notificationGroup->totalCount > 1; + bool messageIsEmpty = messageMap.isEmpty(); + if (outputMessageCount || messageIsEmpty) { + // Either we have more than one notification or we have no content to display + LOG("Group" << notificationGroup->notificationGroupId << "has" << notificationGroup->totalCount << "notifications"); + notificationBody = tr("%Ln unread messages", "", notificationGroup->totalCount); + } + if ((!outputMessageCount || appSettings->notificationAlwaysShowPreview()) && !messageIsEmpty) { LOG("Group" << notificationGroup->notificationGroupId << "has 1 notification"); + if (outputMessageCount) { + notificationBody += "; "; + } if (chatInformation && (chatInformation->type == TDLibWrapper::ChatTypeBasicGroup || (chatInformation->type == TDLibWrapper::ChatTypeSupergroup && !chatInformation->isChannel))) { // Add author @@ -352,15 +362,9 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat } else { fullName = FernschreiberUtils::getUserName(tdLibWrapper->getUserInformation(senderInformation.value(USER_ID).toString())); } - - notificationBody = notificationBody + fullName.trimmed() + ": "; + notificationBody += fullName.trimmed() + ": "; } notificationBody += FernschreiberUtils::getMessageShortText(tdLibWrapper, messageMap.value(CONTENT).toMap(), (chatInformation ? chatInformation->isChannel : false), tdLibWrapper->getUserInformation().value(ID).toLongLong(), senderInformation ); - nemoNotification->setBody(notificationBody); - } else { - // Either we have more than one notification or we have no content to display - LOG("Group" << notificationGroup->notificationGroupId << "has" << notificationGroup->totalCount << "notifications"); - notificationBody = tr("%Ln unread messages", "", notificationGroup->totalCount); } const QString summary(chatInformation ? chatInformation->title : QString()); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 30489bc..88e83b9 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1582,6 +1582,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Wenn Töne eingeschaltet sind, wird Fernschreiber den aktuellen Sailfish OS-Hinweiston für Chats verwenden, der in den Systemeinstellungen konfiguriert werden kann. + + Always append message preview to notifications + Immer bei Hinweisen die Nachricht ausgeben + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + Zusätzlich zur Anzahl der ungelesenen Nachrichten wird immer die neuste Nachricht an Hinweise angefügt. + SettingsPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index dc306a1..f625cdb 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1584,6 +1584,14 @@ messages When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. + + Always append message preview to notifications + Always append message preview to notifications + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + SettingsPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 48fd1f2..34118fc 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1582,6 +1582,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Cuando los sonidos están habilitados, Fernschreiber utilizará el sonido de notificación actual de Sailfish OS para los grupos, que se puede configurar en la configuración del sistema. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index a8e76f7..5a80d8d 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1583,6 +1583,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Kun äänet ovat käytössä, Fernschreiber käyttää Sailfish OS:n ilmoitusääniä keskusteluille, jotia voit muuttaa järjestelmäasetuksista. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index cb76a6b..ef1651a 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -1582,6 +1582,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Lorsque le son est activé, Fernschreiber utilisera le réglage de Sailfish OS. Celui-ci est paramétrable depuis les paramètres du système. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 49311be..c1668ee 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1555,6 +1555,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 15c21b2..6073681 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1582,6 +1582,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Quando i suoni di notifica sono attivi, Fernschreiber utilizza l'attuale suono di notifica per i messaggi scelto per Sailfish OS, il quale può essere modificato dalle impostazioni di sistema. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index ab36a1c..d72d6da 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1609,6 +1609,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Gdy dźwięki są włączone, Fernschreiber użyje bieżącego dźwięku powiadomienia Sailfish OS do czatów, które można skonfigurować w ustawieniach systemu. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 31ec53d..4db5164 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1612,6 +1612,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Если звуки разрешены, Fernschreiber использует звук, выбранный для чатов в настройках Sailfish OS. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index a7930ac..5ad68b4 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -1609,6 +1609,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. Keď sú povolené zvukové oznamy, Fernschreiber použije aktuálne zvukové oznamy Sailfish OS pre čety, ktoré môžu byť upravené v nastaveniach systému. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index cca0617..a100f7c 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1582,6 +1582,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. När ljud är aktiverat, använder Fernschreiber aktuell Sailfish-signal för chatt-avisering, vilken kan ställas in i systemets ljudinställningar. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 20b60e9..4b5c2ec 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1556,6 +1556,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. 如果开启声音,Fernschreiber 会采用当前旗鱼系统通知声音作为对话通知声音,你可以在系统设置进行配置。 + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 9cb3f0b..6d319bc 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1582,6 +1582,14 @@ When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. + + Always append message preview to notifications + + + + In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + SettingsPage From f771a9a81b5f929c5d8a83f37dfa32dd173cf32d Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 18 Nov 2023 23:39:09 +0100 Subject: [PATCH 11/52] Some minor adjustments --- qml/components/settingsPage/SettingsSession.qml | 12 ------------ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- translations/harbour-fernschreiber-de.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-en.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-es.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-fi.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-fr.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-hu.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-it.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-pl.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-ru.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-sk.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-sv.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-zh_CN.ts | 16 ++++++++++++---- translations/harbour-fernschreiber.ts | 16 ++++++++++++---- 16 files changed, 158 insertions(+), 66 deletions(-) diff --git a/qml/components/settingsPage/SettingsSession.qml b/qml/components/settingsPage/SettingsSession.qml index 038c774..9f5a9b6 100644 --- a/qml/components/settingsPage/SettingsSession.qml +++ b/qml/components/settingsPage/SettingsSession.qml @@ -141,18 +141,6 @@ AccordionItem { } } - Label { - width: parent.width - text: qsTr("IP address: %1, origin: %2").arg(modelData.ip).arg(modelData.country) - font.pixelSize: Theme.fontSizeExtraSmall - color: Theme.secondaryColor - maximumLineCount: 1 - truncationMode: TruncationMode.Fade - anchors { - horizontalCenter: parent.horizontalCenter - } - } - Label { width: parent.width text: qsTr("Active since: %1, last online: %2").arg(Functions.getDateTimeTimepoint(modelData.log_in_date)).arg(Functions.getDateTimeElapsed(modelData.last_active_date)) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index b5eb5c1..84c153c 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 1 +Release: 2 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index c5e2948..9580ba8 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 1 +Release: 2 # 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 diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 88e83b9..7908487 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1590,6 +1590,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. Zusätzlich zur Anzahl der ungelesenen Nachrichten wird immer die neuste Nachricht an Hinweise angefügt. + + Highlight unread messages + Ungelesene Nachrichten hervorheben + + + Highlight Conversations with unread messages + Unterhaltungen mit ungelesenen Nachrichten hervorheben + + + Hide content in Notifications + Inhalte in Hinweisen verbergen + SettingsPage @@ -1687,10 +1699,6 @@ This app Diese App - - IP address: %1, origin: %2 - IP-Adresse: %1, Herkunft: %2 - Active since: %1, last online: %2 Aktiv seit: %1, zuletzt online: %2 diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index f625cdb..5bedf63 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1592,6 +1592,18 @@ messages In addition to showing the number of unread messages, the latest message will also be appended to notifications. In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1697,10 +1709,6 @@ messages This app This app - - IP address: %1, origin: %2 - IP address: %1, origin: %2 - Active since: %1, last online: %2 Active since: %1, last online: %2 diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 34118fc..7e8c543 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1590,6 +1590,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1695,10 +1707,6 @@ This app Esta apl - - IP address: %1, origin: %2 - Dirección IP: %1, origen: %2 - Active since: %1, last online: %2 Activo desde: %1, último en línea: %2 diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 5a80d8d..30fb57a 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1591,6 +1591,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1696,10 +1708,6 @@ This app Tämä sovellus - - IP address: %1, origin: %2 - IP-osoite: %1, sijainti: %2 - Active since: %1, last online: %2 Aktiivinen %1 alkaen, viimeksi paikalla: %2 diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index ef1651a..6619abf 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -1590,6 +1590,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1695,10 +1707,6 @@ This app Cette app - - IP address: %1, origin: %2 - Adresse IP : %1, origine : %2 - Active since: %1, last online: %2 Actif depuis : %1, en ligne : %2 diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index c1668ee..a1b9709 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1563,6 +1563,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1668,10 +1680,6 @@ This app - - IP address: %1, origin: %2 - - Active since: %1, last online: %2 diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 6073681..f279676 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1590,6 +1590,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1695,10 +1707,6 @@ This app - - IP address: %1, origin: %2 - - Active since: %1, last online: %2 diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index d72d6da..0b77527 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1617,6 +1617,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1722,10 +1734,6 @@ This app Ta aplikacja - - IP address: %1, origin: %2 - Adres IP: %1, oryginalny: %2 - Active since: %1, last online: %2 Aktywny od: %1, ostatnio aktywny: %2 diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 4db5164..b2dcc9a 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1620,6 +1620,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1725,10 +1737,6 @@ This app Это приложение - - IP address: %1, origin: %2 - IP-адрес: %1, регион: %2 - Active since: %1, last online: %2 Активен с: %1, был онлайн: %2 diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index 5ad68b4..ccf207e 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -1617,6 +1617,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1722,10 +1734,6 @@ This app Táto aplikácia - - IP address: %1, origin: %2 - IP adresa: %1, pôvod: %2 - Active since: %1, last online: %2 Aktívna od: %1, naposledy pripojená: %2 diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index a100f7c..a7ae697 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1590,6 +1590,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1695,10 +1707,6 @@ This app Denna app - - IP address: %1, origin: %2 - IP-adress: %1, ursprung: %2 - Active since: %1, last online: %2 Aktiv sedan: %1, senast online: %2 diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 4b5c2ec..0e012db 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1564,6 +1564,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1669,10 +1681,6 @@ This app 此应用 - - IP address: %1, origin: %2 - IP 地址: %1, 地点: %2 - Active since: %1, last online: %2 活跃时间: %1, 上次在线: %2 diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 6d319bc..b137d4a 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1590,6 +1590,18 @@ In addition to showing the number of unread messages, the latest message will also be appended to notifications. + + Highlight unread messages + + + + Highlight Conversations with unread messages + + + + Hide content in Notifications + + SettingsPage @@ -1695,10 +1707,6 @@ This app - - IP address: %1, origin: %2 - - Active since: %1, last online: %2 From 3ac8cebc06c0934d7284d47d3772373811d37f85 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 18 Nov 2023 23:45:10 +0100 Subject: [PATCH 12/52] Enable privileged mode for contacts sync --- harbour-fernschreiber.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/harbour-fernschreiber.desktop b/harbour-fernschreiber.desktop index 9768ef0..0121eb1 100644 --- a/harbour-fernschreiber.desktop +++ b/harbour-fernschreiber.desktop @@ -6,6 +6,6 @@ Exec=harbour-fernschreiber Name=Fernschreiber [X-Sailjail] -Permissions=Audio;Contacts;Documents;Downloads;Internet;Location;MediaIndexing;Microphone;Music;Pictures;PublicDir;RemovableMedia;UserDirs;Videos +Permissions=Audio;Contacts;Documents;Downloads;Internet;Location;MediaIndexing;Microphone;Music;Pictures;Privileged;PublicDir;RemovableMedia;UserDirs;Videos OrganizationName=de.ygriega ApplicationName=fernschreiber From 0224d2f338f2e157604035d40c59b650ed101439 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 19 Nov 2023 00:18:29 +0100 Subject: [PATCH 13/52] Trouble with usernames --- qml/components/settingsPage/SettingsUserProfile.qml | 2 +- src/contactsmodel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qml/components/settingsPage/SettingsUserProfile.qml b/qml/components/settingsPage/SettingsUserProfile.qml index f4fad97..169c2a6 100644 --- a/qml/components/settingsPage/SettingsUserProfile.qml +++ b/qml/components/settingsPage/SettingsUserProfile.qml @@ -143,7 +143,7 @@ AccordionItem { visible: true canEdit: true headerText: qsTr("Username", "user name of the logged-in profile - header") - text: userInformation.username + text: userInformation.usernames.editable_username width: parent.columnWidth headerLeftAligned: true diff --git a/src/contactsmodel.cpp b/src/contactsmodel.cpp index fa24b24..2c59801 100644 --- a/src/contactsmodel.cpp +++ b/src/contactsmodel.cpp @@ -68,7 +68,7 @@ QVariant ContactsModel::data(const QModelIndex &index, int role) const case ContactRole::RoleDisplay: return requestedContact; case ContactRole::RoleTitle: return QString(requestedContact.value("first_name").toString() + " " + requestedContact.value("last_name").toString()).trimmed(); case ContactRole::RoleUserId: return requestedContact.value("id"); - case ContactRole::RoleUsername: return requestedContact.value("username"); + case ContactRole::RoleUsername: return requestedContact.value("usernames").toMap().value("editable_username").toString(); case ContactRole::RolePhotoSmall: return requestedContact.value("profile_photo").toMap().value("small"); case ContactRole::RoleUserStatus: return requestedContact.value("status").toMap().value("@type"); case ContactRole::RoleUserLastOnline: return requestedContact.value("status").toMap().value("was_online"); From 61e3e366e6d5b9f3211814eba028169392ecc6aa Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 19 Nov 2023 13:52:18 +0200 Subject: [PATCH 14/52] Tweaked notification feedback settings UI (#526) --- .../settingsPage/SettingsBehavior.qml | 93 ++++++++++--------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/qml/components/settingsPage/SettingsBehavior.qml b/qml/components/settingsPage/SettingsBehavior.qml index 9c6b961..18b487e 100644 --- a/qml/components/settingsPage/SettingsBehavior.qml +++ b/qml/components/settingsPage/SettingsBehavior.qml @@ -81,7 +81,6 @@ AccordionItem { } } - TextSwitch { width: parent.columnWidth checked: appSettings.useOpenWith @@ -93,6 +92,17 @@ AccordionItem { } } + TextSwitch { + width: parent.columnWidth + checked: appSettings.notificationAlwaysShowPreview + text: qsTr("Always append message preview to notifications") + description: qsTr("In addition to showing the number of unread messages, the latest message will also be appended to notifications.") + automaticCheck: false + onClicked: { + appSettings.notificationAlwaysShowPreview = !checked + } + } + ComboBox { id: feedbackComboBox width: parent.columnWidth @@ -147,59 +157,52 @@ AccordionItem { } } - TextSwitch { - width: parent.columnWidth - checked: appSettings.notificationSuppressContent && enabled - text: qsTr("Hide content in Notifications") - enabled: appSettings.notificationFeedback !== AppSettings.NotificationFeedbackNone - clip: height < implicitHeight - visible: height > 0 - automaticCheck: false - onClicked: { - appSettings.notificationSuppressContent = !checked - } - Behavior on height { SmoothedAnimation { duration: 200 } } + Item { + // Occupies one grid cell so that the column ends up under the combo box + // in the landscape layout + visible: parent.columns === 2 + width: 1 + height: 1 } - TextSwitch { - width: parent.columnWidth - checked: appSettings.notificationTurnsDisplayOn && enabled - text: qsTr("Notification turns on the display") + Column { enabled: appSettings.notificationFeedback !== AppSettings.NotificationFeedbackNone + width: parent.columnWidth height: enabled ? implicitHeight: 0 clip: height < implicitHeight visible: height > 0 - automaticCheck: false - onClicked: { - appSettings.notificationTurnsDisplayOn = !checked - } - Behavior on height { SmoothedAnimation { duration: 200 } } - } - TextSwitch { - width: parent.columnWidth - checked: appSettings.notificationSoundsEnabled && enabled - text: qsTr("Enable notification sounds") - description: qsTr("When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.") - enabled: appSettings.notificationFeedback !== AppSettings.NotificationFeedbackNone - height: enabled ? implicitHeight: 0 - clip: height < implicitHeight - visible: height > 0 - automaticCheck: false - onClicked: { - appSettings.notificationSoundsEnabled = !checked - } Behavior on height { SmoothedAnimation { duration: 200 } } - } - TextSwitch { - width: parent.columnWidth - checked: appSettings.notificationAlwaysShowPreview - text: qsTr("Always append message preview to notifications") - description: qsTr("In addition to showing the number of unread messages, the latest message will also be appended to notifications.") - automaticCheck: false - onClicked: { - appSettings.notificationAlwaysShowPreview = !checked + TextSwitch { + checked: appSettings.notificationSuppressContent && enabled + text: qsTr("Hide content in notifications") + enabled: parent.enabled + automaticCheck: false + onClicked: { + appSettings.notificationSuppressContent = !checked + } + } + + TextSwitch { + checked: appSettings.notificationTurnsDisplayOn && enabled + text: qsTr("Notification turns on the display") + enabled: parent.enabled + automaticCheck: false + onClicked: { + appSettings.notificationTurnsDisplayOn = !checked + } + } + + TextSwitch { + checked: appSettings.notificationSoundsEnabled && enabled + text: qsTr("Enable notification sounds") + description: qsTr("When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.") + enabled: parent.enabled + automaticCheck: false + onClicked: { + appSettings.notificationSoundsEnabled = !checked + } } } } From 00deaa79fd3992118745abbda2560f1edf7c1ec0 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 19 Nov 2023 13:34:31 +0100 Subject: [PATCH 15/52] Fix chat permissions handling --- qml/pages/ChatPage.qml | 10 +++++----- translations/harbour-fernschreiber-de.ts | 2 +- translations/harbour-fernschreiber-en.ts | 2 +- translations/harbour-fernschreiber-es.ts | 2 +- translations/harbour-fernschreiber-fi.ts | 2 +- translations/harbour-fernschreiber-fr.ts | 2 +- translations/harbour-fernschreiber-hu.ts | 2 +- translations/harbour-fernschreiber-it.ts | 2 +- translations/harbour-fernschreiber-pl.ts | 2 +- translations/harbour-fernschreiber-ru.ts | 2 +- translations/harbour-fernschreiber-sk.ts | 2 +- translations/harbour-fernschreiber-sv.ts | 2 +- translations/harbour-fernschreiber-zh_CN.ts | 2 +- translations/harbour-fernschreiber.ts | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index b816fe3..c98c263 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -63,7 +63,7 @@ Page { ) property var selectedMessages: [] readonly property bool isSelecting: selectedMessages.length > 0 - readonly property bool canSendMessages: hasSendPrivilege("can_send_messages") + readonly property bool canSendMessages: hasSendPrivilege("can_send_basic_messages") property bool doSendBotStartMessage property string sendBotStartMessageParameter property var availableReactions @@ -1599,7 +1599,7 @@ Page { IconButton { id: attachImageIconButton - visible: chatPage.hasSendPrivilege("can_send_media_messages") + visible: chatPage.hasSendPrivilege("can_send_photos") icon.source: "image://theme/icon-m-image" onClicked: { var picker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { @@ -1615,7 +1615,7 @@ Page { } } IconButton { - visible: chatPage.hasSendPrivilege("can_send_media_messages") + visible: chatPage.hasSendPrivilege("can_send_videos") icon.source: "image://theme/icon-m-video" onClicked: { var picker = pageStack.push("Sailfish.Pickers.VideoPickerPage", { @@ -1631,7 +1631,7 @@ Page { } } IconButton { - visible: chatPage.hasSendPrivilege("can_send_media_messages") + visible: chatPage.hasSendPrivilege("can_send_voice_notes") icon.source: "image://theme/icon-m-mic" icon.sourceSize { width: Theme.iconSizeMedium @@ -1644,7 +1644,7 @@ Page { } } IconButton { - visible: chatPage.hasSendPrivilege("can_send_media_messages") + visible: chatPage.hasSendPrivilege("can_send_documents") icon.source: "image://theme/icon-m-document" onClicked: { var picker = pageStack.push("Sailfish.Pickers.FilePickerPage", { diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 7908487..541ad0d 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1599,7 +1599,7 @@ Unterhaltungen mit ungelesenen Nachrichten hervorheben - Hide content in Notifications + Hide content in notifications Inhalte in Hinweisen verbergen diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 5bedf63..4b03af9 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1601,7 +1601,7 @@ messages - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 7e8c543..8fb1434 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1599,7 +1599,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 30fb57a..ff316bd 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1600,7 +1600,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index 6619abf..c9a5297 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -1599,7 +1599,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index a1b9709..021c976 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1572,7 +1572,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index f279676..34ae96f 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1599,7 +1599,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 0b77527..b213f81 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1626,7 +1626,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index b2dcc9a..d1a5e7a 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1629,7 +1629,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index ccf207e..1ef59c9 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -1626,7 +1626,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index a7ae697..48235f3 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1599,7 +1599,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 0e012db..c3b526f 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1573,7 +1573,7 @@ - Hide content in Notifications + Hide content in notifications diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index b137d4a..ba39133 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1599,7 +1599,7 @@ - Hide content in Notifications + Hide content in notifications From ea89ef4fcddc3b6e3fdb82effec1eb9b59ea5ac3 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 19 Nov 2023 14:24:19 +0100 Subject: [PATCH 16/52] Make replies backward-compatible again --- src/tdlibwrapper.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 509e7cc..646ac20 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -411,19 +411,10 @@ QVariantMap TDLibWrapper::newSendMessageRequest(qlonglong chatId, qlonglong repl request.insert(_TYPE, "sendMessage"); request.insert(CHAT_ID, chatId); if (replyToMessageId) { - if (versionNumber > VERSION_NUMBER(1,8,14)) { - QVariantMap replyTo; - if (versionNumber > VERSION_NUMBER(1,8,20)) { - replyTo.insert(_TYPE, TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE); - } else { - replyTo.insert(_TYPE, TYPE_MESSAGE_REPLY_TO_MESSAGE); - } - replyTo.insert(CHAT_ID, chatId); - replyTo.insert(MESSAGE_ID, replyToMessageId); - request.insert(REPLY_TO, replyTo); - } else { - request.insert(REPLY_TO_MESSAGE_ID, replyToMessageId); - } + QVariantMap replyTo; + replyTo.insert(_TYPE, TYPE_INPUT_MESSAGE_REPLY_TO_MESSAGE); + replyTo.insert(MESSAGE_ID, replyToMessageId); + request.insert(REPLY_TO, replyTo); } return request; } From f133586aa232f9d0c5f67e80e470aebc63800a9c Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 19 Nov 2023 14:36:06 +0100 Subject: [PATCH 17/52] Hide unsupported emojis for reactions --- qml/components/MessageListViewItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index b01a39a..38cdc11 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -687,7 +687,7 @@ ListItem { Image { id: emojiPicture source: Emoji.getEmojiPath(modelData) - width: Theme.fontSizeLarge + width: status === Image.Ready ? Theme.fontSizeLarge : 0 height: Theme.fontSizeLarge } From 8531a46015c8235b4c0bc4f681c44ab4d558c2f2 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 19 Nov 2023 21:49:00 +0100 Subject: [PATCH 18/52] More places affected by new username handling --- qml/components/InlineQuery.qml | 2 +- qml/components/MessageViaLabel.qml | 4 ++-- qml/components/ReplyMarkupButtons.qml | 4 ++-- .../chatInformationPage/ChatInformationPageContent.qml | 4 ++-- qml/components/messageContent/MessageSticker.qml | 2 +- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/knownusersmodel.cpp | 6 +++--- src/tdlibwrapper.cpp | 8 +++++--- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/qml/components/InlineQuery.qml b/qml/components/InlineQuery.qml index 1ad7cb3..5f97fb2 100644 --- a/qml/components/InlineQuery.qml +++ b/qml/components/InlineQuery.qml @@ -40,7 +40,7 @@ Loader { property string chatId property string userName - property bool userNameIsValid: userName !== "" && inlineBotInformation && userName.toLowerCase() === inlineBotInformation.username.toLowerCase() + property bool userNameIsValid: userName !== "" && inlineBotInformation && userName.toLowerCase() === inlineBotInformation.usernames.editable_username.toLowerCase() property string query property int currentOffset: 0 property string responseExtra: chatId+"|"+userName+"|"+query+"|"+currentOffset diff --git a/qml/components/MessageViaLabel.qml b/qml/components/MessageViaLabel.qml index b76619e..b0d34d3 100644 --- a/qml/components/MessageViaLabel.qml +++ b/qml/components/MessageViaLabel.qml @@ -31,12 +31,12 @@ Loader { property var botUserInformation: tdLibWrapper.getUserInformation(message.via_bot_user_id) color: Theme.secondaryColor font.pixelSize: Theme.fontSizeExtraSmall - text: qsTr("via %1", "message posted via bot user").arg("@" + Emoji.emojify(botUserInformation.username, font.pixelSize)+"") + text: qsTr("via %1", "message posted via bot user").arg("@" + Emoji.emojify(botUserInformation.usernames.editable_username, font.pixelSize)+"") textFormat: Text.RichText truncationMode: TruncationMode.Fade onLinkActivated: { if(link === "userId://" + message.via_bot_user_id && botUserInformation.type.is_inline) { - newMessageTextField.text = "@"+botUserInformation.username+" " + newMessageTextField.text = "@"+botUserInformation.usernames.editable_username+" " newMessageTextField.cursorPosition = newMessageTextField.text.length lostFocusTimer.start(); } diff --git a/qml/components/ReplyMarkupButtons.qml b/qml/components/ReplyMarkupButtons.qml index de2cd2c..99efe97 100644 --- a/qml/components/ReplyMarkupButtons.qml +++ b/qml/components/ReplyMarkupButtons.qml @@ -60,12 +60,12 @@ Column { }, inlineKeyboardButtonTypeSwitchInline: function() { if(modelData.type.in_current_chat) { - chatPage.setMessageText("@" + userInformation.username + " "+(modelData.type.query || "")) + chatPage.setMessageText("@" + userInformation.usernames.editable_username + " "+(modelData.type.query || "")) } else { pageStack.push(Qt.resolvedUrl("../pages/ChatSelectionPage.qml"), { myUserId: chatPage.myUserId, - payload: { neededPermissions: ["can_send_other_messages"], text:"@" + userInformation.username + " "+(modelData.type.query || "")}, + payload: { neededPermissions: ["can_send_other_messages"], text:"@" + userInformation.usernames.editable_username + " "+(modelData.type.query || "")}, state: "fillTextArea" }) } diff --git a/qml/components/chatInformationPage/ChatInformationPageContent.qml b/qml/components/chatInformationPage/ChatInformationPageContent.qml index 511bc38..bbd1992 100644 --- a/qml/components/chatInformationPage/ChatInformationPageContent.qml +++ b/qml/components/chatInformationPage/ChatInformationPageContent.qml @@ -300,8 +300,8 @@ SilicaFlickable { } leftMargin: imageContainer.getEased((imageContainer.minDimension + Theme.paddingMedium), 0, imageContainer.tweenFactor) + Theme.horizontalPageMargin title: chatInformationPage.chatInformation.title !== "" ? Emoji.emojify(chatInformationPage.chatInformation.title, Theme.fontSizeLarge) : qsTr("Unknown") - description: ((chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) && chatInformationPage.privateChatUserInformation.username) - ? ("@"+chatInformationPage.privateChatUserInformation.username) : "" + description: ((chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) && chatInformationPage.privateChatUserInformation.usernames.editable_username) + ? ("@"+chatInformationPage.privateChatUserInformation.usernames.editable_username) : "" } SilicaFlickable { diff --git a/qml/components/messageContent/MessageSticker.qml b/qml/components/messageContent/MessageSticker.qml index ce499f8..fb9f02d 100644 --- a/qml/components/messageContent/MessageSticker.qml +++ b/qml/components/messageContent/MessageSticker.qml @@ -27,7 +27,7 @@ MessageContentBase { property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker; readonly property bool asEmoji: appSettings.showStickersAsEmojis - readonly property bool animated: stickerData.type["@type"] === "stickerTypeAnimated" && appSettings.animateStickers + readonly property bool animated: stickerData.format["@type"] === "stickerFormatTgs" && appSettings.animateStickers readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible : animatedStickerLoader.item ? animatedStickerLoader.item.visible : false readonly property bool isOwnSticker : messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 84c153c..ea6c80f 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 2 +Release: 3 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 9580ba8..c374f3f 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 2 +Release: 3 # 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 diff --git a/src/knownusersmodel.cpp b/src/knownusersmodel.cpp index 50fdbd2..243cfeb 100644 --- a/src/knownusersmodel.cpp +++ b/src/knownusersmodel.cpp @@ -56,10 +56,10 @@ QVariant KnownUsersModel::data(const QModelIndex &index, int role) const case KnownUserRole::RoleDisplay: return requestedUser; case KnownUserRole::RoleUserId: return requestedUser.value("id"); case KnownUserRole::RoleTitle: return QString(requestedUser.value("first_name").toString() + " " + requestedUser.value("last_name").toString()).trimmed(); - case KnownUserRole::RoleUsername: return requestedUser.value("username"); - case KnownUserRole::RoleUserHandle: return QString("@" + (requestedUser.value("username").toString().isEmpty() ? requestedUser.value("id").toString() : requestedUser.value("username").toString())); + case KnownUserRole::RoleUsername: return requestedUser.value("usernames").toMap().value("editable_username").toString(); + case KnownUserRole::RoleUserHandle: return QString("@" + (requestedUser.value("usernames").toMap().value("editable_username").toString().isEmpty() ? requestedUser.value("id").toString() : requestedUser.value("usernames").toMap().value("editable_username").toString())); case KnownUserRole::RolePhotoSmall: return requestedUser.value("profile_photo").toMap().value("small"); - case KnownUserRole::RoleFilter: return QString(requestedUser.value("first_name").toString() + " " + requestedUser.value("last_name").toString() + " " + requestedUser.value("username").toString()).trimmed(); + case KnownUserRole::RoleFilter: return QString(requestedUser.value("first_name").toString() + " " + requestedUser.value("last_name").toString() + " " + requestedUser.value("usernames").toMap().value("editable_username").toString()).trimmed(); } } return QVariant(); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 646ac20..ffa902d 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -48,6 +48,8 @@ namespace { const QString LAST_NAME("last_name"); const QString FIRST_NAME("first_name"); const QString USERNAME("username"); + const QString USERNAMES("usernames"); + const QString EDITABLE_USERNAME("editable_username"); const QString THREAD_ID("thread_id"); const QString VALUE("value"); const QString CHAT_LIST_TYPE("chat_list_type"); @@ -1829,9 +1831,9 @@ void TDLibWrapper::handleUserUpdated(const QVariantMap &userInformation) this->userInformation = userInformation; emit ownUserUpdated(userInformation); } - LOG("User information updated:" << userInformation.value(USERNAME).toString() << userInformation.value(FIRST_NAME).toString() << userInformation.value(LAST_NAME).toString()); + LOG("User information updated:" << userInformation.value(USERNAMES).toMap().value(EDITABLE_USERNAME).toString() << userInformation.value(FIRST_NAME).toString() << userInformation.value(LAST_NAME).toString()); this->allUsers.insert(updatedUserId, userInformation); - this->allUserNames.insert(userInformation.value(USERNAME).toString(), userInformation); + this->allUserNames.insert(userInformation.value(USERNAMES).toMap().value(EDITABLE_USERNAME).toString(), userInformation); emit userUpdated(updatedUserId, userInformation); } @@ -1845,7 +1847,7 @@ void TDLibWrapper::handleUserStatusUpdated(const QString &userId, const QVariant QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap(); updatedUserInformation.insert(STATUS, userStatusInformation); this->allUsers.insert(userId, updatedUserInformation); - this->allUserNames.insert(userInformation.value(USERNAME).toString(), userInformation); + this->allUserNames.insert(userInformation.value(USERNAMES).toMap().value(EDITABLE_USERNAME).toString(), userInformation); emit userUpdated(userId, updatedUserInformation); } From 195e255f08447c9c355f70de97fcd26b81007c39 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 19 Nov 2023 22:54:50 +0200 Subject: [PATCH 19/52] Added UI for configuring session inactivity timeout (#527) --- .../settingsPage/SettingsSession.qml | 251 ++++++++++-------- src/tdlibreceiver.cpp | 3 +- src/tdlibreceiver.h | 2 +- src/tdlibwrapper.cpp | 10 +- src/tdlibwrapper.h | 3 +- 5 files changed, 160 insertions(+), 109 deletions(-) diff --git a/qml/components/settingsPage/SettingsSession.qml b/qml/components/settingsPage/SettingsSession.qml index 9f5a9b6..cb65cf8 100644 --- a/qml/components/settingsPage/SettingsSession.qml +++ b/qml/components/settingsPage/SettingsSession.qml @@ -30,141 +30,182 @@ AccordionItem { Column { id: activeSessionsItem bottomPadding: Theme.paddingMedium - property variant activeSessions; - property bool loaded : false; + property variant activeSessions + property int inactiveSessionsTtlDays Component.onCompleted: { if (!activeSessions) { tdLibWrapper.getActiveSessions(); - } else { - activeSessionsItem.loaded = true; } } Connections { target: tdLibWrapper onSessionsReceived: { - activeSessionsItem.activeSessions = sessions; - activeSessionsItem.loaded = true; + activeSessionsItem.activeSessions = sessions + activeSessionsItem.inactiveSessionsTtlDays = inactive_session_ttl_days } onOkReceived: { if (request === "terminateSession") { appNotification.show(qsTr("Session was terminated")); - activeSessionsItem.loaded = false; tdLibWrapper.getActiveSessions(); } } } Loader { - id: sessionInformationLoader active: tdLibWrapper.authorizationState === TelegramAPI.AuthorizationReady width: parent.width sourceComponent: Component { - SilicaListView { - id: activeSessionsListView - width: parent.width - height: contentHeight - model: activeSessionsItem.activeSessions - headerPositioning: ListView.OverlayHeader - header: Separator { - width: parent.width - color: Theme.primaryColor - horizontalAlignment: Qt.AlignHCenter + Column { + BusyIndicator { + anchors.horizontalCenter: parent.horizontalCenter + running: !activeSessionsListView.count && !activeSessionsItem.inactiveSessionsTtlDays + size: BusyIndicatorSize.Medium + visible: opacity > 0 + height: running ? implicitHeight : 0 } - delegate: ListItem { - id: activeSessionListItem + + SilicaListView { + id: activeSessionsListView width: parent.width - contentHeight: activeSessionColumn.height + ( 2 * Theme.paddingMedium ) - - menu: ContextMenu { - hasContent: !modelData.is_current - onHeightChanged: { - if (parent && flickable) { - // Make sure we are inside the screen area - var bottom = parent.mapToItem(flickable, x, y).y + height - if (bottom > flickable.height) { - flickable.contentY += bottom - flickable.height - } - } - } - MenuItem { - onClicked: { - var sessionId = modelData.id; - Remorse.itemAction(activeSessionListItem, qsTr("Terminating session"), function() { tdLibWrapper.terminateSession(sessionId); }); - } - text: qsTr("Terminate Session") - } - } - - Column { - id: activeSessionColumn - width: parent.width - ( 2 * Theme.horizontalPageMargin ) - spacing: Theme.paddingSmall - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - - Label { - width: parent.width - text: qsTr("This app") - font.pixelSize: Theme.fontSizeMedium - font.bold: true - visible: modelData.is_current - color: Theme.highlightColor - anchors { - horizontalCenter: parent.horizontalCenter - } - } - - Label { - width: parent.width - text: modelData.application_name + " " + modelData.application_version - font.pixelSize: Theme.fontSizeMedium - font.bold: true - color: Theme.primaryColor - maximumLineCount: 1 - elide: Text.ElideRight - anchors { - horizontalCenter: parent.horizontalCenter - } - } - - Label { - width: parent.width - text: modelData.device_model + ", " + (modelData.platform + " " + modelData.system_version).trim() - font.pixelSize: Theme.fontSizeSmall - color: Theme.primaryColor - maximumLineCount: 1 - truncationMode: TruncationMode.Fade - anchors { - horizontalCenter: parent.horizontalCenter - } - } - - Label { - width: parent.width - text: qsTr("Active since: %1, last online: %2").arg(Functions.getDateTimeTimepoint(modelData.log_in_date)).arg(Functions.getDateTimeElapsed(modelData.last_active_date)) - font.pixelSize: Theme.fontSizeExtraSmall - color: Theme.primaryColor - maximumLineCount: 1 - truncationMode: TruncationMode.Fade - anchors { - horizontalCenter: parent.horizontalCenter - } - } - } - - Separator { - id: separator - anchors { - bottom: parent.bottom - } - + height: contentHeight + model: activeSessionsItem.activeSessions + headerPositioning: ListView.OverlayHeader + header: Separator { width: parent.width color: Theme.primaryColor horizontalAlignment: Qt.AlignHCenter + visible: activeSessionsListView.count > 0 + } + delegate: ListItem { + id: activeSessionListItem + width: parent.width + contentHeight: activeSessionColumn.height + ( 2 * Theme.paddingMedium ) + + menu: ContextMenu { + hasContent: !modelData.is_current + onHeightChanged: { + if (parent && flickable) { + // Make sure we are inside the screen area + var bottom = parent.mapToItem(flickable, x, y).y + height + if (bottom > flickable.height) { + flickable.contentY += bottom - flickable.height + } + } + } + MenuItem { + onClicked: { + var sessionId = modelData.id; + Remorse.itemAction(activeSessionListItem, qsTr("Terminating session"), function() { tdLibWrapper.terminateSession(sessionId); }); + } + text: qsTr("Terminate Session") + } + } + + Column { + id: activeSessionColumn + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + spacing: Theme.paddingSmall + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + + Label { + width: parent.width + text: qsTr("This app") + font.pixelSize: Theme.fontSizeMedium + font.bold: true + visible: modelData.is_current + color: Theme.highlightColor + } + + Label { + width: parent.width + text: modelData.application_name + " " + modelData.application_version + font.pixelSize: Theme.fontSizeMedium + font.bold: true + maximumLineCount: 1 + elide: Text.ElideRight + } + + Label { + width: parent.width + text: modelData.device_model + ", " + (modelData.platform + " " + modelData.system_version).trim() + font.pixelSize: Theme.fontSizeSmall + maximumLineCount: 1 + truncationMode: TruncationMode.Fade + } + + Label { + width: parent.width + text: qsTr("Active since: %1, last online: %2").arg(Functions.getDateTimeTimepoint(modelData.log_in_date)).arg(Functions.getDateTimeElapsed(modelData.last_active_date)) + font.pixelSize: Theme.fontSizeExtraSmall + maximumLineCount: 1 + truncationMode: TruncationMode.Fade + } + } + + Separator { + anchors { + bottom: parent.bottom + } + + width: parent.width + color: Theme.primaryColor + horizontalAlignment: Qt.AlignHCenter + } + } + } + + ComboBox { + readonly property int ttl: activeSessionsItem.inactiveSessionsTtlDays + label: qsTr("Terminate old sessions if inactive for") + value: (currentItem && currentItem.text) ? currentItem.text : qsTr("%1 day(s)", "", ttl).arg(ttl) + visible: ttl > 0 + menu: ContextMenu { + id: ttlMenu + MenuItem { + readonly property int days: 7 + text: qsTr("1 week") + onClicked: tdLibWrapper.setInactiveSessionTtl(days) + } + MenuItem { + readonly property int days: 30 + text: qsTr("1 month") + onClicked: tdLibWrapper.setInactiveSessionTtl(days) + } + MenuItem { + readonly property int days: 90 + text: qsTr("3 months") + onClicked: tdLibWrapper.setInactiveSessionTtl(days) + } + MenuItem { + readonly property int days: 180 + text: qsTr("6 months") + onClicked: tdLibWrapper.setInactiveSessionTtl(days) + } + MenuItem { + readonly property int days: 365 + text: qsTr("1 year") + onClicked: tdLibWrapper.setInactiveSessionTtl(days) + } } + Component.onCompleted: updateSelection() + + onTtlChanged: updateSelection() + + function updateSelection() { + var menuItems = ttlMenu.children + var n = menuItems.length + for (var i = 0; i < n; i++) { + if (menuItems[i].days === ttl) { + currentIndex = i + return + } + } + currentIndex = -1 + } } } } diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index 11a46dc..f14eeeb 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -712,8 +712,9 @@ void TDLibReceiver::processUpdateMessageInteractionInfo(const QVariantMap &recei void TDLibReceiver::processSessions(const QVariantMap &receivedInformation) { + int inactive_session_ttl_days = receivedInformation.value("inactive_session_ttl_days").toInt(); QVariantList sessions = receivedInformation.value("sessions").toList(); - emit sessionsReceived(sessions); + emit sessionsReceived(inactive_session_ttl_days, sessions); } void TDLibReceiver::processAvailableReactions(const QVariantMap &receivedInformation) diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index a13ae04..cf6558c 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -101,7 +101,7 @@ signals: void userPrivacySettingRulesUpdated(const QVariantMap &updatedRules); void messageInteractionInfoUpdated(qlonglong chatId, qlonglong messageId, const QVariantMap &updatedInfo); void okReceived(const QString &request); - void sessionsReceived(const QVariantList &sessions); + void sessionsReceived(int inactive_session_ttl_days, const QVariantList &sessions); void availableReactionsReceived(qlonglong messageId, const QStringList &reactions); void chatUnreadMentionCountUpdated(qlonglong chatId, int unreadMentionCount); void chatUnreadReactionCountUpdated(qlonglong chatId, int unreadReactionCount); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index ffa902d..f815ccf 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -187,7 +187,7 @@ void TDLibWrapper::initializeTDLibReceiver() { connect(this->tdLibReceiver, SIGNAL(userPrivacySettingRulesUpdated(QVariantMap)), this, SLOT(handleUpdatedUserPrivacySettingRules(QVariantMap))); connect(this->tdLibReceiver, SIGNAL(messageInteractionInfoUpdated(qlonglong, qlonglong, QVariantMap)), this, SIGNAL(messageInteractionInfoUpdated(qlonglong, qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(okReceived(QString)), this, SIGNAL(okReceived(QString))); - connect(this->tdLibReceiver, SIGNAL(sessionsReceived(QVariantList)), this, SIGNAL(sessionsReceived(QVariantList))); + connect(this->tdLibReceiver, SIGNAL(sessionsReceived(int, QVariantList)), this, SIGNAL(sessionsReceived(int, QVariantList))); connect(this->tdLibReceiver, SIGNAL(availableReactionsReceived(qlonglong, QStringList)), this, SIGNAL(availableReactionsReceived(qlonglong, QStringList))); connect(this->tdLibReceiver, SIGNAL(chatUnreadMentionCountUpdated(qlonglong, int)), this, SIGNAL(chatUnreadMentionCountUpdated(qlonglong, int))); connect(this->tdLibReceiver, SIGNAL(chatUnreadReactionCountUpdated(qlonglong, int)), this, SIGNAL(chatUnreadReactionCountUpdated(qlonglong, int))); @@ -1520,6 +1520,14 @@ void TDLibWrapper::setNetworkType(NetworkType networkType) this->sendRequest(requestObject); } +void TDLibWrapper::setInactiveSessionTtl(int days) +{ + QVariantMap requestObject; + requestObject.insert(_TYPE, "setInactiveSessionTtl"); + requestObject.insert("inactive_session_ttl_days", days); + this->sendRequest(requestObject); +} + void TDLibWrapper::searchEmoji(const QString &queryString) { LOG("Searching emoji" << queryString); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 33e29b4..17a0896 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -251,6 +251,7 @@ public: Q_INVOKABLE void getPageSource(const QString &address); Q_INVOKABLE void setMessageReaction(qlonglong chatId, qlonglong messageId, const QString &reaction); Q_INVOKABLE void setNetworkType(NetworkType networkType); + Q_INVOKABLE void setInactiveSessionTtl(int days); // Others (candidates for extraction ;)) Q_INVOKABLE void searchEmoji(const QString &queryString); @@ -331,7 +332,7 @@ signals: void userPrivacySettingUpdated(UserPrivacySetting setting, UserPrivacySettingRule rule); void messageInteractionInfoUpdated(qlonglong chatId, qlonglong messageId, const QVariantMap &updatedInfo); void okReceived(const QString &request); - void sessionsReceived(const QVariantList &sessions); + void sessionsReceived(int inactive_session_ttl_days, const QVariantList &sessions); void openFileExternally(const QString &filePath); void availableReactionsReceived(qlonglong messageId, const QStringList &reactions); void chatUnreadMentionCountUpdated(qlonglong chatId, int unreadMentionCount); From acfcfd3ca43054a01501e7aa5cc105f58e6904b4 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 19 Nov 2023 22:51:33 +0100 Subject: [PATCH 20/52] Minor tweaks for the new session timout setting --- .../settingsPage/SettingsSession.qml | 3 +- translations/harbour-fernschreiber-de.ts | 35 ++++++++++++++++++ translations/harbour-fernschreiber-en.ts | 35 ++++++++++++++++++ translations/harbour-fernschreiber-es.ts | 35 ++++++++++++++++++ translations/harbour-fernschreiber-fi.ts | 35 ++++++++++++++++++ translations/harbour-fernschreiber-fr.ts | 35 ++++++++++++++++++ translations/harbour-fernschreiber-hu.ts | 34 ++++++++++++++++++ translations/harbour-fernschreiber-it.ts | 35 ++++++++++++++++++ translations/harbour-fernschreiber-pl.ts | 36 +++++++++++++++++++ translations/harbour-fernschreiber-ru.ts | 36 +++++++++++++++++++ translations/harbour-fernschreiber-sk.ts | 36 +++++++++++++++++++ translations/harbour-fernschreiber-sv.ts | 35 ++++++++++++++++++ translations/harbour-fernschreiber-zh_CN.ts | 34 ++++++++++++++++++ translations/harbour-fernschreiber.ts | 35 ++++++++++++++++++ 14 files changed, 458 insertions(+), 1 deletion(-) diff --git a/qml/components/settingsPage/SettingsSession.qml b/qml/components/settingsPage/SettingsSession.qml index cb65cf8..e94b2ca 100644 --- a/qml/components/settingsPage/SettingsSession.qml +++ b/qml/components/settingsPage/SettingsSession.qml @@ -159,7 +159,8 @@ AccordionItem { ComboBox { readonly property int ttl: activeSessionsItem.inactiveSessionsTtlDays - label: qsTr("Terminate old sessions if inactive for") + label: qsTr("Session Timeout") + description: qsTr("Inactive sessions will be terminated after this timeframe") value: (currentItem && currentItem.text) ? currentItem.text : qsTr("%1 day(s)", "", ttl).arg(ttl) visible: ttl > 0 menu: ContextMenu { diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 541ad0d..d0eac2d 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1711,6 +1711,41 @@ Sessions Sitzungen + + %1 day(s) + + %1 Tag + %1 Tage + + + + 1 week + 1 Woche + + + 1 month + 1 Monat + + + 3 months + 3 Monate + + + 6 months + 6 Monate + + + 1 year + 1 Jahr + + + Session Timeout + Timeout von Sitzungen + + + Inactive sessions will be terminated after this timeframe + Inaktive Sitzungen werden nach dieser Zeitdauer abgeschaltet + SettingsStorage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 4b03af9..4008317 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1713,6 +1713,41 @@ messages Active since: %1, last online: %2 Active since: %1, last online: %2 + + %1 day(s) + + %1 day + %1 days + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 8fb1434..5bb74ef 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1711,6 +1711,41 @@ Active since: %1, last online: %2 Activo desde: %1, último en línea: %2 + + %1 day(s) + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index ff316bd..d0b22c8 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1712,6 +1712,41 @@ Active since: %1, last online: %2 Aktiivinen %1 alkaen, viimeksi paikalla: %2 + + %1 day(s) + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index c9a5297..96f7e9b 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -1711,6 +1711,41 @@ Active since: %1, last online: %2 Actif depuis : %1, en ligne : %2 + + %1 day(s) + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 021c976..796c1c3 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1684,6 +1684,40 @@ Active since: %1, last online: %2 + + %1 day(s) + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 34ae96f..48e863e 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1711,6 +1711,41 @@ Active since: %1, last online: %2 + + %1 day(s) + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index b213f81..b16825d 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1738,6 +1738,42 @@ Active since: %1, last online: %2 Aktywny od: %1, ostatnio aktywny: %2 + + %1 day(s) + + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index d1a5e7a..c3d389e 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1741,6 +1741,42 @@ Active since: %1, last online: %2 Активен с: %1, был онлайн: %2 + + %1 day(s) + + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index 1ef59c9..d4b14cf 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -1738,6 +1738,42 @@ Active since: %1, last online: %2 Aktívna od: %1, naposledy pripojená: %2 + + %1 day(s) + + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 48235f3..d00eb6d 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1711,6 +1711,41 @@ Active since: %1, last online: %2 Aktiv sedan: %1, senast online: %2 + + %1 day(s) + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index c3b526f..88727e2 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1685,6 +1685,40 @@ Active since: %1, last online: %2 活跃时间: %1, 上次在线: %2 + + %1 day(s) + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index ba39133..cc90573 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1711,6 +1711,41 @@ Active since: %1, last online: %2 + + %1 day(s) + + + + + + + 1 week + + + + 1 month + + + + 3 months + + + + 6 months + + + + 1 year + + + + Session Timeout + + + + Inactive sessions will be terminated after this timeframe + + SettingsStorage From 8d59ee4c0011ea6d2a57dd0fc43ee547172ff748 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 20 Nov 2023 21:27:55 +0100 Subject: [PATCH 21/52] Restore search in chats --- qml/components/MessageListViewItem.qml | 2 ++ src/tdlibreceiver.cpp | 8 ++++++++ src/tdlibreceiver.h | 1 + 3 files changed, 11 insertions(+) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 38cdc11..189f429 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -133,8 +133,10 @@ ListItem { if (messageListItem.messageReactions) { messageListItem.messageReactions = null; } else if (messageListItem.chatReactions) { + Debug.log("Using chat reactions") messageListItem.messageReactions = chatReactions } else { + Debug.log("Obtaining message reactions") tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId); } } diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index f14eeeb..8f65952 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -127,6 +127,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("updateSupergroup", &TDLibReceiver::processUpdateSuperGroup); handlers.insert("updateChatOnlineMemberCount", &TDLibReceiver::processChatOnlineMemberCountUpdated); handlers.insert("messages", &TDLibReceiver::processMessages); + handlers.insert("foundChatMessages", &TDLibReceiver::processFoundChatMessages); handlers.insert("sponsoredMessage", &TDLibReceiver::processSponsoredMessage); // TdLib <= 1.8.7 handlers.insert("sponsoredMessages", &TDLibReceiver::processSponsoredMessages); // TdLib >= 1.8.8 handlers.insert("updateNewMessage", &TDLibReceiver::processUpdateNewMessage); @@ -390,6 +391,13 @@ void TDLibReceiver::processMessages(const QVariantMap &receivedInformation) emit messagesReceived(cleanupList(receivedInformation.value(MESSAGES).toList()), total_count); } +void TDLibReceiver::processFoundChatMessages(const QVariantMap &receivedInformation) +{ + const int total_count = receivedInformation.value(TOTAL_COUNT).toInt(); + LOG("Received found chat messages, amount: " << total_count); + emit messagesReceived(cleanupList(receivedInformation.value(MESSAGES).toList()), total_count); +} + void TDLibReceiver::processSponsoredMessage(const QVariantMap &receivedInformation) { // TdLib <= 1.8.7 diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index cf6558c..bfb380e 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -139,6 +139,7 @@ private: void processUpdateSuperGroup(const QVariantMap &receivedInformation); void processChatOnlineMemberCountUpdated(const QVariantMap &receivedInformation); void processMessages(const QVariantMap &receivedInformation); + void processFoundChatMessages(const QVariantMap &receivedInformation); void processSponsoredMessage(const QVariantMap &receivedInformation); void processSponsoredMessages(const QVariantMap &receivedInformation); void processUpdateNewMessage(const QVariantMap &receivedInformation); From 5b2fa38f7ed894a3e28060c77232427976c401bb Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 20 Nov 2023 21:53:57 +0100 Subject: [PATCH 22/52] Display reactions on last message again --- qml/components/MessageListViewItem.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 189f429..2ac1e87 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -135,6 +135,8 @@ ListItem { } else 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); @@ -281,6 +283,7 @@ ListItem { interval: 200 triggeredOnStart: false onTriggered: { + Debug.log("Show item completely timer triggered, requested index: " + requestedIndex + ", current index: " + index) if (requestedIndex === index) { chatView.highlightMoveDuration = -1; chatView.highlightResizeDuration = -1; From 58382ac1b6c489a607bc37292e2ddc7324246148 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 20 Nov 2023 22:34:52 +0100 Subject: [PATCH 23/52] Test build no.4 --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index ea6c80f..568b883 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 3 +Release: 4 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index c374f3f..c8cc6b0 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 3 +Release: 4 # 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 From 75bf14615436f94c8001449d22b033af4e897877 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Tue, 21 Nov 2023 22:31:23 +0200 Subject: [PATCH 24/52] Updated Russian translation (#528) --- translations/harbour-fernschreiber-ru.ts | 50 ++++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index c3d389e..09982cd 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -348,11 +348,11 @@ Leave Chat - Выйти из Чата + Выйти из чата Join Chat - Зайти в Чат + Зайти в чат Leaving chat @@ -427,7 +427,7 @@ Search in Chat - Найти в Чате + Поиск в чате Search in chat... @@ -1159,7 +1159,7 @@ Secret Chat - Секретный Чат + Секретный чат End-to-end-encrypted, accessible on this device only @@ -1241,7 +1241,7 @@ New Chat - Новый Чат + Новый чат Filter your chats... @@ -1249,7 +1249,7 @@ Search Chats - Найти Чаты + Поиск чатов Download of %1 successful. @@ -1460,7 +1460,7 @@ SearchChatsPage No chats found. - Чаты не найдены + Ничего не найдено Searching chats... @@ -1468,7 +1468,7 @@ Private Chat - Приватный Чат + Приватный чат Group @@ -1496,7 +1496,7 @@ Search Chats - Найти Чаты + Поиск чатов Search a chat... @@ -1614,23 +1614,23 @@ Always append message preview to notifications - + Всегда показывать последнее сообщение на экране событий In addition to showing the number of unread messages, the latest message will also be appended to notifications. - + Включать в текст на экране событий не только количество непрочитанных сообщений, но и содержимое последнего сообщения. Highlight unread messages - + Выделять непрочитанные сообщения Highlight Conversations with unread messages - + Помечать чаты и каналы с непрочитанными сообщениями другим шрифтом и цветом. Hide content in notifications - + Не показывать содержимое сообщений в уведомлениях @@ -1743,39 +1743,39 @@ %1 day(s) - - - - + + %1 день + %1 дня + %1 дней 1 week - + 1 неделя 1 month - + 1 месяц 3 months - + 3 месяца 6 months - + 6 месяцев 1 year - + 1 год Session Timeout - + Таймаут неактивности Inactive sessions will be terminated after this timeframe - + Неактивные сеансы будут автоматически завершены через указанное время. From 4b9732b64f223aff28f6c70463dd582ce360e22d Mon Sep 17 00:00:00 2001 From: free software <45316884+carlosgonz0@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:31:41 -0500 Subject: [PATCH 25/52] Update harbour-fernschreiber-es.ts (#529) * Update harbour-fernschreiber-es.ts * Update harbour-fernschreiber-es.ts --- translations/harbour-fernschreiber-es.ts | 422 +++++++++++------------ 1 file changed, 211 insertions(+), 211 deletions(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 5bb74ef..06fd254 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -9,7 +9,7 @@ A Telegram client for Sailfish OS - Un cliente de Telegram para Sailfish SO + Cliente de Telegrama para Sailfish SO Send E-Mail @@ -17,7 +17,7 @@ Licensed under GNU GPLv3 - Licenciado bajo GNU GPLv3 + Licencia GNU GPLv3 Sources on GitHub @@ -37,7 +37,7 @@ This project uses the Telegram Database Library (TDLib). Thanks for making it available under the conditions of the Boost Software License 1.0! - Este proyecto usa la librería TDLib de Telegrama. ¡Gracias por estar disponible bajo las condiciones de la licencia software-boost 1.0! + Este proyecto usa librería TDLib de Telegrama. ¡Gracias por estar disponible bajo la licencia software-boost 1.0! Open Telegram Database Library on GitHub @@ -49,7 +49,7 @@ This product uses the Telegram API but is not endorsed or certified by Telegram. - Este programa usa la API de Telegrama, pero no está respaldado ni certificado por Telegrama. + Este programa usa API de Telegrama, pero no está respaldado ni certificado por Telegrama. TDLib version %1 @@ -57,7 +57,7 @@ This project uses twemoji. Copyright 2018 Twitter, Inc. and other contributors. Thanks for making it available under the conditions of the MIT License (coding) and CC-BY 4.0 (graphics)! - Este proyecto usa la librería Twemoji de Tweeter. Derechos de autor 2018 Twitter Inc, y otros colaboradores. ¡Gracias por estar disponible bajo las condiciones de la licencia MIT y CC-BY 4.0 + Este proyecto usa librería Twemoji de Tweeter. Derechos de autor 2018 Twitter Inc, y otros colaboradores. ¡Gracias por estar disponible bajo la licencia MIT y CC-BY 4.0 Open twemoji on GitHub @@ -69,7 +69,7 @@ This project uses rlottie. Copyright 2020 Samsung Electronics Co., Ltd. and other contributors. Thanks for making it available under the conditions of the MIT License! - Este proyecto usa la librería Rlottie de Samsung Electronics Co, y otros colaboradores. ¡Gracias por estar disponible bajo las condiciones de la licencia MIT + Este proyecto usa librería Rlottie de Samsung Electronics Co, y otros colaboradores. ¡Gracias por estar disponible bajo la licencia MIT Open rlottie on GitHub @@ -77,7 +77,7 @@ This project uses OpenStreetMap Nominatim for reverse geocoding of location attachments. Thanks for making it available as web service! - Este proyecto usa la librería OpenStreetMap Nominatim para la codificación geográfica inversa de archivos adjuntos de ubicación. ¡Gracias por estar disponible como servicio web! + Este proyecto usa librería OpenStreetMap Nominatim para la codificación geográfica inversa de archivos adjuntos de ubicación. ¡Gracias por estar disponible como servicio web! Open OSM Nominatim Wiki @@ -157,7 +157,7 @@ The Invite Link has been copied to the clipboard. - El enlace de invitación se ha copiado en el portapapeles. + Enlace invitación se ha copiado a portapapeles. %1, %2 @@ -250,7 +250,7 @@ Group Info - Información + Información Mark all messages as read @@ -258,7 +258,7 @@ No message in this chat. - No hay mensaje aún. + No hay mensaje. Mark chat as unread @@ -355,7 +355,7 @@ You joined the chat %1 - Te uniste al grupo + Unido al grupo Select Messages @@ -405,7 +405,7 @@ This secret chat is not yet ready. Your chat partner needs to go online first. - Esta conversación secreta aún no está lista. El contacto no está conectado. + Esta conversación secreta no está lista. El contacto no está conectado. Closing chat @@ -492,7 +492,7 @@ You don't have any chats yet. - No hay todavía conversaciones. + No hay conversaciones. @@ -510,11 +510,11 @@ Waiting for network... - Esperando la red... + Esperando red... Connecting to network... - Conectando al servidor... + Conectando a servidor... Connecting to proxy... @@ -593,7 +593,7 @@ New members can see older messages member permission - Los miembros nuevos pueden ver mensajes antiguos + Miembros nuevos pueden ver mensajes antiguos @@ -665,29 +665,29 @@ have registered with Telegram myself - se registró en Telegram + registrado a Telegram has registered with Telegram - te has registrado en Telegram + registrado a Telegrama joined this chat myself - se unió al grupo + unido a grupo joined this chat - se unió a este grupo + unido a grupo were added to this chat myself - se añadió a este grupo + unido a grupo was added to this chat - se añadió al grupo + unido a grupo left this chat @@ -715,11 +715,11 @@ changed the chat title myself - el título del grupo se cambió + título del grupo se cambió changed the chat title - el título del grupo se cambió + título del grupo se cambió sent a poll @@ -760,110 +760,110 @@ deleted the chat photo myself - borró la foto de la conversación + borró foto de conversación deleted the chat photo - borró la foto del grupo + borró foto de grupo changed the secret chat TTL setting myself - cambió los ajustes TTL en conversación secreta + cambió ajustes TTL en conversación secreta changed the secret chat TTL setting - cambió los ajustes TTL en conversación secreta + cambió ajustes TTL en conversación secreta upgraded this group to a supergroup myself - actualizó este grupo a un supergrupo + actualizó este grupo a supergrupo changed the pinned message myself - actualizó este grupo a un supergrupo + actualizó este grupo a supergrupo changed the pinned message - cambió el mensaje fijado + cambió mensaje fijado created a screenshot in this chat myself - creó un pantallazo en esta conversación + creó pantallazo a esta conversación created a screenshot in this chat - creó un pantallazo en esta conversación + creó pantallazo a esta conversación sent an unsupported message myself - envió un mensaje no admitido + envió mensaje no admitido sent an unsupported message - envió un mensaje no admitido + envió mensaje no admitido sent an unsupported message: %1 - envió un mensaje no admitido: %1 + envió mensaje no admitido: %1 upgraded this group to a supergroup - actualizó este grupo a un supergrupo + actualizó grupo a supergrupo sent a self-destructing photo that is expired myself - envió una foto autodestructiva que está caducada + envió foto autodestructiva que está caducada sent a self-destructing video that is expired myself - envió una foto autodestructiva que está caducada + envió foto autodestructiva que está caducada sent a self-destructing video that is expired - envió un vídeo autodestructivo que está caducado + envió vídeo autodestructivo que está caducado sent an unsupported message: %1 myself - envió un mensaje no admitido: %1 + envió mensaje no admitido: %1 sent a self-destructing photo that is expired - envió un foto autodestructivo que está caducado + envió foto autodestructivo que está caducado sent an audio myself - envió un audio + envió audio sent an audio - envió un audio + envió audio has added %1 to the chat - ha añadido %1 a la conversación + ha añadido %1 a conversación has removed %1 from the chat - ha quitado %1 de la conversación + ha quitado %1 de conversación have added %1 to the chat myself - ha añadido %1 a la conversación + ha añadido %1 a conversación have removed %1 from the chat myself - ha quitado %1 de la conversación + ha quitado %1 de conversación scored %Ln points @@ -883,20 +883,20 @@ sent a game myself - envió un juego + envió juego sent a game - envió un juego + envió juego sent a video note myself - envió una nota de video + envió nota de video sent a video note - envió una nota de video + envió nota de video @@ -937,11 +937,11 @@ Welcome to Fernschreiber! - Bienvenidos a Fernschreiber + Bienvenidos a Ferni! Please enter your phone number to continue. - Marcar el número telefónico. + Marcar número telefónico. Continue @@ -949,7 +949,7 @@ Please enter the code that you received: - Marcar el código recibido. + Marcar código recibido. Loading... @@ -957,19 +957,19 @@ Unable to authenticate you with the entered code. - No se pudo autenticar con el código marcado. + No se pudo autenticar con código marcado. Enter code again - Marcar código de nuevo + Remarcar código Restart authentication - Reiniciar la autenticación + Reiniciar autenticación Please enter your password: - Por favor, marcar el código: + Por favor, marcar código: Register User @@ -977,15 +977,15 @@ Enter your First Name - Marcar el nombre + Marcar nombre Enter your Last Name - Marcar el apellido + Marcar apellido User Registration - Registro de usuario + Registrar usuario Use the international format, e.g. %1 @@ -1112,14 +1112,14 @@ via %1 message posted via bot user - mensaje publicado a través del usuario Robot + via %1 MessageVoiceNote Voice Note - Nota de voz + Nota de voz @@ -1142,7 +1142,7 @@ End-to-end-encrypted, accessible on this device only - Encriptado fin-a-fin, accesible solo en este dispositivo + Encriptado fin-a-fin, accesible solo a este dispositivo Loading contacts... @@ -1150,7 +1150,7 @@ Transport-encrypted, uses Telegram Cloud, sharable across devices - Transporte-encriptado, usa la nube de Telegram, compartible entre dispositivos + Transporte-encriptado, usa nube de Telegrama, compartible entre dispositivos Search a contact... @@ -1158,11 +1158,11 @@ Synchronize Contacts with Telegram - Sincronizar con Telegram + Sincronizar con Telegrama Contacts successfully synchronized with Telegram. - Contactos sincronizados con éxito con Telegram. + Contactos sincronizados con éxito con Telegrama. No contacts found. @@ -1187,15 +1187,15 @@ Fernschreiber - Fernschreiber + Ferni Waiting for network... - Esperando la red... + Esperando red... Connecting to network... - Conectando al servidor... + Conectando a servidor... Connecting to proxy... @@ -1207,7 +1207,7 @@ Loading chat list... - cargando lista de conversaciones... + cargando lista de conversación... Settings @@ -1215,7 +1215,7 @@ You don't have any chats yet. - No hay todavía conversaciones. + No hay conversaciones. New Chat @@ -1235,11 +1235,11 @@ Download failed. - Error al bajar + Error a bajar Tap on the title bar to filter your chats - Deslizar hacia abajo para la polea de opciones + Deslizar hacia abajo para polea de opciones No matching chats found. @@ -1247,15 +1247,15 @@ You can search public chats or create a new chat via the pull-down menu. - Puede buscar grupos públicos o crear un grupo a través de la polea de opciones. + Puede buscar grupos públicos o crear un grupo a través de polea de opciones. Logging out - Saliendo de la cuenta + Saliendo de cuenta Unable to open link. - No se pudo abrir el enlace. + No se pudo abrir enlace. @@ -1277,11 +1277,11 @@ PollCreationPage All answers have to contain 1-100 characters. - Todas las respuestas deben contener de 1 a 100 caracteres. + Todas respuestas deben contener de 1 a 100 caracteres. To send a quiz, you have to specify the right answer. - Para enviar una cuestión, debe especificar la respuesta correcta. + Para enviar una cuestión, debe especificar respuesta correcta. You have to enter a question. @@ -1293,7 +1293,7 @@ A poll requires 2-10 answers. - Una encuesta requiere de 2 a 10 respuestas. + Encuesta requiere 2 a 10 respuestas. Create a Poll @@ -1307,7 +1307,7 @@ Enter your question here - Hacer la pregunta + Hacer pregunta Question (%Ln characters left) @@ -1323,7 +1323,7 @@ Enter an answer here - Hacer la respuesta + Hacer respuesta Answer (%Ln characters left) @@ -1334,7 +1334,7 @@ Add an answer - Agregar una respuesta + Agregar respuesta Poll Options @@ -1355,30 +1355,30 @@ Quizzes have one correct answer. Participants can't revoke their responses. - Los interrogatorios tienen una respuesta correcta. Los participantes no pueden revocar sus respuestas. + Cuestionarios tienen respuesta correcta. Participantes no pueden revocar las respuestas. Enter an optional explanation - Introducir una explicación opcional + Introducir explicación opcional Shown when the user selects a wrong answer. - Se muestra cuando la usuario selecciona una respuesta incorrecta. + Muestra cuando usuario selecciona respuesta incorrecta. An explanation can be up to 200 characters long. - Una explicación puede tener hasta 200 caracteres. + Explicación debe hasta 200 caracteres. PollResultsPage Quiz Results - Resultados de cuestionario + Resultados cuestionario Poll Results - Resultados de encuesta + Resultados encuesta %Ln vote(s) total @@ -1432,7 +1432,7 @@ SearchChatsPage No chats found. - No se han encontrado grupos. + No se encontrado grupos. Searching chats... @@ -1474,7 +1474,7 @@ Enter your query to start searching (at least 5 characters needed) - Para iniciar la búsqueda se necesitan al menos 5 caracteres + Iniciar búsqueda con al menos 5 caracteres @@ -1489,7 +1489,7 @@ Only display emojis instead of the actual stickers - Solo muestra los emoticonos en lugar de las pegatinas reales + Muestra emoticonos en lugar de pegatinas reales Show stickers as images @@ -1497,7 +1497,7 @@ Show background for stickers and align them centrally like images - Muestra un fondo para pegatinas y las alinea como imágenes + Muestra un fondo para pegatinas y alinea como imágenes Animate stickers @@ -1512,19 +1512,19 @@ Send message by enter - Enviar mensaje por tecla Entrar + Enviar mensaje tecla Entrar Send your message by pressing the enter key - Envía el mensajes pulsando la tecla Entrar + Envía mensajes pulsando tecla Entrar Focus text input on chat open - Enfocar entrada de texto en conversación + Enfocar entrada de texto a conversación Focus the text input area when entering a chat - Enfoca el área de entrada de texto al ingresar a una conversación + Enfoca área de entrada de texto al ingresar a conversación Focus text input area after send @@ -1532,7 +1532,7 @@ Focus the text input area after sending a message - Enfoca el área de entrada de texto después de enviar un mensaje + Enfoca área de entrada de texto después de enviar mensaje Delay before marking messages as read @@ -1540,15 +1540,15 @@ Fernschreiber will wait a bit before messages are marked as read - Si esta habilitado, la apl espera un segundo hasta que un mensaje que está en la pantalla se marque como leído. Si deshabilitas esta función, los mensajes se marcarán inmediatamente como leído una vez que esté en la pantalla sin desplazarse al mensaje + Si esta habilitado, apl espera un segundo hasta que mensaje que está en pantalla se marque como leído. Si deshabilita esta función, mensajes se marcarán inmediatamente como leído una vez que esté en pantalla sin desplazarse a mensaje Open-with menu integration - Integrar la opción Abrir-con + Integrar opción Abrir-Con Integrate Fernschreiber into open-with menu of Sailfish OS - Fernschreiber usa la opción abrir-con de Sailfish SO + Ferni usa opción Abrir-Con de Sailfish SO Notification feedback @@ -1556,7 +1556,7 @@ Use non-graphical feedback (sound, vibration) for notifications - Usa comentarios no gráficos (sonido, vibración) para las notificaciones + Usa comentarios no gráficos (sonido, vibración) para notificaciones All events @@ -1576,31 +1576,31 @@ Enable notification sounds - Habilitar sonidos de notificación + Habilitar sonidos notificación When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. - Cuando los sonidos están habilitados, Fernschreiber utilizará el sonido de notificación actual de Sailfish OS para los grupos, que se puede configurar en la configuración del sistema. + Cuando sonidos están habilitados, Ferni utilizará sonido de notificación actual de Sailfish OS para los grupos, que se puede ajustar a configuración del sistema. Always append message preview to notifications - + Agregar vista previa mensaje a notificaciones In addition to showing the number of unread messages, the latest message will also be appended to notifications. - + Mostrará cantidad mensajes no leídos, el último mensaje se agregará a notificaciones. Highlight unread messages - + Resaltar mensajes no leídos Highlight Conversations with unread messages - + Resaltar conversaciones a mensajes no leídos Hide content in notifications - + Ocultar contenido a notificaciones @@ -1622,7 +1622,7 @@ Privacy setting for managing whether you can be invited to chats. - Configuración de privacidad para administrar si puede ser invitado a grupos. + Ajustes de privacidad administrar si puede ser invitado a grupos. Yes @@ -1642,15 +1642,15 @@ Privacy setting for managing whether you can be found by your phone number. - Configuración de privacidad para administrar si puede ser encontrado por su número de teléfono. + Ajustes de privacidad administrar si puede ser encontrado por su número de teléfono. Show link in forwarded messages - Mostrar enlace en mensajes reenviados + Mostrar enlace a mensajes reenviados Privacy setting for managing whether a link to your account is included in forwarded messages. - Configuración de privacidad para administrar si un enlace de la cuenta está incluido en los mensajes reenviados. + Ajustes de privacidad administrar si un enlace de cuenta está incluido en mensajes reenviados. Show phone number @@ -1658,7 +1658,7 @@ Privacy setting for managing whether your phone number is visible. - Configuración de privacidad para administrar si su número de teléfono es visible. + Ajustes de privacidad administrar si su número de teléfono es visible. Show profile photo @@ -1666,7 +1666,7 @@ Privacy setting for managing whether your profile photo is visible. - Configuración de privacidad para administrar si la foto de perfil es visible. + Ajustes de privacidad administrar si la foto de perfil es visible. Show status @@ -1674,7 +1674,7 @@ Privacy setting for managing whether your online status is visible. - Configuración de privacidad para administrar si el estado en línea es visible. + Ajustes de privacidad administrar si el estado en línea es visible. Allow sending Location to inline bots @@ -1693,7 +1693,7 @@ Session was terminated - Se terminó la sesión + Se terminó sesión Terminating session @@ -1720,31 +1720,31 @@ 1 week - + 1 semana 1 month - + 1 mes 3 months - + 3 meses 6 months - + 6 meses 1 year - + 1 año Session Timeout - + Sesión caducada Inactive sessions will be terminated after this timeframe - + Sesiones inactivas finalizarán después de período de tiempo. @@ -1755,11 +1755,11 @@ Enable online-only mode - Modo solo en línea + Modo solo enlínea Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. - Deshabilita el almacenamiento en caché sin conexión. Algunas funciones pueden estar limitadas o ausentes en este modo. Se requiere reiniciar Fernschreiber para su efecto. + Deshabilita almacenamiento en caché sin conexión. Algunas funciones pueden estar limitadas o ausentes en este modo. Se requiere reiniciar Ferni para efecto. Enable storage optimizer @@ -1770,7 +1770,7 @@ SettingsUserProfile User Profile - Perfil de usuario + Perfil usuario First Name @@ -1797,7 +1797,7 @@ Profile Pictures - Imagen de perfil + Imagen perfil Add Picture @@ -1809,7 +1809,7 @@ Deleting profile picture - Borrando la imagen de perfil + Borrando imagen perfil Uploading... @@ -1825,30 +1825,30 @@ Phone number: +%1 - + Número telefónico: +%1 Contacts successfully synchronized with Telegram. - Contactos sincronizados con éxito con Telegram. + Contactos sincronizados con éxito Telegrama. Synchronize Contacts with Telegram - Sincronizar con Telegram + Sincronizar Telegram SponsoredMessage Go to Channel - Ir al canal + Ir a canal Go to Message - Ir al mensaje + Ir a mensaje Start Bot - Iniciar Robot(Bot) + Iniciar Robot @@ -1859,37 +1859,37 @@ Removing sticker set - Quitando el álbum de pegatinas + Quitando álbum pegatinas Sticker set successfully removed! - ¡Album de pegatinas quitado correctamente! + ¡Album pegatinas quitado correctamente! StickerSetOverlay Sticker set successfully installed! - ¡Album de pegatinas instalado correctamente! + ¡Album pegatinas instalado correctamente! Sticker set successfully removed! - ¡Album de pegatinas quitado correctamente! + ¡Album pegatinas quitado correctamente! VideoPage Download of %1 successful. - Bajada de %1 exitosa. + Bajada %1 exitosa. Download failed. - Error al bajar + Error a bajar Copy video to gallery - Copiar video a la galería + Copiar video a galería @@ -1900,7 +1900,7 @@ Press the button to start recording - Presionar el botón para iniciar a grabar + Presionar botón para grabar Unavailable @@ -1935,7 +1935,7 @@ WebPagePreview Preview not supported for this link... - Vista previa no compatible con este enlace ... + Vista previa compatible con enlace ... @@ -1946,7 +1946,7 @@ has registered with Telegram - te has registrado en Telegram + Registrado a Telegrama Picture: %1 @@ -1970,43 +1970,43 @@ sent a picture - envió una imagen + envió imagen sent a video - envió un video + envió video sent an animation - envió una animación + envió animación sent an audio - envió un audio + envió audio sent a voice note - envió una nota de voz + envió nota de voz sent a document - envió un documento + envió documento sent a location - envió una ubicación + envió ubicación joined this chat - se unió a este grupo + Unido a grupo was added to this chat - se añadió a este grupo + Unido a grupo left this chat - dejó este grupo + dejó grupo %1M @@ -2018,61 +2018,61 @@ sent a venue - envió un lugar + envió lugar sent a picture myself - envió una imagen + envió imagen sent a video myself - envié un video + envié video sent an animation myself - envió una animación + envió animación sent an audio myself - envió un audio + envió audio sent a voice note myself - envió una nota de voz + envió nota de voz sent a document myself - envió un documento + envió documento sent a location myself - envió una ubicación + envió ubicación sent a venue myself - envió un lugar + envió lugar have registered with Telegram - se ha registrado en Telegram + registrado a Telegrama joined this chat myself - me uní a este grupo + unido a grupo were added to this chat myself - se agregó a esta grupo + unido a grupo left this chat @@ -2097,7 +2097,7 @@ online - en línea + enlínea was recently online @@ -2126,47 +2126,47 @@ changed the chat title to %1 myself - se cambió el título del grupo a %1 + cambió título de grupo a %1 changed the chat title to %1 - se cambió el título del grupo a %1 + cambió título de grupo a %1 sent a poll myself - envió una encuesta + envió encuesta sent a poll - envió una encuesta + envió encuesta sent an anonymous quiz myself - envió un cuestionario anónimo + envió cuestionario anónimo sent an anonymous quiz - envió un cuestionario anónimo + envió cuestionario anónimo sent a quiz myself - envió un cuestionario + envió cuestionario sent a quiz - envió un cuestionario + envió cuestionario sent an anonymous poll myself - envió una encuesta anónima + envió encuesta anónima sent an anonymous poll - envió una encuesta anónima + envió encuesta anónima Anonymous Quiz @@ -2187,120 +2187,120 @@ created this group myself - creó este grupo + creó grupo created this group - creó este grupo + creó grupo changed the chat photo myself - cambió la foto del grupo + cambió foto de grupo changed the chat photo - cambió la foto del grupo + cambió foto de grupo deleted the chat photo myself - borró la foto del grupo + borró foto de grupo deleted the chat photo - borró la foto del grupo + borró foto de grupo changed the secret chat TTL setting myself; TTL = Time To Live - cambió los ajustes de TTL de la conversación secreta + cambió ajustes de TTL de conversación secreta changed the secret chat TTL setting TTL = Time To Live - cambió los ajustes de TTL de la conversación secreta + cambió ajustes de TTL de conversación secreta upgraded this group to a supergroup myself - actualizó este grupo a un supergrupo + actualizó grupo a supergrupo changed the pinned message myself - cambió el mensaje fijado + cambió mensaje fijado changed the pinned message - cambió el mensaje fijado + cambió mensaje fijado created a screenshot in this chat myself - creó un pantallazo a esta conversación + creó pantallazo a conversación created a screenshot in this chat - creó un pantallazo a esta conversación + creó pantallazo a conversación sent an unsupported message myself - envió un mensaje no admitido + envió mensaje no admitido sent an unsupported message - envió un mensaje no admitido + envió mensaje no admitido sent an unsupported message: %1 myself; %1 is message type - envió un mensaje no admitido: %1 + envió mensaje no admitido: %1 sent an unsupported message: %1 %1 is message type - envió un mensaje no admitido: %1 + envió mensaje no admitido: %1 upgraded this group to a supergroup - actualizó este grupo a un supergrupo + actualizó grupo a supergrupo sent a self-destructing photo that is expired myself - envió una foto autodestructiva que está caducada + envió foto autodestructiva que está caducada sent a self-destructing photo that is expired - envió una foto autodestructiva que está caducada + envió foto autodestructiva que está caducada sent a self-destructing video that is expired myself - envió un vídeo autodestructivo que está caducado + envió vídeo autodestructivo que está caducado sent a self-destructing video that is expired - envió un vídeo autodestructivo que está caducado + envió vídeo autodestructivo que está caducado Unable to find user %1 - Error al buscar %1 + Error buscar %1 sent a video note myself - envió una nota de video + envió nota de video sent a video note - envió una nota de video + envió nota de video You are already a member of this chat. - Ya eres miembro de este grupo. + Ya miembro de grupo. Closed! @@ -2312,21 +2312,21 @@ has added %1 to the chat - ha añadido %1 al grupo + ha añadido %1 a grupo has removed %1 from the chat - ha quitado %1 del grupo + quitado %1 de grupo have added %1 to the chat myself - ha añadido %1 al grupo + agregado %1 a grupo have removed %1 from the chat myself - ha añadido %1 del grupo + agregado %1 de grupo scored %Ln points @@ -2339,11 +2339,11 @@ sent a game myself - envió un juego + envió juego sent a game - envió un juego + envió juego From 256514e55d72f0cddc926b7c3e504cc4f9d40f72 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Tue, 21 Nov 2023 22:34:10 +0200 Subject: [PATCH 26/52] Added "unread mention" indicator to the chat list (#530) It's displayed in place of the "unread reaction" indicator. In case if there are both unread mentions and reactions, "unread mention" takes precedence. --- qml/components/PhotoTextsListItem.qml | 33 ++++++++++++++++++--------- src/tdlibreceiver.cpp | 3 +++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 959fdd5..344e25e 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -108,27 +108,38 @@ ListItem { } Rectangle { - id: chatUnreadReactionCountBackground color: isMuted ? ((Theme.colorScheme === Theme.DarkOnLight) ? "lightgray" : "dimgray") : Theme.highlightBackgroundColor width: Theme.fontSizeLarge height: Theme.fontSizeLarge anchors.right: parent.right anchors.top: parent.top radius: parent.width / 2 - visible: chatListViewItem.unreadReactionCount > 0 - } + visible: chatListViewItem.unreadReactionCount > 0 || chatListViewItem.unreadMentionCount > 0 - Icon { - source: "image://theme/icon-s-favorite" - height: Theme.iconSizeExtraSmall - width: Theme.iconSizeExtraSmall - highlighted: chatListViewItem.highlighted - anchors.centerIn: chatUnreadReactionCountBackground - visible: chatListViewItem.unreadReactionCount > 0 - } + Icon { + source: "image://theme/icon-s-favorite" + height: Theme.iconSizeExtraSmall + width: Theme.iconSizeExtraSmall + highlighted: chatListViewItem.highlighted + anchors.centerIn: parent + visible: chatListViewItem.unreadReactionCount > 0 && !chatListViewItem.unreadMentionCount + } + Text { + font { + pixelSize: Theme.iconSizeExtraSmall + bold: true + } + color: Theme.primaryColor + anchors.centerIn: parent + visible: chatListViewItem.unreadMentionCount > 0 + opacity: isMuted ? Theme.opacityHigh : 1.0 + text: "@" + } + } } } + Column { id: contentColumn anchors { diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index 8f65952..abd9d03 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -175,6 +175,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("updateMessageInteractionInfo", &TDLibReceiver::processUpdateMessageInteractionInfo); handlers.insert("sessions", &TDLibReceiver::processSessions); handlers.insert("availableReactions", &TDLibReceiver::processAvailableReactions); + handlers.insert("updateMessageMentionRead", &TDLibReceiver::processUpdateChatUnreadMentionCount); handlers.insert("updateChatUnreadMentionCount", &TDLibReceiver::processUpdateChatUnreadMentionCount); handlers.insert("updateChatUnreadReactionCount", &TDLibReceiver::processUpdateChatUnreadReactionCount); handlers.insert("updateActiveEmojiReactions", &TDLibReceiver::processUpdateActiveEmojiReactions); @@ -736,6 +737,8 @@ void TDLibReceiver::processAvailableReactions(const QVariantMap &receivedInforma void TDLibReceiver::processUpdateChatUnreadMentionCount(const QVariantMap &receivedInformation) { + // Handles both updateMessageMentionRead and updateChatUnreadMentionCount + // They both have chat_id and unread_mention_count which is all we need const qlonglong chatId = receivedInformation.value(CHAT_ID).toLongLong(); const int unreadMentionCount = receivedInformation.value(UNREAD_MENTION_COUNT).toInt(); LOG("Chat unread mention count updated" << chatId << unreadMentionCount); From 02b6dd2e6df38b77085832a3ce41014eaf5e87ef Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 21 Nov 2023 21:55:08 +0100 Subject: [PATCH 27/52] Show reactions on double-click --- qml/components/MessageListViewItem.qml | 20 ++++++++++++-------- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 2ac1e87..fd73114 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -132,18 +132,22 @@ ListItem { if (messageListItem.messageReactions) { messageListItem.messageReactions = null; - } else 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); } } } + onDoubleClicked: { + 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); + } + } + onPressAndHold: { if (openMenuOnPressAndHold) { openContextMenu() diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 568b883..247c3bc 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 4 +Release: 5 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index c8cc6b0..0e87ef4 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 4 +Release: 5 # 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 From 16bcef3c784a70e1683e84ba8b0e6e8849297ff2 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 22 Nov 2023 22:53:17 +0100 Subject: [PATCH 28/52] Interaction hint for new reactions behavior --- qml/pages/ChatPage.qml | 36 +++++++++++++++++++++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/appsettings.cpp | 15 +++++++++ src/appsettings.h | 5 +++ translations/harbour-fernschreiber-de.ts | 4 +++ translations/harbour-fernschreiber-en.ts | 4 +++ translations/harbour-fernschreiber-es.ts | 4 +++ translations/harbour-fernschreiber-fi.ts | 4 +++ translations/harbour-fernschreiber-fr.ts | 4 +++ translations/harbour-fernschreiber-hu.ts | 4 +++ translations/harbour-fernschreiber-it.ts | 4 +++ translations/harbour-fernschreiber-pl.ts | 4 +++ translations/harbour-fernschreiber-ru.ts | 4 +++ translations/harbour-fernschreiber-sk.ts | 4 +++ translations/harbour-fernschreiber-sv.ts | 4 +++ translations/harbour-fernschreiber-zh_CN.ts | 4 +++ translations/harbour-fernschreiber.ts | 4 +++ 18 files changed, 110 insertions(+), 2 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index c98c263..23f0da0 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -609,6 +609,15 @@ Page { chatViewCooldownTimer.restart(); chatViewStartupReadTimer.restart(); + + var remainingDoubleTapHints = appSettings.remainingDoubleTapHints; + Debug.log("Remaining double tap hints: " + remainingDoubleTapHints); + if (remainingDoubleTapHints > 0) { + doubleTapHintTimer.start(); + tapHint.visible = true; + tapHintLabel.visible = true; + appSettings.remainingDoubleTapHints = remainingDoubleTapHints - 1; + } } onNewMessageReceived: { if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender_id.user_id === chatPage.myUserId) { @@ -2157,4 +2166,31 @@ Page { } } } + + Timer { + id: doubleTapHintTimer + running: true + triggeredOnStart: false + repeat: false + interval: 6000 + onTriggered: { + tapHint.visible = false; + tapHintLabel.visible = false; + } + } + + TapInteractionHint { + id: tapHint + loops: Animation.Infinite + taps: 2 + anchors.centerIn: parent + visible: false + } + + InteractionHintLabel { + id: tapHintLabel + anchors.bottom: parent.bottom + text: qsTr("Double-tap on a message to choose a reaction") + visible: false + } } diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 247c3bc..c642703 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 5 +Release: 6 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 0e87ef4..e4c228f 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 5 +Release: 6 # 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 diff --git a/src/appsettings.cpp b/src/appsettings.cpp index efd5b33..d63537a 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -35,6 +35,7 @@ namespace { const QString KEY_STORAGE_OPTIMIZER("useStorageOptimizer"); const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess"); const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); + const QString KEY_REMAINING_DOUBLE_TAP_HINTS("remainingDoubleTapHints"); const QString KEY_ONLINE_ONLY_MODE("onlineOnlyMode"); const QString KEY_DELAY_MESSAGE_READ("delayMessageRead"); const QString KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN("focusTextAreaOnChatOpen"); @@ -243,6 +244,20 @@ void AppSettings::setRemainingInteractionHints(int remainingHints) } } +int AppSettings::remainingDoubleTapHints() const +{ + return settings.value(KEY_REMAINING_DOUBLE_TAP_HINTS, 3).toInt(); +} + +void AppSettings::setRemainingDoubleTapHints(int remainingHints) +{ + if (remainingDoubleTapHints() != remainingHints) { + LOG(KEY_REMAINING_DOUBLE_TAP_HINTS << remainingHints); + settings.setValue(KEY_REMAINING_DOUBLE_TAP_HINTS, remainingHints); + emit remainingDoubleTapHintsChanged(); + } +} + bool AppSettings::onlineOnlyMode() const { return settings.value(KEY_ONLINE_ONLY_MODE, false).toBool(); diff --git a/src/appsettings.h b/src/appsettings.h index e4a1a2d..84e59d9 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -38,6 +38,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) Q_PROPERTY(bool allowInlineBotLocationAccess READ allowInlineBotLocationAccess WRITE setAllowInlineBotLocationAccess NOTIFY allowInlineBotLocationAccessChanged) Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) + Q_PROPERTY(int remainingDoubleTapHints READ remainingDoubleTapHints WRITE setRemainingDoubleTapHints NOTIFY remainingDoubleTapHintsChanged) Q_PROPERTY(bool onlineOnlyMode READ onlineOnlyMode WRITE setOnlineOnlyMode NOTIFY onlineOnlyModeChanged) Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged) Q_PROPERTY(bool focusTextAreaOnChatOpen READ getFocusTextAreaOnChatOpen WRITE setFocusTextAreaOnChatOpen NOTIFY focusTextAreaOnChatOpenChanged) @@ -104,6 +105,9 @@ public: int remainingInteractionHints() const; void setRemainingInteractionHints(int remainingHints); + int remainingDoubleTapHints() const; + void setRemainingDoubleTapHints(int remainingHints); + bool onlineOnlyMode() const; void setOnlineOnlyMode(bool enable); @@ -134,6 +138,7 @@ signals: void storageOptimizerChanged(); void allowInlineBotLocationAccessChanged(); void remainingInteractionHintsChanged(); + void remainingDoubleTapHintsChanged(); void onlineOnlyModeChanged(); void delayMessageReadChanged(); void focusTextAreaOnChatOpenChanged(); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index d0eac2d..c608557 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -483,6 +483,10 @@ Deleted User Gelöschtes Konto + + Double-tap on a message to choose a reaction + Drücke zweimal auf eine Nachricht, um eine Reaktion auszuwählen + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 4008317..3a0b0be 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -483,6 +483,10 @@ Deleted User Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 06fd254..6b87cf8 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -483,6 +483,10 @@ Deleted User Usuario borrado + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index d0b22c8..7d08abb 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -483,6 +483,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index 96f7e9b..a1c44e4 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -483,6 +483,10 @@ Deleted User Supprimer l'utilisateur + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 796c1c3..adcf023 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -473,6 +473,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 48e863e..0ff0bfa 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -483,6 +483,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index b16825d..436cd14 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -493,6 +493,10 @@ Deleted User Usunięty użytkownik + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 09982cd..9006ca3 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -493,6 +493,10 @@ Deleted User Удалённый пользователь + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index d4b14cf..df7ec3a 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -493,6 +493,10 @@ Deleted User Odstránený používateľ + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index d00eb6d..92078c6 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -483,6 +483,10 @@ Deleted User Tog bort användare + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 88727e2..c904169 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -473,6 +473,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index cc90573..d816a18 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -483,6 +483,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage From bada6fb3e25195b68c0f249ed50ee050ec694fee Mon Sep 17 00:00:00 2001 From: free software <45316884+carlosgonz0@users.noreply.github.com> Date: Fri, 24 Nov 2023 17:11:41 -0500 Subject: [PATCH 29/52] Update harbour-fernschreiber-es.ts (#531) --- translations/harbour-fernschreiber-es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 6b87cf8..3ea5669 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -485,7 +485,7 @@ Double-tap on a message to choose a reaction - + Pulsar doble a mensaje y elegir reacción From 2ae4e2eb057b1646bf4da77b376b0f40e8f2c66e Mon Sep 17 00:00:00 2001 From: Patrick Hervieux <5952038+pherjung@users.noreply.github.com> Date: Fri, 24 Nov 2023 23:13:18 +0100 Subject: [PATCH 30/52] Update French translation (#532) Co-authored-by: Patrick Hervieux --- translations/harbour-fernschreiber-fr.ts | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index a1c44e4..0c5097e 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -1,6 +1,6 @@ - + AboutPage @@ -485,7 +485,7 @@ Double-tap on a message to choose a reaction - + Toucher deux fois sur un message pour réagir @@ -1170,7 +1170,7 @@ No contacts found. - + Aucun contact trouvé @@ -1588,23 +1588,23 @@ Always append message preview to notifications - + Toujours visualiser le message dans les notifications In addition to showing the number of unread messages, the latest message will also be appended to notifications. - + En plus d'afficher le nombre de messages non-lus, le dernier message sera également ajouté aux notifications. Highlight unread messages - + Mettre en valeur les messages non-lus Highlight Conversations with unread messages - + Mettre en valeur les conversations avec des messages non-lus Hide content in notifications - + Masquer le contenu dans les notifications @@ -1717,38 +1717,38 @@ %1 day(s) - - + + %1 jour(s) 1 week - + 1 semaine 1 month - + 1 mois 3 months - + 3 mois 6 months - + 6 mois 1 year - + 1 année Session Timeout - + Délai d'inactivité de session Inactive sessions will be terminated after this timeframe - + Sessions inactives seront terminées après ce délai From 84594e4c2c0e90f99e523eaea6f694b37e58bd65 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 26 Nov 2023 19:05:51 +0200 Subject: [PATCH 31/52] Allow to remove a reaction (#536) --- qml/components/MessageListViewItem.qml | 19 ++++++++++++++--- src/tdlibwrapper.cpp | 29 ++++++++++++++++++++++++-- src/tdlibwrapper.h | 3 ++- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index fd73114..6065842 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -705,12 +705,25 @@ ListItem { MouseArea { anchors.fill: parent onClicked: { - tdLibWrapper.setMessageReaction(messageListItem.chatId, messageListItem.messageId, modelData); - messageListItem.messageReactions = null; + for (var i = 0; i < reactions.length; i++) { + 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 } } } - } } } diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index f815ccf..e082592 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -1462,9 +1462,8 @@ void TDLibWrapper::getPageSource(const QString &address) 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; requestObject.insert(CHAT_ID, chatId); requestObject.insert(MESSAGE_ID, messageId); @@ -1479,9 +1478,35 @@ void TDLibWrapper::setMessageReaction(qlonglong chatId, qlonglong messageId, con reactionType.insert(EMOJI, reaction); requestObject.insert(REACTION_TYPE, reactionType); requestObject.insert(_TYPE, "addMessageReaction"); + LOG("Add message reaction" << chatId << messageId << reaction); } else { requestObject.insert("reaction", reaction); 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); } diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 17a0896..49cda61 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -249,7 +249,8 @@ public: Q_INVOKABLE void terminateSession(const QString &sessionId); Q_INVOKABLE void getMessageAvailableReactions(qlonglong chatId, qlonglong messageId); 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 setInactiveSessionTtl(int days); From 57017e8bff0c8a77d92b61adf37c7b829186fea5 Mon Sep 17 00:00:00 2001 From: Peter G Date: Sun, 26 Nov 2023 19:12:47 +0000 Subject: [PATCH 32/52] [Trivial]: Don't own bindir (#534) * [Trivial]: Don't own bindir This may seem like nitpicking, but the package should not own /usr/bin * Update rpm/harbour-fernschreiber.spec Co-authored-by: Sebastian Wolf --------- Co-authored-by: nephros Co-authored-by: Sebastian Wolf --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index c642703..6d8bef5 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -69,7 +69,7 @@ desktop-file-install --delete-original \ %files %defattr(-,root,root,-) -%{_bindir} +%{_bindir}/%{name} %{_datadir}/%{name} %{_datadir}/applications/%{name}.desktop %{_datadir}/icons/hicolor/*/apps/%{name}.png diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index e4c228f..04890d5 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -46,7 +46,7 @@ Requires: # All installed files Files: - - '%{_bindir}' + - '%{_bindir}/*' - '%{_datadir}/%{name}' - '%{_datadir}/applications/%{name}.desktop' - '%{_datadir}/icons/hicolor/*/apps/%{name}.png' From 98f067cda8d03df29cb7639410b95a651f805ce6 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 26 Nov 2023 20:36:30 +0100 Subject: [PATCH 33/52] Tweak reactions again... --- qml/components/MessageListViewItem.qml | 59 ++++++++++++++++++-------- qml/pages/ChatPage.qml | 4 ++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 4 +- 4 files changed, 49 insertions(+), 20 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 6065842..737a26d 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -132,22 +132,13 @@ ListItem { if (messageListItem.messageReactions) { messageListItem.messageReactions = null; + selectReactionBubble.visible = false; + } else { + selectReactionBubble.visible = !selectReactionBubble.visible; } } } - onDoubleClicked: { - 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); - } - } - onPressAndHold: { if (openMenuOnPressAndHold) { openContextMenu() @@ -658,6 +649,39 @@ ListItem { } + Rectangle { + id: selectReactionBubble + visible: false + anchors { + horizontalCenter: messageListItem.isOwnMessage ? messageBackground.left : messageBackground.right + verticalCenter: messageBackground.verticalCenter + } + height: Theme.itemSizeExtraSmall + width: Theme.itemSizeExtraSmall + color: Theme.primaryColor + radius: parent.width / 2 + opacity: 0.5 + } + + IconButton { + id: selectReactionButton + visible: selectReactionBubble.visible + 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; + } + } + } } @@ -666,7 +690,7 @@ ListItem { id: reactionsColumn width: parent.width - ( 2 * Theme.horizontalPageMargin ) anchors.top: messageTextRow.bottom - anchors.topMargin: Theme.paddingSmall + anchors.topMargin: Theme.paddingMedium anchors.horizontalCenter: parent.horizontalCenter visible: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? true : false ) : false opacity: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? 1 : 0 ) : 0 @@ -675,7 +699,7 @@ ListItem { Flickable { width: parent.width - height: reactionsResultRow.height + Theme.paddingSmall + height: reactionsResultRow.height + 2 * Theme.paddingMedium anchors.horizontalCenter: parent.horizontalCenter contentWidth: reactionsResultRow.width clip: true @@ -691,13 +715,13 @@ ListItem { Row { id: singleReactionRow - spacing: Theme.paddingSmall + spacing: Theme.paddingMedium Image { id: emojiPicture source: Emoji.getEmojiPath(modelData) - width: status === Image.Ready ? Theme.fontSizeLarge : 0 - height: Theme.fontSizeLarge + width: status === Image.Ready ? Theme.fontSizeExtraLarge : 0 + height: Theme.fontSizeExtraLarge } } @@ -721,6 +745,7 @@ ListItem { // Reaction is not yet selected tdLibWrapper.addMessageReaction(chatId, messageId, modelData) messageReactions = null + selectReactionBubble.visible = false } } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 23f0da0..c70e454 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -610,6 +610,8 @@ Page { chatViewCooldownTimer.restart(); chatViewStartupReadTimer.restart(); + /* + // Double-tap for reactions is currently disabled, let's see if we'll ever need it again var remainingDoubleTapHints = appSettings.remainingDoubleTapHints; Debug.log("Remaining double tap hints: " + remainingDoubleTapHints); if (remainingDoubleTapHints > 0) { @@ -618,6 +620,8 @@ Page { tapHintLabel.visible = true; appSettings.remainingDoubleTapHints = remainingDoubleTapHints - 1; } + */ + } onNewMessageReceived: { if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender_id.user_id === chatPage.myUserId) { diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 6d8bef5..e114f17 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 6 +Release: 7 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 04890d5..4f49d27 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 6 +Release: 7 # 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 @@ -46,7 +46,7 @@ Requires: # All installed files Files: - - '%{_bindir}/*' + - '%{_bindir}/%{name}' - '%{_datadir}/%{name}' - '%{_datadir}/applications/%{name}.desktop' - '%{_datadir}/icons/hicolor/*/apps/%{name}.png' From 24edb173471a9007ef930a42b496c9b8e53167ee Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 26 Nov 2023 20:53:09 +0100 Subject: [PATCH 34/52] Animate new reaction button --- qml/components/MessageListViewItem.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 737a26d..c174da2 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -652,6 +652,8 @@ ListItem { Rectangle { id: selectReactionBubble visible: false + opacity: visible ? 0.5 : 0.0 + Behavior on opacity { NumberAnimation {} } anchors { horizontalCenter: messageListItem.isOwnMessage ? messageBackground.left : messageBackground.right verticalCenter: messageBackground.verticalCenter @@ -660,12 +662,13 @@ ListItem { width: Theme.itemSizeExtraSmall color: Theme.primaryColor radius: parent.width / 2 - opacity: 0.5 } IconButton { id: selectReactionButton visible: selectReactionBubble.visible + opacity: visible ? 1.0 : 0.0 + Behavior on opacity { NumberAnimation {} } icon.source: "image://theme/icon-s-favorite" anchors.centerIn: selectReactionBubble onClicked: { From 61faf0f4079e3c8f089052f33edc8eb7e5e3125a Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 26 Nov 2023 23:36:29 +0100 Subject: [PATCH 35/52] More tweaks for reactions --- qml/components/MessageListViewItem.qml | 43 +++++++++++++++++++------- qml/pages/ChatPage.qml | 3 ++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/tdlibwrapper.cpp | 1 + src/tdlibwrapper.h | 1 + 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index c174da2..98a5c32 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -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(); } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index c70e454..48d741b 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -576,6 +576,9 @@ Page { onSponsoredMessageReceived: { chatPage.containsSponsoredMessages = true; } + onReactionsUpdated: { + availableReactions = tdLibWrapper.getChatReactions(chatInformation.id); + } } Connections { diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index e114f17..e074a21 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -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/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 4f49d27..05f2fd4 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -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 diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index e082592..6b3e994 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -2093,6 +2093,7 @@ void TDLibWrapper::handleActiveEmojiReactionsUpdated(const QStringList& emojis) if (activeEmojiReactions != emojis) { activeEmojiReactions = emojis; LOG(emojis.count() << "reaction(s) available"); + emit reactionsUpdated(); } } diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 49cda61..c4773e3 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -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); From 8258867407315ed3e5a7da22ec0f9e7238fa3ecf Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 27 Nov 2023 21:29:43 +0100 Subject: [PATCH 36/52] Open URLs without prefix --- qml/js/functions.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qml/js/functions.js b/qml/js/functions.js index 7299b0d..b2e2ca7 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -448,7 +448,12 @@ function handleLink(link) { } else if (link.indexOf(tMePrefixHttp) === 0) { handleTMeLink(link, tMePrefixHttp); } else { - Qt.openUrlExternally(link); + Debug.log("Trying to open URL externally: " + link) + if (link.indexOf("://") === -1) { + Qt.openUrlExternally("https://" + link) + } else { + Qt.openUrlExternally(link); + } } } } From 80ecf50e743bd09f2649bdca5aa0af28885a9f28 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 29 Nov 2023 23:47:59 +0100 Subject: [PATCH 37/52] Only one star per list, restore users in poll results --- qml/components/MessageListViewItem.qml | 21 ++++++++++++++++++--- qml/pages/ChatPage.qml | 5 +++++ qml/pages/PollResultsPage.qml | 7 ++++--- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/tdlibreceiver.cpp | 7 +++++++ src/tdlibreceiver.h | 4 +++- src/tdlibwrapper.cpp | 1 + src/tdlibwrapper.h | 1 + 9 files changed, 41 insertions(+), 9 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 98a5c32..8de7e7c 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -147,9 +147,8 @@ ListItem { messageListItem.messageReactions = null; selectReactionBubble.visible = false; } else { - if (messageListItem.chatReactions) { - selectReactionBubble.visible = !selectReactionBubble.visible; - } + selectReactionBubble.visible = !selectReactionBubble.visible; + elementSelected(index); } } } @@ -181,6 +180,19 @@ ListItem { } } + Connections { + target: chatPage + onResetElements: { + messageListItem.messageReactions = null; + selectReactionBubble.visible = false; + } + onElementSelected: { + if (elementIndex !== index) { + selectReactionBubble.visible = false; + } + } + } + Loader { id: contextMenuLoader active: false @@ -285,6 +297,9 @@ ListItem { messageListItem.messageReactions = null; } } + onReactionsUpdated: { + chatReactions = tdLibWrapper.getChatReactions(page.chatInformation.id); + } } Timer { diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 48d741b..c7b1a73 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -67,6 +67,8 @@ Page { property bool doSendBotStartMessage property string sendBotStartMessageParameter property var availableReactions + signal resetElements() + signal elementSelected(int elementIndex) states: [ State { @@ -480,7 +482,10 @@ Page { if (pageStack.depth === 1) { // Only clear chat model if navigated back to overview page. In other cases we keep the information... chatModel.clear(); + } else { + resetElements(); } + break; } } diff --git a/qml/pages/PollResultsPage.qml b/qml/pages/PollResultsPage.qml index 69dabb7..0368757 100644 --- a/qml/pages/PollResultsPage.qml +++ b/qml/pages/PollResultsPage.qml @@ -143,10 +143,11 @@ Page { Connections { target: tdLibWrapper - onUsersReceived: { + onMessageSendersReceived: { + Debug.log("Received poll users...") if(extra === optionDelegate.usersResponseIdentifierString) { - for(var i = 0; i < userIds.length; i += 1) { - optionDelegate.users.append({id: userIds[i], user:tdLibWrapper.getUserInformation(userIds[i])}); + for(var i = 0; i < senders.length; i += 1) { + optionDelegate.users.append({id: senders[i].user_id, user:tdLibWrapper.getUserInformation(senders[i].user_id)}); } loadUsersTimer.start(); } diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index e074a21..420a075 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 8 +Release: 10 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 05f2fd4..655a6ce 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 8 +Release: 10 # 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 diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index abd9d03..c93b549 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -160,6 +160,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("updateChatPinnedMessage", &TDLibReceiver::processUpdateChatPinnedMessage); handlers.insert("updateMessageIsPinned", &TDLibReceiver::processUpdateMessageIsPinned); handlers.insert("users", &TDLibReceiver::processUsers); + handlers.insert("messageSenders", &TDLibReceiver::processMessageSenders); handlers.insert("error", &TDLibReceiver::processError); handlers.insert("ok", &TDLibReceiver::ok); handlers.insert("secretChat", &TDLibReceiver::processSecretChat); @@ -634,6 +635,12 @@ void TDLibReceiver::processUsers(const QVariantMap &receivedInformation) emit usersReceived(receivedInformation.value(_EXTRA).toString(), receivedInformation.value("user_ids").toList(), receivedInformation.value(TOTAL_COUNT).toInt()); } +void TDLibReceiver::processMessageSenders(const QVariantMap &receivedInformation) +{ + LOG("Received Message Senders"); + emit messageSendersReceived(receivedInformation.value(_EXTRA).toString(), receivedInformation.value("senders").toList(), receivedInformation.value(TOTAL_COUNT).toInt()); +} + void TDLibReceiver::processError(const QVariantMap &receivedInformation) { LOG("Received an error"); diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index bfb380e..dda2cd0 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -88,7 +88,8 @@ signals: void chatTitleUpdated(const QString &chatId, const QString &title); void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId); void messageIsPinnedUpdated(qlonglong chatId, qlonglong messageId, bool isPinned); - void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); + void usersReceived(const QString &extra, const QVariantList &senders, int totalUsers); + void messageSendersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); void errorReceived(const int code, const QString &message, const QString &extra); void secretChat(qlonglong secretChatId, const QVariantMap &secretChat); void secretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat); @@ -173,6 +174,7 @@ private: void processUpdateChatPinnedMessage(const QVariantMap &receivedInformation); void processUpdateMessageIsPinned(const QVariantMap &receivedInformation); void processUsers(const QVariantMap &receivedInformation); + void processMessageSenders(const QVariantMap &receivedInformation); void processError(const QVariantMap &receivedInformation); void processSecretChat(const QVariantMap &receivedInformation); void processUpdateSecretChat(const QVariantMap &receivedInformation); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 6b3e994..6abda99 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -176,6 +176,7 @@ void TDLibWrapper::initializeTDLibReceiver() { connect(this->tdLibReceiver, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong)), this, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong))); connect(this->tdLibReceiver, SIGNAL(messageIsPinnedUpdated(qlonglong, qlonglong, bool)), this, SLOT(handleMessageIsPinnedUpdated(qlonglong, qlonglong, bool))); connect(this->tdLibReceiver, SIGNAL(usersReceived(QString, QVariantList, int)), this, SIGNAL(usersReceived(QString, QVariantList, int))); + connect(this->tdLibReceiver, SIGNAL(messageSendersReceived(QString, QVariantList, int)), this, SIGNAL(messageSendersReceived(QString, QVariantList, int))); connect(this->tdLibReceiver, SIGNAL(errorReceived(int, QString, QString)), this, SLOT(handleErrorReceived(int, QString, QString))); connect(this->tdLibReceiver, SIGNAL(contactsImported(QVariantList, QVariantList)), this, SIGNAL(contactsImported(QVariantList, QVariantList))); connect(this->tdLibReceiver, SIGNAL(messageEditedUpdated(qlonglong, qlonglong, QVariantMap)), this, SIGNAL(messageEditedUpdated(qlonglong, qlonglong, QVariantMap))); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index c4773e3..90ccf53 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -323,6 +323,7 @@ signals: void chatTitleUpdated(const QString &chatId, const QString &title); void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId); void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); + void messageSendersReceived(const QString &extra, const QVariantList &senders, int totalUsers); void errorReceived(int code, const QString &message, const QString &extra); void contactsImported(const QVariantList &importerCount, const QVariantList &userIds); void messageNotFound(qlonglong chatId, qlonglong messageId); From 07fdabc178ffb399d63fc49a9b3e2e1f0b535a65 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Fri, 1 Dec 2023 00:23:23 +0100 Subject: [PATCH 38/52] Handle event updateChatAvailableReactions --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/chatlistmodel.cpp | 30 ++++++++++++++++++++++++++++++ src/chatlistmodel.h | 2 ++ src/tdlibreceiver.cpp | 10 ++++++++++ src/tdlibreceiver.h | 2 ++ src/tdlibwrapper.cpp | 18 ++++++++++++++++++ src/tdlibwrapper.h | 2 ++ 8 files changed, 66 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 420a075..5f26d72 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 10 +Release: 11 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 655a6ce..27e4f25 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 10 +Release: 11 # 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 diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index 0b5d46d..1319938 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -44,6 +44,7 @@ namespace { const QString UNREAD_COUNT("unread_count"); const QString UNREAD_MENTION_COUNT("unread_mention_count"); const QString UNREAD_REACTION_COUNT("unread_reaction_count"); + const QString AVAILABLE_REACTIONS("available_reactions"); const QString NOTIFICATION_SETTINGS("notification_settings"); const QString LAST_READ_INBOX_MESSAGE_ID("last_read_inbox_message_id"); const QString LAST_READ_OUTBOX_MESSAGE_ID("last_read_outbox_message_id"); @@ -70,6 +71,7 @@ public: int unreadCount() const; int unreadMentionCount() const; int unreadReactionCount() const; + QVariant availableReactions() const; QVariant photoSmall() const; qlonglong lastReadInboxMessageId() const; qlonglong senderUserId() const; @@ -168,6 +170,11 @@ int ChatListModel::ChatData::unreadMentionCount() const return chatData.value(UNREAD_MENTION_COUNT).toInt(); } +QVariant ChatListModel::ChatData::availableReactions() const +{ + return chatData.value(AVAILABLE_REACTIONS); +} + int ChatListModel::ChatData::unreadReactionCount() const { return chatData.value(UNREAD_REACTION_COUNT).toInt(); @@ -400,6 +407,7 @@ ChatListModel::ChatListModel(TDLibWrapper *tdLibWrapper, AppSettings *appSetting connect(tdLibWrapper, SIGNAL(chatDraftMessageUpdated(qlonglong, QVariantMap, QString)), this, SLOT(handleChatDraftMessageUpdated(qlonglong, QVariantMap, QString))); connect(tdLibWrapper, SIGNAL(chatUnreadMentionCountUpdated(qlonglong, int)), this, SLOT(handleChatUnreadMentionCountUpdated(qlonglong, int))); connect(tdLibWrapper, SIGNAL(chatUnreadReactionCountUpdated(qlonglong, int)), this, SLOT(handleChatUnreadReactionCountUpdated(qlonglong, int))); + connect(tdLibWrapper, SIGNAL(chatAvailableReactionsUpdated(qlonglong, QString)), this, SLOT(handleChatAvailableReactionsUpdated(qlonglong, QString))); // Don't start the timer until we have at least one chat relativeTimeRefreshTimer = new QTimer(this); @@ -436,6 +444,7 @@ QHash ChatListModel::roleNames() const roles.insert(ChatListModel::RoleUnreadCount, "unread_count"); roles.insert(ChatListModel::RoleUnreadMentionCount, "unread_mention_count"); roles.insert(ChatListModel::RoleUnreadReactionCount, "unread_reaction_count"); + roles.insert(ChatListModel::RoleAvailableReactions, "available_reactions"); roles.insert(ChatListModel::RoleLastReadInboxMessageId, "last_read_inbox_message_id"); roles.insert(ChatListModel::RoleLastMessageSenderId, "last_message_sender_id"); roles.insert(ChatListModel::RoleLastMessageDate, "last_message_date"); @@ -472,6 +481,7 @@ QVariant ChatListModel::data(const QModelIndex &index, int role) const case ChatListModel::RolePhotoSmall: return data->photoSmall(); case ChatListModel::RoleUnreadCount: return data->unreadCount(); case ChatListModel::RoleUnreadMentionCount: return data->unreadMentionCount(); + case ChatListModel::RoleAvailableReactions: return data->availableReactions(); case ChatListModel::RoleUnreadReactionCount: return data->unreadReactionCount(); case ChatListModel::RoleLastReadInboxMessageId: return data->lastReadInboxMessageId(); case ChatListModel::RoleLastMessageSenderId: return data->senderUserId(); @@ -1036,6 +1046,26 @@ void ChatListModel::handleChatUnreadReactionCountUpdated(qlonglong chatId, int u } } +void ChatListModel::handleChatAvailableReactionsUpdated(qlonglong chatId, const QVariantMap availableReactions) +{ + if (chatIndexMap.contains(chatId)) { + LOG("Updating available reaction type for" << chatId << availableReactions); + const int chatIndex = chatIndexMap.value(chatId); + ChatData *chat = chatList.at(chatIndex); + chat->chatData.insert(AVAILABLE_REACTIONS, availableReactions); + QVector changedRoles; + changedRoles.append(ChatListModel::RoleAvailableReactions); + const QModelIndex modelIndex(index(chatIndex)); + emit dataChanged(modelIndex, modelIndex, changedRoles); + } else { + ChatData *chat = hiddenChats.value(chatId); + if (chat) { + LOG("Updating available reaction type for hidden chat" << chatId << availableReactions); + chat->chatData.insert(AVAILABLE_REACTIONS, availableReactions); + } + } +} + void ChatListModel::handleRelativeTimeRefreshTimer() { LOG("Refreshing timestamps"); diff --git a/src/chatlistmodel.h b/src/chatlistmodel.h index 9bcc837..af875df 100644 --- a/src/chatlistmodel.h +++ b/src/chatlistmodel.h @@ -42,6 +42,7 @@ public: RoleUnreadCount, RoleUnreadMentionCount, RoleUnreadReactionCount, + RoleAvailableReactions, RoleLastReadInboxMessageId, RoleLastMessageSenderId, RoleLastMessageDate, @@ -93,6 +94,7 @@ private slots: void handleChatDraftMessageUpdated(qlonglong chatId, const QVariantMap &draftMessage, const QString &order); void handleChatUnreadMentionCountUpdated(qlonglong chatId, int unreadMentionCount); void handleChatUnreadReactionCountUpdated(qlonglong chatId, int unreadReactionCount); + void handleChatAvailableReactionsUpdated(qlonglong chatId, const QVariantMap availableReactions); void handleRelativeTimeRefreshTimer(); signals: diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index c93b549..44034c7 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -46,6 +46,7 @@ namespace { const QString UNREAD_COUNT("unread_count"); const QString UNREAD_MENTION_COUNT("unread_mention_count"); const QString UNREAD_REACTION_COUNT("unread_reaction_count"); + const QString AVAILABLE_REACTIONS("available_reactions"); const QString TEXT("text"); const QString LAST_READ_INBOX_MESSAGE_ID("last_read_inbox_message_id"); const QString LAST_READ_OUTBOX_MESSAGE_ID("last_read_outbox_message_id"); @@ -123,6 +124,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("updateChatPosition", &TDLibReceiver::processUpdateChatPosition); handlers.insert("updateChatReadInbox", &TDLibReceiver::processUpdateChatReadInbox); handlers.insert("updateChatReadOutbox", &TDLibReceiver::processUpdateChatReadOutbox); + handlers.insert("updateChatAvailableReactions", &TDLibReceiver::processUpdateChatAvailableReactions); handlers.insert("updateBasicGroup", &TDLibReceiver::processUpdateBasicGroup); handlers.insert("updateSupergroup", &TDLibReceiver::processUpdateSuperGroup); handlers.insert("updateChatOnlineMemberCount", &TDLibReceiver::processChatOnlineMemberCountUpdated); @@ -363,6 +365,14 @@ void TDLibReceiver::processUpdateChatReadOutbox(const QVariantMap &receivedInfor emit chatReadOutboxUpdated(chat_id, last_read_outbox_message_id); } +void TDLibReceiver::processUpdateChatAvailableReactions(const QVariantMap &receivedInformation) +{ + const qlonglong chat_id(receivedInformation.value(CHAT_ID).toLongLong()); + const QVariantMap available_reactions(receivedInformation.value(AVAILABLE_REACTIONS).toMap()); + LOG("Available reactions updated for" << chat_id << "new information:" << available_reactions); + emit chatAvailableReactionsUpdated(chat_id, available_reactions); +} + void TDLibReceiver::processUpdateBasicGroup(const QVariantMap &receivedInformation) { const QVariantMap basicGroup(receivedInformation.value(BASIC_GROUP).toMap()); diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index dda2cd0..33771b6 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -52,6 +52,7 @@ signals: void chatPinnedUpdated(qlonglong chatId, bool isPinned); void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void chatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); + void chatAvailableReactionsUpdated(const qlonglong &chatId, const QVariantMap &availableReactions); void basicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); void superGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); void chatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount); @@ -136,6 +137,7 @@ private: void processUpdateChatPosition(const QVariantMap &receivedInformation); void processUpdateChatReadInbox(const QVariantMap &receivedInformation); void processUpdateChatReadOutbox(const QVariantMap &receivedInformation); + void processUpdateChatAvailableReactions(const QVariantMap &receivedInformation); void processUpdateBasicGroup(const QVariantMap &receivedInformation); void processUpdateSuperGroup(const QVariantMap &receivedInformation); void processChatOnlineMemberCountUpdated(const QVariantMap &receivedInformation); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 6abda99..70dcf65 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -137,6 +137,7 @@ void TDLibWrapper::initializeTDLibReceiver() { connect(this->tdLibReceiver, SIGNAL(chatOrderUpdated(QString, QString)), this, SIGNAL(chatOrderUpdated(QString, QString))); connect(this->tdLibReceiver, SIGNAL(chatReadInboxUpdated(QString, QString, int)), this, SIGNAL(chatReadInboxUpdated(QString, QString, int))); connect(this->tdLibReceiver, SIGNAL(chatReadOutboxUpdated(QString, QString)), this, SIGNAL(chatReadOutboxUpdated(QString, QString))); + connect(this->tdLibReceiver, SIGNAL(chatAvailableReactionsUpdated(qlonglong, QVariantMap)), this, SLOT(handleAvailableReactionsUpdated(qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(basicGroupUpdated(qlonglong, QVariantMap)), this, SLOT(handleBasicGroupUpdated(qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(superGroupUpdated(qlonglong, QVariantMap)), this, SLOT(handleSuperGroupUpdated(qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(chatOnlineMemberCountUpdated(QString, int)), this, SIGNAL(chatOnlineMemberCountUpdated(QString, int))); @@ -1632,12 +1633,15 @@ QVariantMap TDLibWrapper::getChat(const QString &chatId) QStringList TDLibWrapper::getChatReactions(const QString &chatId) { + LOG("Obtaining chat reactions for chat" << chatId); const QVariant available_reactions(chats.value(chatId).toMap().value(CHAT_AVAILABLE_REACTIONS)); const QVariantMap map(available_reactions.toMap()); const QString reactions_type(map.value(_TYPE).toString()); if (reactions_type == CHAT_AVAILABLE_REACTIONS_ALL) { + LOG("Chat uses all available reactions, currently available number" << activeEmojiReactions.size()); return activeEmojiReactions; } else if (reactions_type == CHAT_AVAILABLE_REACTIONS_SOME) { + LOG("Chat uses reduced set of reactions"); const QVariantList reactions(map.value(REACTIONS).toList()); const int n = reactions.count(); QStringList emojis; @@ -1659,10 +1663,13 @@ QStringList TDLibWrapper::getChatReactions(const QString &chatId) } } } + LOG("Found emojis for this chat" << emojis.size()); return emojis; } else if (reactions_type.isEmpty()) { + LOG("No chat reaction type specified, using all reactions"); return available_reactions.toStringList(); } else { + LOG("Unknown chat reaction type" << reactions_type); return QStringList(); } } @@ -1932,6 +1939,17 @@ void TDLibWrapper::handleUnreadChatCountUpdated(const QVariantMap &chatCountInfo } } +void TDLibWrapper::handleAvailableReactionsUpdated(qlonglong chatId, const QVariantMap &availableReactions) +{ + LOG("Updating available reactions for chat" << chatId << availableReactions); + QString chatIdString = QString::number(chatId); + QVariantMap chatInformation = this->getChat(chatIdString); + chatInformation.insert(CHAT_AVAILABLE_REACTIONS, availableReactions); + this->chats.insert(chatIdString, chatInformation); + emit chatAvailableReactionsUpdated(chatId, availableReactions); + +} + void TDLibWrapper::handleBasicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation) { emit basicGroupUpdated(updateGroup(groupId, groupInformation, &basicGroups)->groupId); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 90ccf53..2487ae5 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -280,6 +280,7 @@ signals: void chatPinnedUpdated(qlonglong chatId, bool isPinned); void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void chatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); + void chatAvailableReactionsUpdated(const qlonglong &chatId, const QVariantMap &availableReactions); void userUpdated(const QString &userId, const QVariantMap &userInformation); void ownUserUpdated(const QVariantMap &userInformation); void basicGroupUpdated(qlonglong groupId); @@ -354,6 +355,7 @@ public slots: void handleChatReceived(const QVariantMap &chatInformation); void handleUnreadMessageCountUpdated(const QVariantMap &messageCountInformation); void handleUnreadChatCountUpdated(const QVariantMap &chatCountInformation); + void handleAvailableReactionsUpdated(qlonglong chatId, const QVariantMap &availableReactions); void handleBasicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); void handleSuperGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); void handleStickerSets(const QVariantList &stickerSets); From 8eda82da1832568f2b3c4c48030b7efc09c68be8 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 3 Dec 2023 00:12:52 +0200 Subject: [PATCH 39/52] Fix broken signal-slot connection (#541) QObject::connect: No such signal TDLibWrapper::chatAvailableReactionsUpdated(qlonglong, QString) in src/chatlistmodel.cpp:410 --- src/chatlistmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index 1319938..a361c18 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -407,7 +407,7 @@ ChatListModel::ChatListModel(TDLibWrapper *tdLibWrapper, AppSettings *appSetting connect(tdLibWrapper, SIGNAL(chatDraftMessageUpdated(qlonglong, QVariantMap, QString)), this, SLOT(handleChatDraftMessageUpdated(qlonglong, QVariantMap, QString))); connect(tdLibWrapper, SIGNAL(chatUnreadMentionCountUpdated(qlonglong, int)), this, SLOT(handleChatUnreadMentionCountUpdated(qlonglong, int))); connect(tdLibWrapper, SIGNAL(chatUnreadReactionCountUpdated(qlonglong, int)), this, SLOT(handleChatUnreadReactionCountUpdated(qlonglong, int))); - connect(tdLibWrapper, SIGNAL(chatAvailableReactionsUpdated(qlonglong, QString)), this, SLOT(handleChatAvailableReactionsUpdated(qlonglong, QString))); + connect(tdLibWrapper, SIGNAL(chatAvailableReactionsUpdated(qlonglong,QVariantMap)), this, SLOT(handleChatAvailableReactionsUpdated(qlonglong,QVariantMap))); // Don't start the timer until we have at least one chat relativeTimeRefreshTimer = new QTimer(this); From 64479f0dd3aeb5dfc876274b154bea1d2c4cd512 Mon Sep 17 00:00:00 2001 From: mbarashkov Date: Sun, 3 Dec 2023 01:44:14 +0300 Subject: [PATCH 40/52] Improve chat UI on tablets by making messages narrower and limiting content items width as well. (#540) Co-authored-by: Mikhail Barashkov --- qml/components/MessageListViewItem.qml | 12 +++++++++--- qml/components/settingsPage/ResponsiveGrid.qml | 3 ++- qml/js/functions.js | 4 ++++ qml/pages/ChatPage.qml | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 8de7e7c..5ff54d8 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -128,6 +128,10 @@ ListItem { selectReactionBubble.visible = false; } + function getContentWidthMultiplier() { + return Functions.isTablet(appWindow) ? 0.4 : 1.0 + } + onClicked: { if (messageListItem.precalculatedValues.pageIsSelecting) { page.toggleMessageSelection(myMessage); @@ -365,8 +369,10 @@ ListItem { id: messageTextRow spacing: Theme.paddingSmall width: precalculatedValues.entryWidth - anchors.horizontalCenter: parent.horizontalCenter + anchors.horizontalCenter: Functions.isTablet(appWindow) ? undefined : parent.horizontalCenter + anchors.left: Functions.isTablet(appWindow) ? parent.left : undefined y: Theme.paddingSmall + anchors.leftMargin: Functions.isTablet(appWindow) ? Theme.paddingMedium : undefined Loader { id: profileThumbnailLoader @@ -596,7 +602,7 @@ ListItem { id: webPagePreviewLoader active: false asynchronous: true - width: parent.width + width: parent.width * getContentWidthMultiplier() height: (status === Loader.Ready) ? item.implicitHeight : myMessage.content.web_page ? precalculatedValues.webPagePreviewHeight : 0 sourceComponent: Component { @@ -610,7 +616,7 @@ ListItem { Loader { id: extraContentLoader - width: parent.width + width: parent.width * getContentWidthMultiplier() asynchronous: true height: item ? item.height : (messageListItem.hasContentComponent ? chatView.getContentComponentHeight(model.content_type, myMessage.content, width) : 0) } diff --git a/qml/components/settingsPage/ResponsiveGrid.qml b/qml/components/settingsPage/ResponsiveGrid.qml index 1d1bb55..8caf663 100644 --- a/qml/components/settingsPage/ResponsiveGrid.qml +++ b/qml/components/settingsPage/ResponsiveGrid.qml @@ -19,9 +19,10 @@ import QtQuick 2.6 import Sailfish.Silica 1.0 +import "../../js/functions.js" as Functions Grid { width: parent.width - ( 2 * x ) - columns: (appWindow.deviceOrientation & Orientation.LandscapeMask) || Screen.sizeCategory === Screen.Large || Screen.sizeCategory === Screen.ExtraLarge ? 2 : 1 + columns: Functions.isTablet(appWindow) ? 2 : 1 readonly property real columnWidth: width/columns } diff --git a/qml/js/functions.js b/qml/js/functions.js index b2e2ca7..e1c2634 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -540,3 +540,7 @@ function getMessagesNeededForwardPermissions(messages) { } return neededPermissions } + +function isTablet(appWindow) { + return (appWindow.deviceOrientation & Silica.Orientation.LandscapeMask) || Silica.Screen.sizeCategory === Silica.Screen.Large || Silica.Screen.sizeCategory === Silica.Screen.ExtraLarge +} diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index c7b1a73..41ad784 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1193,7 +1193,7 @@ Page { readonly property int profileThumbnailDimensions: showUserInfo ? Theme.itemSizeSmall : 0 readonly property int pageMarginDouble: 2 * Theme.horizontalPageMargin readonly property int paddingMediumDouble: 2 * Theme.paddingMedium - readonly property int entryWidth: chatView.width - pageMarginDouble + readonly property int entryWidth: Functions.isTablet(appWindow) ? chatView.width * 0.75 : chatView.width - pageMarginDouble readonly property int textItemWidth: entryWidth - profileThumbnailDimensions - Theme.paddingSmall readonly property int backgroundWidth: page.isChannel ? textItemWidth : textItemWidth - pageMarginDouble readonly property int backgroundRadius: textItemWidth/50 From bba4a6468c3af50f56d1dd80f81d73dee476d148 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Dec 2023 23:50:13 +0100 Subject: [PATCH 41/52] Not only tablets have widescreen ;) --- qml/components/MessageListViewItem.qml | 8 ++++---- qml/components/settingsPage/ResponsiveGrid.qml | 2 +- qml/js/functions.js | 2 +- qml/pages/ChatPage.qml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 5ff54d8..81cf572 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -129,7 +129,7 @@ ListItem { } function getContentWidthMultiplier() { - return Functions.isTablet(appWindow) ? 0.4 : 1.0 + return Functions.isWidescreen(appWindow) ? 0.4 : 1.0 } onClicked: { @@ -369,10 +369,10 @@ ListItem { id: messageTextRow spacing: Theme.paddingSmall width: precalculatedValues.entryWidth - anchors.horizontalCenter: Functions.isTablet(appWindow) ? undefined : parent.horizontalCenter - anchors.left: Functions.isTablet(appWindow) ? parent.left : undefined + anchors.horizontalCenter: Functions.isWidescreen(appWindow) ? undefined : parent.horizontalCenter + anchors.left: Functions.isWidescreen(appWindow) ? parent.left : undefined y: Theme.paddingSmall - anchors.leftMargin: Functions.isTablet(appWindow) ? Theme.paddingMedium : undefined + anchors.leftMargin: Functions.isWidescreen(appWindow) ? Theme.paddingMedium : undefined Loader { id: profileThumbnailLoader diff --git a/qml/components/settingsPage/ResponsiveGrid.qml b/qml/components/settingsPage/ResponsiveGrid.qml index 8caf663..a5bc592 100644 --- a/qml/components/settingsPage/ResponsiveGrid.qml +++ b/qml/components/settingsPage/ResponsiveGrid.qml @@ -23,6 +23,6 @@ import "../../js/functions.js" as Functions Grid { width: parent.width - ( 2 * x ) - columns: Functions.isTablet(appWindow) ? 2 : 1 + columns: Functions.isWidescreen(appWindow) ? 2 : 1 readonly property real columnWidth: width/columns } diff --git a/qml/js/functions.js b/qml/js/functions.js index e1c2634..5199d82 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -541,6 +541,6 @@ function getMessagesNeededForwardPermissions(messages) { return neededPermissions } -function isTablet(appWindow) { +function isWidescreen(appWindow) { return (appWindow.deviceOrientation & Silica.Orientation.LandscapeMask) || Silica.Screen.sizeCategory === Silica.Screen.Large || Silica.Screen.sizeCategory === Silica.Screen.ExtraLarge } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 41ad784..d6dbe80 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1193,7 +1193,7 @@ Page { readonly property int profileThumbnailDimensions: showUserInfo ? Theme.itemSizeSmall : 0 readonly property int pageMarginDouble: 2 * Theme.horizontalPageMargin readonly property int paddingMediumDouble: 2 * Theme.paddingMedium - readonly property int entryWidth: Functions.isTablet(appWindow) ? chatView.width * 0.75 : chatView.width - pageMarginDouble + readonly property int entryWidth: Functions.isWidescreen(appWindow) ? chatView.width * 0.75 : chatView.width - pageMarginDouble readonly property int textItemWidth: entryWidth - profileThumbnailDimensions - Theme.paddingSmall readonly property int backgroundWidth: page.isChannel ? textItemWidth : textItemWidth - pageMarginDouble readonly property int backgroundRadius: textItemWidth/50 From 2dd1d2c380c8348c077c9dd22661d1d7e49cfdc7 Mon Sep 17 00:00:00 2001 From: mbarashkov Date: Sun, 3 Dec 2023 02:46:47 +0300 Subject: [PATCH 42/52] Jump to post from quote (#538) * Jump to post from quote * Add a setting to go to quoted message. --------- Co-authored-by: Mikhail Barashkov --- qml/components/MessageListViewItem.qml | 8 ++++++-- .../settingsPage/SettingsBehavior.qml | 11 ++++++++++ qml/pages/ChatPage.qml | 20 +++++++++++++++++++ src/appsettings.cpp | 15 ++++++++++++++ src/appsettings.h | 5 +++++ src/chatmodel.cpp | 20 +++++++++++++++++++ src/chatmodel.h | 2 ++ 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-fr.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-sk.ts | 8 ++++++++ translations/harbour-fernschreiber-sv.ts | 8 ++++++++ translations/harbour-fernschreiber-zh_CN.ts | 8 ++++++++ translations/harbour-fernschreiber.ts | 8 ++++++++ 20 files changed, 183 insertions(+), 2 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 81cf572..9baf0c1 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -489,8 +489,12 @@ ListItem { page.toggleMessageSelection(myMessage) } else { messageOptionsDrawer.open = false - messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage - messageOverlayLoader.active = true + if(appSettings.goToQuotedMessage) { + chatPage.showMessage(messageInReplyToRow.inReplyToMessage.id, true) + } else { + messageOverlayLoader.active = true + messageOverlayLoader.overlayMessage = messageInReplyToRow.inReplyToMessage + } } } onPressAndHold: { diff --git a/qml/components/settingsPage/SettingsBehavior.qml b/qml/components/settingsPage/SettingsBehavior.qml index 18b487e..2232791 100644 --- a/qml/components/settingsPage/SettingsBehavior.qml +++ b/qml/components/settingsPage/SettingsBehavior.qml @@ -103,6 +103,17 @@ AccordionItem { } } + TextSwitch { + width: parent.columnWidth + checked: appSettings.goToQuotedMessage + text: qsTr("Go to quoted message") + description: qsTr("When tapping a quoted message, open it in chat instead of showing it in an overlay.") + automaticCheck: false + onClicked: { + appSettings.goToQuotedMessage = !checked + } + } + ComboBox { id: feedbackComboBox width: parent.columnWidth diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index d6dbe80..4150c50 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -54,6 +54,7 @@ Page { property bool iterativeInitialization: false; property var messageToShow; property string messageIdToShow; + property string messageIdToScrollTo; readonly property bool userIsMember: ((isPrivateChat || isSecretChat) && chatInformation["@type"]) || // should be optimized (isBasicGroup || isSuperGroup) && ( (chatGroupInformation.status["@type"] === "chatMemberStatusMember") @@ -409,6 +410,23 @@ Page { chatPage.focus = true; } + function showMessage(messageId, initialRun) { + // Means we tapped a quoted message and had to load it. + if(initialRun) { + chatPage.messageIdToScrollTo = messageId + } + if (chatPage.messageIdToScrollTo && chatPage.messageIdToScrollTo != "") { + var index = chatModel.getMessageIndex(chatPage.messageIdToScrollTo); + if(index !== -1) { + chatPage.messageIdToScrollTo = ""; + chatView.scrollToIndex(index); + } else if(initialRun) { + // we only want to do this once. + chatModel.triggerLoadHistoryForMessage(chatPage.messageIdToScrollTo) + } + } + } + Timer { id: forwardMessagesTimer interval: 200 @@ -657,6 +675,8 @@ Page { if (chatView.height > chatView.contentHeight) { Debug.log("[ChatPage] Chat content quite small..."); viewMessageTimer.queueViewMessage(chatView.count - 1); + } else if (chatPage.messageIdToScrollTo && chatPage.messageIdToScrollTo != "") { + showMessage(chatPage.messageIdToScrollTo, false) } chatViewCooldownTimer.restart(); chatViewStartupReadTimer.restart(); diff --git a/src/appsettings.cpp b/src/appsettings.cpp index d63537a..6df3f38 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -32,6 +32,7 @@ namespace { const QString KEY_NOTIFICATION_SUPPRESS_ENABLED("notificationSuppressContent"); const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback"); const QString KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW("notificationAlwaysShowPreview"); + const QString KEY_GO_TO_QUOTED_MESSAGE("goToQuotedMessage"); const QString KEY_STORAGE_OPTIMIZER("useStorageOptimizer"); const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess"); const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); @@ -201,6 +202,20 @@ void AppSettings::setNotificationAlwaysShowPreview(bool enable) } } +bool AppSettings::goToQuotedMessage() const +{ + return settings.value(KEY_GO_TO_QUOTED_MESSAGE, false).toBool(); +} + +void AppSettings::setGoToQuotedMessage(bool enable) +{ + if (goToQuotedMessage() != enable) { + LOG(KEY_GO_TO_QUOTED_MESSAGE << enable); + settings.setValue(KEY_GO_TO_QUOTED_MESSAGE, enable); + emit goToQuotedMessageChanged(); + } +} + bool AppSettings::storageOptimizer() const { return settings.value(KEY_STORAGE_OPTIMIZER, true).toBool(); diff --git a/src/appsettings.h b/src/appsettings.h index 84e59d9..acc38b2 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -35,6 +35,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool notificationSuppressContent READ notificationSuppressContent WRITE setNotificationSuppressContent NOTIFY notificationSuppressContentChanged) Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged) Q_PROPERTY(bool notificationAlwaysShowPreview READ notificationAlwaysShowPreview WRITE setNotificationAlwaysShowPreview NOTIFY notificationAlwaysShowPreviewChanged) + Q_PROPERTY(bool goToQuotedMessage READ goToQuotedMessage WRITE setGoToQuotedMessage NOTIFY goToQuotedMessageChanged) Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) Q_PROPERTY(bool allowInlineBotLocationAccess READ allowInlineBotLocationAccess WRITE setAllowInlineBotLocationAccess NOTIFY allowInlineBotLocationAccessChanged) Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) @@ -96,6 +97,9 @@ public: bool notificationAlwaysShowPreview() const; void setNotificationAlwaysShowPreview(bool enable); + bool goToQuotedMessage() const; + void setGoToQuotedMessage(bool enable); + bool storageOptimizer() const; void setStorageOptimizer(bool enable); @@ -135,6 +139,7 @@ signals: void notificationSuppressContentChanged(); void notificationFeedbackChanged(); void notificationAlwaysShowPreviewChanged(); + void goToQuotedMessageChanged(); void storageOptimizerChanged(); void allowInlineBotLocationAccessChanged(); void remainingInteractionHintsChanged(); diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index b4bf632..96c40ce 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -363,6 +363,15 @@ void ChatModel::initialize(const QVariantMap &chatInformation) tdLibWrapper->getChatHistory(chatId, this->chatInformation.value(LAST_READ_INBOX_MESSAGE_ID).toLongLong()); } +void ChatModel::triggerLoadHistoryForMessage(qlonglong messageId) +{ + if (!this->inIncrementalUpdate && !messages.isEmpty()) { + LOG("Trigger loading message with id..." << messageId); + this->inIncrementalUpdate = true; + this->tdLibWrapper->getChatHistory(chatId, messageId); + } +} + void ChatModel::triggerLoadMoreHistory() { if (!this->inIncrementalUpdate && !messages.isEmpty()) { @@ -400,6 +409,17 @@ QVariantMap ChatModel::getMessage(int index) return QVariantMap(); } +int ChatModel::getMessageIndex(qlonglong messageId) +{ + if (messages.size() == 0) { + return -1; + } + if (messageIndexMap.contains(messageId)) { + return messageIndexMap.value(messageId); + } + return -1; +} + int ChatModel::getLastReadMessageIndex() { LOG("Obtaining last read message index"); diff --git a/src/chatmodel.h b/src/chatmodel.h index bf4781f..bbf1b4a 100644 --- a/src/chatmodel.h +++ b/src/chatmodel.h @@ -40,12 +40,14 @@ public: Q_INVOKABLE void clear(bool contentOnly = false); Q_INVOKABLE void initialize(const QVariantMap &chatInformation); Q_INVOKABLE void triggerLoadMoreHistory(); + Q_INVOKABLE void triggerLoadHistoryForMessage(qlonglong messageId); Q_INVOKABLE void triggerLoadMoreFuture(); Q_INVOKABLE QVariantMap getChatInformation(); Q_INVOKABLE QVariantMap getMessage(int index); Q_INVOKABLE int getLastReadMessageIndex(); Q_INVOKABLE void setSearchQuery(const QString newSearchQuery); + Q_INVOKABLE int getMessageIndex(qlonglong messageId); QVariantMap smallPhoto() const; qlonglong getChatId() const; diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index c608557..bef6175 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1606,6 +1606,14 @@ Hide content in notifications Inhalte in Hinweisen verbergen + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 3a0b0be..345cc41 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1608,6 +1608,14 @@ messages Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 3ea5669..9a3615d 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1606,6 +1606,14 @@ Hide content in notifications Ocultar contenido a notificaciones + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 7d08abb..ca6341c 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1607,6 +1607,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index 0c5097e..9cbf533 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -1606,6 +1606,14 @@ Hide content in notifications Masquer le contenu dans les notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index adcf023..e07e622 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1579,6 +1579,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 0ff0bfa..8920edd 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1606,6 +1606,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 436cd14..2cf1221 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1633,6 +1633,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 9006ca3..76461d8 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1636,6 +1636,14 @@ Hide content in notifications Не показывать содержимое сообщений в уведомлениях + + Go to quoted message + Переходить к цитируемому сообщению + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + По нажатию на цитируемое сообщение, переходить к нему в чате вместо отображения во всплывающем окне. + SettingsPage diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index df7ec3a..bee3622 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -1633,6 +1633,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 92078c6..61b8abe 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1606,6 +1606,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index c904169..63b71e5 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1580,6 +1580,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index d816a18..d508bc5 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1606,6 +1606,14 @@ Hide content in notifications + + Go to quoted message + + + + When tapping a quoted message, open it in chat instead of showing it in an overlay. + + SettingsPage From 4ed949537605cf329288ef2208740bcd8b3606eb Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 3 Dec 2023 00:44:17 +0100 Subject: [PATCH 43/52] Highlight message that was jumped to --- qml/components/MessageListViewItem.qml | 22 +++++++++++++++++++++- qml/pages/ChatPage.qml | 2 ++ translations/harbour-fernschreiber-de.ts | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 9baf0c1..523f74c 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -47,6 +47,7 @@ ListItem { readonly property bool canDeleteMessage: myMessage.can_be_deleted_for_all_users || (myMessage.can_be_deleted_only_for_self && myMessage.chat_id === page.myUserId) property bool hasContentComponent property bool additionalOptionsOpened + property bool wasNavigatedTo: false readonly property var additionalItemsModel: (extraContentLoader.item && ("extraContextMenuItems" in extraContentLoader.item)) ? extraContentLoader.item.extraContextMenuItems : 0 @@ -67,7 +68,7 @@ ListItem { property var chatReactions property var messageReactions - highlighted: (down || isSelected || additionalOptionsOpened) && !menuOpen + highlighted: (down || isSelected || additionalOptionsOpened || wasNavigatedTo) && !menuOpen openMenuOnPressAndHold: !messageListItem.precalculatedValues.pageIsSelecting signal replyToMessage() @@ -195,6 +196,12 @@ ListItem { selectReactionBubble.visible = false; } } + onNavigatedTo: { + if (targetIndex === index) { + messageListItem.wasNavigatedTo = true; + restoreNormalityTimer.start(); + } + } } Loader { @@ -327,6 +334,19 @@ ListItem { } } + Timer { + id: restoreNormalityTimer + + repeat: false + running: false + interval: 1000 + triggeredOnStart: false + onTriggered: { + Debug.log("Restore normality for index " + index); + messageListItem.wasNavigatedTo = false; + } + } + Component.onCompleted: { delegateComponentLoadingTimer.start(); if (myMessage.reply_to_message_id) { diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 4150c50..17ced0b 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -70,6 +70,7 @@ Page { property var availableReactions signal resetElements() signal elementSelected(int elementIndex) + signal navigatedTo(int targetIndex) states: [ State { @@ -420,6 +421,7 @@ Page { if(index !== -1) { chatPage.messageIdToScrollTo = ""; chatView.scrollToIndex(index); + navigatedTo(index); } else if(initialRun) { // we only want to do this once. chatModel.triggerLoadHistoryForMessage(chatPage.messageIdToScrollTo) diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index bef6175..1662801 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1608,11 +1608,11 @@ Go to quoted message - + Zu zitierter Nachricht springen When tapping a quoted message, open it in chat instead of showing it in an overlay. - + Beim Tippen auf eine zitierte Nachricht zu dieser springen anstatt es in einem Overlay anzuzeigen. From 47ee85915d71cc8c9f98932cd8264bae66eb0910 Mon Sep 17 00:00:00 2001 From: free software <45316884+carlosgonz0@users.noreply.github.com> Date: Sun, 3 Dec 2023 04:48:20 -0500 Subject: [PATCH 44/52] Update harbour-fernschreiber-es.ts (#542) --- translations/harbour-fernschreiber-es.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 9a3615d..158d540 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1608,11 +1608,11 @@ Go to quoted message - + Ir a mensaje citado When tapping a quoted message, open it in chat instead of showing it in an overlay. - + Al Pulsar mensaje citado, abrirá en Charla en lugar de mostrarlo en una superposición. @@ -1725,9 +1725,9 @@ %1 day(s) - - - + + %1 dia + %1 dias @@ -2351,11 +2351,11 @@ sent a game myself - envió juego + envió un juego sent a game - envió juego + envió un juego From b2363af36f6f6c691a9a347da068e704ab193b45 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 3 Dec 2023 13:53:32 +0200 Subject: [PATCH 45/52] Tweaked the logic of moving reactions into the view (#543) There's no need to reposition list items if reactions bar are already fully visible. --- qml/components/MessageListViewItem.qml | 14 +++++++++----- qml/pages/ChatPage.qml | 5 ++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 523f74c..a0cf5d8 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -325,11 +325,15 @@ ListItem { onTriggered: { Debug.log("Show item completely timer triggered, requested index: " + requestedIndex + ", current index: " + index) if (requestedIndex === index) { - chatView.highlightMoveDuration = -1; - chatView.highlightResizeDuration = -1; - chatView.scrollToIndex(requestedIndex); - chatView.highlightMoveDuration = 0; - chatView.highlightResizeDuration = 0; + var p = chatView.contentItem.mapFromItem(reactionsColumn, 0, 0) + if (chatView.contentY > p.y || p.y + reactionsColumn.height > chatView.contentY + chatView.height) { + Debug.log("Moving reactions for item at", requestedIndex, "info the view") + chatView.highlightMoveDuration = -1 + chatView.highlightResizeDuration = -1 + chatView.scrollToIndex(requestedIndex, height <= chatView.height ? ListView.Contain : ListView.End) + chatView.highlightMoveDuration = 0 + chatView.highlightResizeDuration = 0 + } } } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 17ced0b..b0423b1 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1241,10 +1241,9 @@ Page { manuallyScrolledToBottom = chatView.atYEnd } - function scrollToIndex(index) { + function scrollToIndex(index, mode) { if(index > 0 && index < chatView.count) { - positionViewAtIndex(index, ListView.Contain) - // currentIndex = index; + positionViewAtIndex(index, (mode === undefined) ? ListView.Contain : mode) if(index === chatView.count - 1) { manuallyScrolledToBottom = true; } From c1ab982cb12ac76a5eef479eb72cf506332dd143 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 3 Dec 2023 12:59:41 +0100 Subject: [PATCH 46/52] Restore content width in landscape as per discussion in #540 --- qml/pages/ChatPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index b0423b1..c06fb51 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1215,7 +1215,7 @@ Page { readonly property int profileThumbnailDimensions: showUserInfo ? Theme.itemSizeSmall : 0 readonly property int pageMarginDouble: 2 * Theme.horizontalPageMargin readonly property int paddingMediumDouble: 2 * Theme.paddingMedium - readonly property int entryWidth: Functions.isWidescreen(appWindow) ? chatView.width * 0.75 : chatView.width - pageMarginDouble + readonly property int entryWidth: chatView.width - pageMarginDouble readonly property int textItemWidth: entryWidth - profileThumbnailDimensions - Theme.paddingSmall readonly property int backgroundWidth: page.isChannel ? textItemWidth : textItemWidth - pageMarginDouble readonly property int backgroundRadius: textItemWidth/50 From 4af73184b2c1cac84915fb55a287c1b184f4478b Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 3 Dec 2023 13:22:45 +0100 Subject: [PATCH 47/52] Prepare 0.17 release --- README.md | 8 ++++++-- rpm/harbour-fernschreiber.changes | 20 ++++++++++++++++++++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 765e970..bfb06b6 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,11 @@ Fernschreiber wouldn't be the same without all the people helping in making it b - Chat info page, performance improvements to chat page, location support, app initialization/registration with Telegram, project dependencies, emoji handling, qml/js optimizations, multi-message actions, i18n fixes, chat permission handling, code reviews, logging categories, bot support, github build: [jgibbon](https://github.com/jgibbon) - Copy message to clipboard: [Christian Stemmle](https://github.com/chstem) - Hide send message button if send-by-enter is switched on, focus text input on entering a chat: [santhoshmanikandan](https://github.com/santhoshmanikandan) -- Integration of logout and sesison options to settings page: [Peter G.](https://github.com/nephros) +- Integration of logout and sesison options to settings page, search results optimization, highlight unread conversations: [Peter G.](https://github.com/nephros) +- Option to always append last message in notifications: [Johannes Bachmann](https://github.com/dscheinah) +- Option to jump to quoted message, widescreen UI adjustments: [Mikhail Barashkov](https://github.com/mbarashkov) + +This list might not be complete. In case I forgot something/somebody, please let me know or create a PR, thanks! :) ### Logo/Icon - Designed by [Matteo](https://github.com/iamnomeutente), adjustments by [Slava Monich](https://github.com/monich) @@ -48,7 +52,7 @@ const char TDLIB_API_HASH[] = "1234567890abcdef1234567890abcdef"; You get the Telegram API ID and hash as soon as you've registered your own application on [https://my.telegram.org](https://my.telegram.org). -Moreover, you need to have a compiled version of [TDLib 1.8.3](https://github.com/tdlib/td) or higher in the sub-directory `tdlib`. This sub-directory must contain another sub-directory that fits to the target device architecture (e.g. armv7hl, i486). Within this directory, there needs to be a folder called `lib` that contains at least `libtdjson.so`. For armv7hl the relative path would consequently be `tdlib/armv7hl/lib`. +Moreover, you need to have a compiled version of [TDLib 1.8.21](https://github.com/tdlib/td) or higher in the sub-directory `tdlib`. This sub-directory must contain another sub-directory that fits to the target device architecture (e.g. armv7hl, i486). Within this directory, there needs to be a folder called `lib` that contains at least `libtdjson.so`. For armv7hl the relative path would consequently be `tdlib/armv7hl/lib`. You may just want to download the [tdlib.zip from our fork](https://github.com/Wunderfitz/td/releases) to just use the exact version of the latest official Fernschreiber release. To use it, you need to extract it into your local `tdlib/` folder as described above. If so, you're done and can compile Fernschreiber using the Sailfish SDK. If you want to build TDLib for yourself, please keep on reading. diff --git a/rpm/harbour-fernschreiber.changes b/rpm/harbour-fernschreiber.changes index 768e8ac..a138beb 100644 --- a/rpm/harbour-fernschreiber.changes +++ b/rpm/harbour-fernschreiber.changes @@ -12,6 +12,26 @@ # * date Author's Name version-release # - Summary of changes +* Sun Dec 03 2023 Sebastian J. Wolf 0.17 +- Update to TDLib 1.8.21, expect some hiccups ;) +- Added contacts sync (OpenRepos builds only) +- Tweaks to reaction handling (opens now on double click or click + star) +- Option to jump to quoted message +- Option to highlight unread conversations +- Option to suppress notification previews +- Option to append last message content to notifications +- Added "unread mention" indicator to chat list +- Improve message when search yields no results +- New unread info for chats with high amount of unread messages +- Setting for session inactivity timeout +- UI improvements in landscape mode +- Fix: Restore video functionality on SFOS 4.5 +- Fix: Chat list timestamp now updated more reliably +- Fix: Faster reconnect after network changes +- Fix: Some URLs couldn't be opened +- Updated translations for several languages +- Thanks to monich, nephros, arustg, jgibbon, carlosgonz0, okruhliak, dscheinah, pherjung and mbarashkov for your contributions + * Sun Jun 12 2022 Sebastian J. Wolf 0.16 - Support message reactions - Support t.me/+... links diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 5f26d72..224bf45 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 11 +Release: 12 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 27e4f25..82dd0f5 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 11 +Release: 12 # 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 From ab647e6e4d38f9cdd15c78efcbdf503946e4dd52 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 3 Dec 2023 14:30:57 +0100 Subject: [PATCH 48/52] Switch to gh tool for release creation, see https://github.com/actions/runner-images/issues/8362 --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ef7c334..566aae9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -84,7 +84,7 @@ jobs: assets+=("-a" "$asset") done tag_name="${GITHUB_REF##*/}" - hub release create "${assets[@]}" -m "$tag_name" "$tag_name" + gh release create "$tag_name" "${assets[@]}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -97,6 +97,6 @@ jobs: assets+=("-a" "$asset") done tag_name="${GITHUB_REF##*/}" - hub release create -p "${assets[@]}" -m "$tag_name" -m "This is a pre-release for testing purposes only. It may or may not be unstable." -m "Join the Telegram group to help out: https://github.com/Wunderfitz/harbour-fernschreiber/issues/162" "$tag_name" + gh release create "$tag_name" -p -n "This is a pre-release for testing purposes only. It may or may not be unstable." "${assets[@]}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a1277fe79a3973d0c2072c839b2858305e7d923d Mon Sep 17 00:00:00 2001 From: free software <45316884+carlosgonz0@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:18:30 -0500 Subject: [PATCH 49/52] Improvements: harbour-fernschreiber-es.ts (#544) --- translations/harbour-fernschreiber-es.ts | 130 +++++++++++------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 158d540..5b9cf21 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -45,7 +45,7 @@ About Telegram - Telegram + Telegrama This product uses the Telegram API but is not endorsed or certified by Telegram. @@ -173,7 +173,7 @@ New Secret Chat - Crear conversación secreta + Crear Charla Secreta Unmute Chat @@ -193,7 +193,7 @@ Loading common chats… chats you have in common with a user - Cargando conversaciones comunes… + Cargando charlas comunes… Loading group members… @@ -274,11 +274,11 @@ Unpin chat - Desanclar conversación + Desanclar charla Pin chat - Anclar conversación + Anclar charla Unmute chat @@ -339,7 +339,7 @@ This chat is empty. - Esta conversación está vacía. + Esta charla está vacía. Leave Chat @@ -351,7 +351,7 @@ Leaving chat - Saliendo de conversación + Saliendo de charla You joined the chat %1 @@ -405,15 +405,15 @@ This secret chat is not yet ready. Your chat partner needs to go online first. - Esta conversación secreta no está lista. El contacto no está conectado. + Esta charla secreta no está lista. El contacto no está conectado. Closing chat - Cerrando la conversación + Cerrando charla Close Chat - Cerrar conversación + Cerrar charla Search in Chat @@ -473,11 +473,11 @@ Deleting chat - Borrando la conversación + Borrando charla Delete Chat - Borrar conversación + Borrar Charla Deleted User @@ -492,11 +492,11 @@ ChatSelectionPage Select Chat - Seleccionar conversación + Seleccionar Charla You don't have any chats yet. - No hay conversaciones. + No hay charlas. @@ -536,7 +536,7 @@ chats conversación - conversaciones + charlas @@ -577,7 +577,7 @@ Change Chat Info member permission - Cambiar detalles de conversación + Cambiar detalles de Charla Invite Users @@ -612,7 +612,7 @@ Set how long every chat member has to wait between Messages - Establecer cuánto tiempo debe esperar cada miembro de conversación entre mensajes + Establecer cuánto tiempo debe esperar cada miembro de charla entre Mensajes @@ -669,7 +669,7 @@ have registered with Telegram myself - registrado a Telegram + registrado a Telegrama has registered with Telegram @@ -696,11 +696,11 @@ left this chat myself - dejó esta conversación + dejó esta charla left this chat - dejó esta conversación + dejó esta charla sent a voice note @@ -755,7 +755,7 @@ changed the chat photo myself - cambió la foto de la conversación + cambió foto de charla changed the chat photo @@ -764,7 +764,7 @@ deleted the chat photo myself - borró foto de conversación + borró foto de charla deleted the chat photo @@ -773,11 +773,11 @@ changed the secret chat TTL setting myself - cambió ajustes TTL en conversación secreta + cambió ajustes TTL en charla secreta changed the secret chat TTL setting - cambió ajustes TTL en conversación secreta + cambió ajustes TTL en charla secreta upgraded this group to a supergroup @@ -796,11 +796,11 @@ created a screenshot in this chat myself - creó pantallazo a esta conversación + creó pantallazo a esta charla created a screenshot in this chat - creó pantallazo a esta conversación + creó pantallazo a esta charla sent an unsupported message @@ -853,21 +853,21 @@ has added %1 to the chat - ha añadido %1 a conversación + ha añadido %1 a charla has removed %1 from the chat - ha quitado %1 de conversación + ha quitado %1 de charla have added %1 to the chat myself - ha añadido %1 a conversación + ha añadido %1 a charla have removed %1 from the chat myself - ha quitado %1 de conversación + ha quitado %1 de charla scored %Ln points @@ -887,11 +887,11 @@ sent a game myself - envió juego + envió un juego sent a game - envió juego + envió un juego sent a video note @@ -1211,7 +1211,7 @@ Loading chat list... - cargando lista de conversación... + cargando lista de charla... Settings @@ -1219,11 +1219,11 @@ You don't have any chats yet. - No hay conversaciones. + No hay charlas. New Chat - Crear conversación + Crear Charla Filter your chats... @@ -1489,7 +1489,7 @@ Show stickers as emojis - Mostrar pegatinas como emoticonos + Mostrar pegatinas como Emoticonos Only display emojis instead of the actual stickers @@ -1497,7 +1497,7 @@ Show stickers as images - Mostrar pegatinas como imágenes + Mostrar pegatinas como Imágenes Show background for stickers and align them centrally like images @@ -1505,7 +1505,7 @@ Animate stickers - Mostrar pegatinas animadas + Mostrar pegatinas Animadas @@ -1524,15 +1524,15 @@ Focus text input on chat open - Enfocar entrada de texto a conversación + Enfocar entrada de texto de Charla Focus the text input area when entering a chat - Enfoca área de entrada de texto al ingresar a conversación + Enfoca área de entrada de texto al ingresar a charla Focus text input area after send - Enfocar área de entrada de texto + Enfocar área de entrada de Texto Focus the text input area after sending a message @@ -1540,11 +1540,11 @@ Delay before marking messages as read - Marcar mensajes como leídos + Marcar mensajes como Leídos Fernschreiber will wait a bit before messages are marked as read - Si esta habilitado, apl espera un segundo hasta que mensaje que está en pantalla se marque como leído. Si deshabilita esta función, mensajes se marcarán inmediatamente como leído una vez que esté en pantalla sin desplazarse a mensaje + Si esta habilitado, Apl espera un segundo hasta que mensaje que está en monitor se marque como leído. Si deshabilita esta función, mensajes se marcarán inmediatamente como leído una vez que esté en monitor sin desplazarse a mensaje Open-with menu integration @@ -1576,19 +1576,19 @@ Notification turns on the display - Mostrar notificación por pantalla + Mostrar notificación por Monitor Enable notification sounds - Habilitar sonidos notificación + Habilitar sonidos de Notificación When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings. - Cuando sonidos están habilitados, Ferni utilizará sonido de notificación actual de Sailfish OS para los grupos, que se puede ajustar a configuración del sistema. + Cuando los sonidos están habilitados, Ferni utilizará sonido de notificación actual de Sailfish OS para los grupos, que se puede ajustar a configuración del sistema. Always append message preview to notifications - Agregar vista previa mensaje a notificaciones + Vista previa de mensaje en Notificaciones In addition to showing the number of unread messages, the latest message will also be appended to notifications. @@ -1596,15 +1596,15 @@ Highlight unread messages - Resaltar mensajes no leídos + Resaltar mensajes no Leídos Highlight Conversations with unread messages - Resaltar conversaciones a mensajes no leídos + Resalta la charla en mensajes no leídos Hide content in notifications - Ocultar contenido a notificaciones + Ocultar contenido de notificaciones Go to quoted message @@ -1630,7 +1630,7 @@ Allow chat invites - Permitir invitaciones de grupo + Permitir invitaciones de Grupo Privacy setting for managing whether you can be invited to chats. @@ -1650,7 +1650,7 @@ Allow finding by phone number - Permitir buscarme por número + Permitir buscarme por Número Privacy setting for managing whether you can be found by your phone number. @@ -1658,7 +1658,7 @@ Show link in forwarded messages - Mostrar enlace a mensajes reenviados + Mostrar enlace a mensajes Reenviados Privacy setting for managing whether a link to your account is included in forwarded messages. @@ -1666,7 +1666,7 @@ Show phone number - Mostrar número telefónico + Mostrar número Telefónico Privacy setting for managing whether your phone number is visible. @@ -1674,7 +1674,7 @@ Show profile photo - Mostrar foto de perfil + Mostrar foto de Perfil Privacy setting for managing whether your profile photo is visible. @@ -1682,7 +1682,7 @@ Show status - Mostrar estado + Mostrar Estado Privacy setting for managing whether your online status is visible. @@ -1690,7 +1690,7 @@ Allow sending Location to inline bots - Enviar ubicación de Robot enlínea + Enviar ubicación de Robot Enlínea Some inline bots request location data when using them @@ -1767,15 +1767,15 @@ Enable online-only mode - Modo solo enlínea + Modo solo Enlínea Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. - Deshabilita almacenamiento en caché sin conexión. Algunas funciones pueden estar limitadas o ausentes en este modo. Se requiere reiniciar Ferni para efecto. + Deshabilita el almacenamiento en caché sin conexión. Algunas funciones pueden estar limitadas o ausentes en este modo. Se requiere reiniciar Ferni para efecto. Enable storage optimizer - Optimizador de almacenamiento + Optimizar Almacenamiento @@ -1845,7 +1845,7 @@ Synchronize Contacts with Telegram - Sincronizar Telegram + Sincronizar Telegrama @@ -2226,12 +2226,12 @@ changed the secret chat TTL setting myself; TTL = Time To Live - cambió ajustes de TTL de conversación secreta + cambió ajustes de TTL de charla secreta changed the secret chat TTL setting TTL = Time To Live - cambió ajustes de TTL de conversación secreta + cambió ajustes de TTL de charla secreta upgraded this group to a supergroup @@ -2250,11 +2250,11 @@ created a screenshot in this chat myself - creó pantallazo a conversación + creó pantallazo de charla created a screenshot in this chat - creó pantallazo a conversación + creó pantallazo a charla sent an unsupported message From 047ea51d0ed6d3dd1bbf4b537628e61fbdbf1916 Mon Sep 17 00:00:00 2001 From: okruhliak <47862310+okruhliak@users.noreply.github.com> Date: Mon, 4 Dec 2023 22:19:07 +0100 Subject: [PATCH 50/52] Update harbour-fernschreiber-sk.ts (#545) --- translations/harbour-fernschreiber-sk.ts | 38 ++++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index bee3622..c5dc16f 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -495,7 +495,7 @@ Double-tap on a message to choose a reaction - + Dvojitým klepnutím na správu vybrať reakciu @@ -1615,31 +1615,31 @@ Always append message preview to notifications - + K upozorneniam vždy pripojiť ukážku správy In addition to showing the number of unread messages, the latest message will also be appended to notifications. - + Okrem zobrazenia počtu neprečítaných správ pripojiť k upozorneniam aj najnovšiu správu. Highlight unread messages - + Zvýrazniť neprečítané správy Highlight Conversations with unread messages - + Zvýrazniť konverzácie s neprečítanými správami Hide content in notifications - + V upozorneniach skryť obsah Go to quoted message - + Prejsť na citovanú správu When tapping a quoted message, open it in chat instead of showing it in an overlay. - + Citovanú správu otvoriť v čete namiesto v náhľade. @@ -1752,39 +1752,39 @@ %1 day(s) - - - - + + %1 deň + %1 dni + %1 dní 1 week - + 1 týždeň 1 month - + 1 mesiac 3 months - + 3 mesiace 6 months - + 6 mesiacov 1 year - + 1 rok Session Timeout - + Časový limit relácie Inactive sessions will be terminated after this timeframe - + Neaktívne relácie budú po tomto časovom rámci ukončené From 2fad48e3595094410d986f7decfa0e1cb3acb3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Engelbrektson?= Date: Mon, 4 Dec 2023 22:19:53 +0100 Subject: [PATCH 51/52] Update harbour-fernschreiber-sv.ts (#547) Update Swedish translation --- translations/harbour-fernschreiber-sv.ts | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 61b8abe..6617ef1 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -185,7 +185,7 @@ ID has been copied to the clipboard. - + ID har kopierats till urklipp. @@ -485,7 +485,7 @@ Double-tap on a message to choose a reaction - + Dubbeltryck på ett meddelande för att välja en reaktion @@ -1170,7 +1170,7 @@ No contacts found. - + Inga kontakter hittades. @@ -1588,31 +1588,31 @@ Always append message preview to notifications - + Visa alltid förhandsgranskning av meddelanden i aviseringar In addition to showing the number of unread messages, the latest message will also be appended to notifications. - + Förutom att visa antalet olästa meddelanden kommer det senaste meddelandet också att visas i aviseringarna. Highlight unread messages - + Färgmarkera olästa meddelanden Highlight Conversations with unread messages - + Färgmarkera konversationer med olästa meddelanden Hide content in notifications - + Dölj innehåll i aviseringar Go to quoted message - + Gå till citerat meddelande When tapping a quoted message, open it in chat instead of showing it in an overlay. - + Vid tryck på ett citerat meddelande öppnas det i chatten istället för att visas i ett överlägg. @@ -1725,38 +1725,38 @@ %1 day(s) - - - + + %1 dag + %1 dagar 1 week - + 1 vecka 1 month - + 1 månad 3 months - + 3 månader 6 months - + 6 månader 1 year - + 1 år Session Timeout - + Tidsgräns för session Inactive sessions will be terminated after this timeframe - + Inaktiva sessioner avslutas efter den här tidsramen From e0019d33d6f3f7dbbdb7d1815f7da1de2e2bc337 Mon Sep 17 00:00:00 2001 From: Mikhail Barashkov Date: Mon, 1 Jan 2024 19:30:57 +0300 Subject: [PATCH 52/52] Fix not all possible destinations shown to forward a message. --- qml/js/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/js/functions.js b/qml/js/functions.js index 5199d82..f9454d3 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -517,7 +517,7 @@ function handleErrorMessage(code, message) { } function getMessagesNeededForwardPermissions(messages) { - var neededPermissions = ["can_send_messages"] + var neededPermissions = ["can_send_basic_messages"] var mediaMessageTypes = ["messageAudio", "messageDocument", "messagePhoto", "messageVideo", "messageVideoNote", "messageVoiceNote"] var otherMessageTypes = ["messageAnimation", "messageGame", "messageSticker"]