Compare commits

...

10 commits

Author SHA1 Message Date
Sebastian Wolf
58382ac1b6
Test build no.4 2023-11-20 22:34:52 +01:00
Sebastian Wolf
5b2fa38f7e
Display reactions on last message again 2023-11-20 21:53:57 +01:00
Sebastian Wolf
8d59ee4c00
Restore search in chats 2023-11-20 21:27:55 +01:00
Sebastian Wolf
acfcfd3ca4
Minor tweaks for the new session timout setting 2023-11-19 22:51:33 +01:00
Slava Monich
195e255f08
Added UI for configuring session inactivity timeout (#527) 2023-11-19 21:54:50 +01:00
Sebastian Wolf
8531a46015
More places affected by new username handling 2023-11-19 21:49:00 +01:00
Sebastian Wolf
f133586aa2
Hide unsupported emojis for reactions 2023-11-19 14:36:06 +01:00
Sebastian Wolf
ea89ef4fcd
Make replies backward-compatible again 2023-11-19 14:24:19 +01:00
Sebastian Wolf
00deaa79fd
Fix chat permissions handling 2023-11-19 13:34:31 +01:00
Slava Monich
61e3e366e6
Tweaked notification feedback settings UI (#526) 2023-11-19 12:52:18 +01:00
29 changed files with 720 additions and 202 deletions

View file

@ -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

View file

@ -133,8 +133,12 @@ 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);
}
}
@ -279,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;
@ -687,7 +692,7 @@ ListItem {
Image {
id: emojiPicture
source: Emoji.getEmojiPath(modelData)
width: Theme.fontSizeLarge
width: status === Image.Ready ? Theme.fontSizeLarge : 0
height: Theme.fontSizeLarge
}

View file

@ -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("<a style=\"text-decoration: none; font-weight: bold; color:"+Theme.primaryColor+"\" href=\"userId://" + message.via_bot_user_id + "\">@" + Emoji.emojify(botUserInformation.username, font.pixelSize)+"</a>")
text: qsTr("via %1", "message posted via bot user").arg("<a style=\"text-decoration: none; font-weight: bold; color:"+Theme.primaryColor+"\" href=\"userId://" + message.via_bot_user_id + "\">@" + Emoji.emojify(botUserInformation.usernames.editable_username, font.pixelSize)+"</a>")
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();
}

View file

@ -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"
})
}

View file

@ -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 {

View file

@ -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

View file

@ -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
}
}
}
}

View file

@ -30,141 +30,183 @@ 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("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 {
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
}
}
}
}

View file

@ -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", {

View file

@ -12,7 +12,7 @@ Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.17
Release: 2
Release: 4
Group: Qt/Qt
License: LICENSE
URL: http://werkwolf.eu/

View file

@ -1,7 +1,7 @@
Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.17
Release: 2
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

View file

@ -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();

View file

@ -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
@ -712,8 +720,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)

View file

@ -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);
@ -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);

View file

@ -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");
@ -185,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)));
@ -411,19 +413,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;
}
@ -1527,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);
@ -1838,9 +1839,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);
}
@ -1854,7 +1855,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);
}

View file

@ -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);

View file

@ -1599,7 +1599,7 @@
<translation>Unterhaltungen mit ungelesenen Nachrichten hervorheben</translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation>Inhalte in Hinweisen verbergen</translation>
</message>
</context>
@ -1711,6 +1711,41 @@
<source>Sessions</source>
<translation>Sitzungen</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation>
<numerusform>%1 Tag</numerusform>
<numerusform>%1 Tage</numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation>1 Woche</translation>
</message>
<message>
<source>1 month</source>
<translation>1 Monat</translation>
</message>
<message>
<source>3 months</source>
<translation>3 Monate</translation>
</message>
<message>
<source>6 months</source>
<translation>6 Monate</translation>
</message>
<message>
<source>1 year</source>
<translation>1 Jahr</translation>
</message>
<message>
<source>Session Timeout</source>
<translation>Timeout von Sitzungen</translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation>Inaktive Sitzungen werden nach dieser Zeitdauer abgeschaltet</translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1601,7 +1601,7 @@ messages</numerusform>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1713,6 +1713,41 @@ messages</numerusform>
<source>Active since: %1, last online: %2</source>
<translation>Active since: %1, last online: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation>
<numerusform>%1 day</numerusform>
<numerusform>%1 days</numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1599,7 +1599,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1711,6 +1711,41 @@
<source>Active since: %1, last online: %2</source>
<translation>Activo desde: %1, último en línea: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1600,7 +1600,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1712,6 +1712,41 @@
<source>Active since: %1, last online: %2</source>
<translation>Aktiivinen %1 alkaen, viimeksi paikalla: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1599,7 +1599,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1711,6 +1711,41 @@
<source>Active since: %1, last online: %2</source>
<translation>Actif depuis : %1, en ligne : %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1572,7 +1572,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1684,6 +1684,40 @@
<source>Active since: %1, last online: %2</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1599,7 +1599,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1711,6 +1711,41 @@
<source>Active since: %1, last online: %2</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1626,7 +1626,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1738,6 +1738,42 @@
<source>Active since: %1, last online: %2</source>
<translation>Aktywny od: %1, ostatnio aktywny: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1629,7 +1629,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1741,6 +1741,42 @@
<source>Active since: %1, last online: %2</source>
<translation>Активен с: %1, был онлайн: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1626,7 +1626,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1738,6 +1738,42 @@
<source>Active since: %1, last online: %2</source>
<translation>Aktívna od: %1, naposledy pripojená: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1599,7 +1599,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1711,6 +1711,41 @@
<source>Active since: %1, last online: %2</source>
<translation>Aktiv sedan: %1, senast online: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1573,7 +1573,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1685,6 +1685,40 @@
<source>Active since: %1, last online: %2</source>
<translation>: %1, 线: %2</translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>

View file

@ -1599,7 +1599,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Hide content in Notifications</source>
<source>Hide content in notifications</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1711,6 +1711,41 @@
<source>Active since: %1, last online: %2</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>%1 day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>1 week</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 month</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>3 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>6 months</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>1 year</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Session Timeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Inactive sessions will be terminated after this timeframe</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsStorage</name>