Open chat directly from notification

This commit is contained in:
Sebastian J. Wolf 2020-09-15 21:17:44 +02:00
parent 266a72036b
commit d39b1c4a10
3 changed files with 21 additions and 1 deletions

View file

@ -43,6 +43,19 @@ Page {
}
}
Connections {
target: dBusAdaptor
onPleaseOpenMessage: {
console.log("[OverviewPage] Opening chat from external call...")
if (chatListCreated) {
if (status !== PageStatus.Active) {
pageStack.pop(pageStack.find( function(page){ return(page._depth === 0)} ), PageStackAction.Immediate);
}
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : tdLibWrapper.getChat(chatId) });
}
}
}
Timer {
id: chatListCreatedTimer
interval: 500
@ -201,7 +214,7 @@ Page {
model: chatListModel
delegate: ListItem {
id: chatListItem
id: chatListViewItem
contentHeight: chatListRow.height + chatListSeparator.height + 2 * Theme.paddingMedium
contentWidth: parent.width

View file

@ -271,6 +271,12 @@ QVariantMap TDLibWrapper::getSuperGroup(const QString &groupId)
return this->superGroups.value(groupId).toMap();
}
QVariantMap TDLibWrapper::getChat(const QString &chatId)
{
qDebug() << "[TDLibWrapper] Returning chat information for ID " << chatId;
return this->chats.value(chatId).toMap();
}
void TDLibWrapper::copyFileToDownloads(const QString &filePath)
{
qDebug() << "[TDLibWrapper] Copy file to downloads " << filePath;

View file

@ -69,6 +69,7 @@ public:
Q_INVOKABLE QVariantMap getUnreadChatInformation();
Q_INVOKABLE QVariantMap getBasicGroup(const QString &groupId);
Q_INVOKABLE QVariantMap getSuperGroup(const QString &groupId);
Q_INVOKABLE QVariantMap getChat(const QString &chatId);
Q_INVOKABLE void copyFileToDownloads(const QString &filePath);
Q_INVOKABLE void openFileOnDevice(const QString &filePath);
Q_INVOKABLE void controlScreenSaver(const bool &enabled);