Add DeviceVerificationList to keep track of all flows and Popup on

recieving start or request
This commit is contained in:
CH Chethan Reddy 2020-06-17 23:58:35 +05:30
parent 1eb162cb6f
commit 41b6ef0c32
9 changed files with 203 additions and 62 deletions

View file

@ -102,21 +102,23 @@ Page {
Component { Component {
id: deviceVerificationDialog id: deviceVerificationDialog
DeviceVerification {} DeviceVerification {}
}
Component{
id: deviceVerificationFlow
DeviceVerificationFlow {}
} }
Connections { Connections {
target: timelineManager target: timelineManager
onDeviceVerificationRequest: { onNewDeviceVerificationRequest: {
var dialog = deviceVerificationDialog.createObject(timelineRoot, {flow: deviceVerificationFlow}); var newFlow = deviceVerificationFlow.createObject(timelineRoot,
{userId : userId,sender: false,deviceId : deviceId,tranId:transactionId});
deviceVerificationList.add(newFlow.tranId);
var dialog = deviceVerificationDialog.createObject(timelineRoot,
{flow: newFlow,sender: false});
dialog.show(); dialog.show();
} }
} }
Button {
text: "test device verification"
onClicked: timelineManager.startDummyVerification()
z: 5
}
Label { Label {
visible: !timelineManager.timeline && !timelineManager.isInitialSync visible: !timelineManager.timeline && !timelineManager.isInitialSync
anchors.centerIn: parent anchors.centerIn: parent

View file

@ -33,8 +33,9 @@ ApplicationWindow{
id: deviceVerificationDialog id: deviceVerificationDialog
DeviceVerification {} DeviceVerification {}
} }
DeviceVerificationFlow { Component{
id: deviceVerificationFlow id: deviceVerificationFlow
DeviceVerificationFlow {}
} }
background: Item{ background: Item{
@ -111,10 +112,11 @@ ApplicationWindow{
id: verifyButton id: verifyButton
text:"Verify" text:"Verify"
onClicked: { onClicked: {
deviceVerificationFlow.userId = user_data.userId var newFlow = deviceVerificationFlow.createObject(userProfileDialog,
deviceVerificationFlow.deviceId = model.deviceID {userId : user_data.userId,sender: true,deviceId : model.deviceID});
deviceVerificationList.add(newFlow.tranId);
var dialog = deviceVerificationDialog.createObject(userProfileDialog, var dialog = deviceVerificationDialog.createObject(userProfileDialog,
{flow: deviceVerificationFlow,sender: true}); {flow: newFlow,sender: true});
dialog.show(); dialog.show();
} }
contentItem: Text { contentItem: Text {

View file

@ -75,7 +75,12 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "Cancel" text: "Cancel"
onClicked: { dialog.close(); flow.cancelVerification(); } onClicked: {
dialog.close();
flow.cancelVerification();
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -127,7 +132,12 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "Deny" text: "Deny"
onClicked: { dialog.close(); flow.cancelVerification(); } onClicked: {
dialog.close();
flow.cancelVerification();
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -166,7 +176,12 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "Cancel" text: "Cancel"
onClicked: { dialog.close(); flow.cancelVerification(); } onClicked: {
dialog.close();
flow.cancelVerification();
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -212,7 +227,12 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "They do not match!" text: "They do not match!"
onClicked: { dialog.close(); flow.cancelVerification(); } onClicked: {
dialog.close();
flow.cancelVerification();
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -346,7 +366,12 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "They do not match!" text: "They do not match!"
onClicked: { dialog.close(); flow.cancelVerification(); } onClicked: {
dialog.close();
flow.cancelVerification();
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -385,7 +410,12 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
text: "Cancel" text: "Cancel"
onClicked: { dialog.close(); flow.cancelVerification(); } onClicked: {
dialog.close();
flow.cancelVerification();
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
@ -419,7 +449,11 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: "Close" text: "Close"
onClicked: dialog.close() onClicked: {
dialog.close()
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
} }
} }
@ -450,7 +484,11 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: "Close" text: "Close"
onClicked: dialog.close() onClicked: {
dialog.close()
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
} }
} }
@ -481,7 +519,11 @@ ApplicationWindow {
Button { Button {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: "Close" text: "Close"
onClicked: dialog.close() onClicked: {
dialog.close()
deviceVerificationList.remove(flow.tranId);
delete flow;
}
} }
} }
} }

View file

@ -26,8 +26,8 @@
#include "Cache.h" #include "Cache.h"
#include "Cache_p.h" #include "Cache_p.h"
#include "ChatPage.h" #include "ChatPage.h"
#include "EventAccessors.h"
#include "DeviceVerificationFlow.h" #include "DeviceVerificationFlow.h"
#include "EventAccessors.h"
#include "Logging.h" #include "Logging.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "MatrixClient.h" #include "MatrixClient.h"

View file

@ -1,7 +1,7 @@
#include "DeviceVerificationFlow.h" #include "DeviceVerificationFlow.h"
#include "ChatPage.h" #include "ChatPage.h"
#include "Logging.h" #include "Logging.h"
#include <QDateTime> #include <QDateTime>
#include <QDebug> // only for debugging #include <QDebug> // only for debugging
#include <QTimer> #include <QTimer>
@ -13,9 +13,10 @@ namespace msgs = mtx::events::msg;
DeviceVerificationFlow::DeviceVerificationFlow(QObject *) DeviceVerificationFlow::DeviceVerificationFlow(QObject *)
{ {
qRegisterMetaType<mtx::events::collections::DeviceEvents>();
timeout = new QTimer(this); timeout = new QTimer(this);
timeout->setSingleShot(true); timeout->setSingleShot(true);
if (this->sender == true)
this->transaction_id = http::client()->generate_txn_id();
connect(timeout, &QTimer::timeout, this, [this]() { connect(timeout, &QTimer::timeout, this, [this]() {
emit timedout(); emit timedout();
this->deleteLater(); this->deleteLater();
@ -73,6 +74,12 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *)
timeout->start(TIMEOUT); timeout->start(TIMEOUT);
} }
QString
DeviceVerificationFlow::getTransactionId()
{
return QString::fromStdString(this->transaction_id);
}
QString QString
DeviceVerificationFlow::getUserId() DeviceVerificationFlow::getUserId()
{ {
@ -91,6 +98,18 @@ DeviceVerificationFlow::getMethod()
return this->method; return this->method;
} }
bool
DeviceVerificationFlow::getSender()
{
return this->sender;
}
void
DeviceVerificationFlow::setTransactionId(QString transaction_id_)
{
this->transaction_id = transaction_id_.toStdString();
}
void void
DeviceVerificationFlow::setUserId(QString userID) DeviceVerificationFlow::setUserId(QString userID)
{ {
@ -110,6 +129,12 @@ DeviceVerificationFlow::setMethod(DeviceVerificationFlow::Method method_)
this->method = method_; this->method = method_;
} }
void
DeviceVerificationFlow::setSender(bool sender_)
{
this->sender = sender_;
}
//! accepts a verification //! accepts a verification
void void
DeviceVerificationFlow::acceptVerificationRequest() DeviceVerificationFlow::acceptVerificationRequest()
@ -119,10 +144,11 @@ DeviceVerificationFlow::acceptVerificationRequest()
req.transaction_id = this->transaction_id; req.transaction_id = this->transaction_id;
req.method = mtx::events::msg::VerificationMethods::SASv1; req.method = mtx::events::msg::VerificationMethods::SASv1;
req.key_agreement_protocol = "curve25519"; req.key_agreement_protocol = "curve25519-hkdf-sha256";
req.hash = "sha256"; req.hash = "sha256";
req.message_authentication_code = ""; req.message_authentication_code = "hkdf-hmac-sha256";
// req.short_authentication_string = ""; req.short_authentication_string = {mtx::events::msg::SASMethods::Decimal,
mtx::events::msg::SASMethods::Emoji};
req.commitment = ""; req.commitment = "";
emit this->verificationRequestAccepted(this->method); emit this->verificationRequestAccepted(this->method);
@ -132,12 +158,12 @@ DeviceVerificationFlow::acceptVerificationRequest()
http::client() http::client()
->send_to_device<mtx::events::msg::KeyVerificationAccept, ->send_to_device<mtx::events::msg::KeyVerificationAccept,
mtx::events::EventType::KeyVerificationAccept>( mtx::events::EventType::KeyVerificationAccept>(
"m.key.verification.accept", body, [](mtx::http::RequestErr err) { this->transaction_id, body, [this](mtx::http::RequestErr err) {
if (err) if (err)
nhlog::net()->warn("failed to accept verification request: {} {}", nhlog::net()->warn("failed to accept verification request: {} {}",
err->matrix_error.error, err->matrix_error.error,
static_cast<int>(err->status_code)); static_cast<int>(err->status_code));
// emit this->verificationRequestAccepted(rand() % 2 ? Emoji : Decimal); emit this->verificationRequestAccepted(rand() % 2 ? Emoji : Decimal);
}); });
} }
//! starts the verification flow //! starts the verification flow
@ -150,22 +176,23 @@ DeviceVerificationFlow::startVerificationRequest()
req.from_device = http::client()->device_id(); req.from_device = http::client()->device_id();
req.transaction_id = this->transaction_id; req.transaction_id = this->transaction_id;
req.method = mtx::events::msg::VerificationMethods::SASv1; req.method = mtx::events::msg::VerificationMethods::SASv1;
req.key_agreement_protocols = {}; req.key_agreement_protocols = {"curve25519-hkdf-sha256"};
req.hashes = {}; req.hashes = {"sha256"};
req.message_authentication_codes = {}; req.message_authentication_codes = {"hkdf-hmac-sha256", "hmac-sha256"};
// req.short_authentication_string = ""; req.short_authentication_string = {mtx::events::msg::SASMethods::Decimal,
qDebug()<<"Inside Start Verification"; mtx::events::msg::SASMethods::Emoji};
qDebug()<<this->userId;
body[this->toClient][this->deviceId.toStdString()] = req; body[this->toClient][this->deviceId.toStdString()] = req;
http::client() http::client()
->send_to_device<mtx::events::msg::KeyVerificationStart, ->send_to_device<mtx::events::msg::KeyVerificationStart,
mtx::events::EventType::KeyVerificationStart>( mtx::events::EventType::KeyVerificationStart>(
"m.key.verification.start", body, [](mtx::http::RequestErr err) { this->transaction_id, body, [body](mtx::http::RequestErr err) {
if (err) if (err)
nhlog::net()->warn("failed to start verification request: {} {}", nhlog::net()->warn("failed to start verification request: {} {}",
err->matrix_error.error, err->matrix_error.error,
static_cast<int>(err->status_code)); static_cast<int>(err->status_code));
std::cout << nlohmann::json(body).dump(2) << std::endl;
}); });
} }
//! sends a verification request //! sends a verification request
@ -177,8 +204,6 @@ DeviceVerificationFlow::sendVerificationRequest()
mtx::requests::ToDeviceMessages<mtx::events::msg::KeyVerificationRequest> body; mtx::requests::ToDeviceMessages<mtx::events::msg::KeyVerificationRequest> body;
mtx::events::msg::KeyVerificationRequest req; mtx::events::msg::KeyVerificationRequest req;
this->transaction_id = http::client()->generate_txn_id();
req.from_device = http::client()->device_id(); req.from_device = http::client()->device_id();
req.transaction_id = this->transaction_id; req.transaction_id = this->transaction_id;
req.methods.resize(1); req.methods.resize(1);
@ -190,7 +215,7 @@ DeviceVerificationFlow::sendVerificationRequest()
http::client() http::client()
->send_to_device<mtx::events::msg::KeyVerificationRequest, ->send_to_device<mtx::events::msg::KeyVerificationRequest,
mtx::events::EventType::KeyVerificationRequest>( mtx::events::EventType::KeyVerificationRequest>(
"m.key.verification.request", body, [](mtx::http::RequestErr err) { this->transaction_id, body, [](mtx::http::RequestErr err) {
if (err) if (err)
nhlog::net()->warn("failed to send verification request: {} {}", nhlog::net()->warn("failed to send verification request: {} {}",
err->matrix_error.error, err->matrix_error.error,
@ -214,7 +239,7 @@ DeviceVerificationFlow::cancelVerification()
http::client() http::client()
->send_to_device<mtx::events::msg::KeyVerificationCancel, ->send_to_device<mtx::events::msg::KeyVerificationCancel,
mtx::events::EventType::KeyVerificationCancel>( mtx::events::EventType::KeyVerificationCancel>(
"m.key.verification.cancel", body, [this](mtx::http::RequestErr err) { this->transaction_id, body, [this](mtx::http::RequestErr err) {
if (err) if (err)
nhlog::net()->warn("failed to cancel verification request: {} {}", nhlog::net()->warn("failed to cancel verification request: {} {}",
err->matrix_error.error, err->matrix_error.error,
@ -237,7 +262,7 @@ DeviceVerificationFlow::sendVerificationKey()
http::client() http::client()
->send_to_device<mtx::events::msg::KeyVerificationKey, ->send_to_device<mtx::events::msg::KeyVerificationKey,
mtx::events::EventType::KeyVerificationKey>( mtx::events::EventType::KeyVerificationKey>(
"m.key.verification.cancel", body, [](mtx::http::RequestErr err) { this->transaction_id, body, [](mtx::http::RequestErr err) {
if (err) if (err)
nhlog::net()->warn("failed to send verification key: {} {}", nhlog::net()->warn("failed to send verification key: {} {}",
err->matrix_error.error, err->matrix_error.error,
@ -260,7 +285,7 @@ DeviceVerificationFlow::sendVerificationMac()
http::client() http::client()
->send_to_device<mtx::events::msg::KeyVerificationMac, ->send_to_device<mtx::events::msg::KeyVerificationMac,
mtx::events::EventType::KeyVerificationMac>( mtx::events::EventType::KeyVerificationMac>(
"m.key.verification.cancel", body, [](mtx::http::RequestErr err) { this->transaction_id, body, [](mtx::http::RequestErr err) {
if (err) if (err)
nhlog::net()->warn("failed to send verification MAC: {} {}", nhlog::net()->warn("failed to send verification MAC: {} {}",
err->matrix_error.error, err->matrix_error.error,

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "Olm.h"
#include <MatrixClient.h> #include <MatrixClient.h>
#include <QObject> #include <QObject>
@ -9,6 +11,8 @@ class DeviceVerificationFlow : public QObject
{ {
Q_OBJECT Q_OBJECT
// Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") // Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
Q_PROPERTY(QString tranId READ getTransactionId WRITE setTransactionId)
Q_PROPERTY(bool sender READ getSender WRITE setSender)
Q_PROPERTY(QString userId READ getUserId WRITE setUserId) Q_PROPERTY(QString userId READ getUserId WRITE setUserId)
Q_PROPERTY(QString deviceId READ getDeviceId WRITE setDeviceId) Q_PROPERTY(QString deviceId READ getDeviceId WRITE setDeviceId)
Q_PROPERTY(Method method READ getMethod WRITE setMethod) Q_PROPERTY(Method method READ getMethod WRITE setMethod)
@ -22,12 +26,16 @@ public:
Q_ENUM(Method) Q_ENUM(Method)
DeviceVerificationFlow(QObject *parent = nullptr); DeviceVerificationFlow(QObject *parent = nullptr);
QString getTransactionId();
QString getUserId(); QString getUserId();
QString getDeviceId(); QString getDeviceId();
Method getMethod(); Method getMethod();
void setTransactionId(QString transaction_id_);
bool getSender();
void setUserId(QString userID); void setUserId(QString userID);
void setDeviceId(QString deviceID); void setDeviceId(QString deviceID);
void setMethod(Method method_); void setMethod(Method method_);
void setSender(bool sender_);
public slots: public slots:
//! sends a verification request //! sends a verification request
@ -55,9 +63,9 @@ private:
QString userId; QString userId;
QString deviceId; QString deviceId;
Method method; Method method;
bool sender;
QTimer *timeout = nullptr; QTimer *timeout = nullptr;
std::string transaction_id; std::string transaction_id;
mtx::identifiers::User toClient; mtx::identifiers::User toClient;
}; };
Q_DECLARE_METATYPE(mtx::events::collections::DeviceEvents)

View file

@ -60,5 +60,4 @@ private:
EmojiCategory category_ = EmojiCategory::Search; EmojiCategory category_ = EmojiCategory::Search;
emoji::Provider emoji_provider_; emoji::Provider emoji_provider_;
}; };
} }

View file

@ -16,12 +16,38 @@
#include "dialogs/ImageOverlay.h" #include "dialogs/ImageOverlay.h"
#include "emoji/EmojiModel.h" #include "emoji/EmojiModel.h"
#include "emoji/Provider.h" #include "emoji/Provider.h"
#include "../ui/UserProfile.h"
#include "src/ui/UserProfile.h" #include "src/ui/UserProfile.h"
#include "src/ui/UserProfileModel.h" #include "src/ui/UserProfileModel.h"
Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents) Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents)
namespace msgs = mtx::events::msg;
void
DeviceVerificationList::add(QString tran_id)
{
this->dv_list.push_back(tran_id);
}
void
DeviceVerificationList::remove(QString tran_id)
{
for (QVector<QString>::iterator it = 0; it != (this->dv_list).end(); ++it) {
if (*it == tran_id) {
this->dv_list.erase(it);
break;
}
}
}
bool
DeviceVerificationList::exist(QString tran_id)
{
for (int i = 0; i < (this->dv_list).size(); ++i) {
if (dv_list[i] == tran_id)
return true;
}
return false;
}
void void
TimelineViewManager::updateEncryptedDescriptions() TimelineViewManager::updateEncryptedDescriptions()
{ {
@ -63,12 +89,12 @@ TimelineViewManager::userColor(QString id, QColor background)
return userColors.value(id); return userColors.value(id);
} }
QString // QString
TimelineViewManager::userPresence(QString id) const // TimelineViewManager::userPresence(QString id) const
{ // {
return QString::fromStdString( // return QString::fromStdString(
mtx::presence::to_string(cache::presenceState(id.toStdString()))); // mtx::presence::to_string(cache::presenceState(id.toStdString())));
} // }
QString QString
TimelineViewManager::userStatus(QString id) const TimelineViewManager::userStatus(QString id) const
{ {
@ -81,6 +107,7 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin
, blurhashProvider(new BlurhashProvider()) , blurhashProvider(new BlurhashProvider())
, settings(userSettings) , settings(userSettings)
{ {
qRegisterMetaType<mtx::events::collections::DeviceEvents>();
qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject, qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject,
"im.nheko", "im.nheko",
1, 1,
@ -106,6 +133,7 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin
0, 0,
"EmojiCategory", "EmojiCategory",
"Error: Only enums"); "Error: Only enums");
this->dvList = new DeviceVerificationList;
#ifdef USE_QUICK_VIEW #ifdef USE_QUICK_VIEW
view = new QQuickView(); view = new QQuickView();
@ -127,6 +155,7 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin
container->setMinimumSize(200, 200); container->setMinimumSize(200, 200);
view->rootContext()->setContextProperty("timelineManager", this); view->rootContext()->setContextProperty("timelineManager", this);
view->rootContext()->setContextProperty("settings", settings.data()); view->rootContext()->setContextProperty("settings", settings.data());
view->rootContext()->setContextProperty("deviceVerificationList", this->dvList);
updateColorPalette(); updateColorPalette();
view->engine()->addImageProvider("MxcImage", imgProvider); view->engine()->addImageProvider("MxcImage", imgProvider);
view->engine()->addImageProvider("colorimage", colorImgProvider); view->engine()->addImageProvider("colorimage", colorImgProvider);
@ -141,6 +170,32 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin
&ChatPage::decryptSidebarChanged, &ChatPage::decryptSidebarChanged,
this, this,
&TimelineViewManager::updateEncryptedDescriptions); &TimelineViewManager::updateEncryptedDescriptions);
connect(dynamic_cast<ChatPage *>(parent),
&ChatPage::recievedDeviceVerificationRequest,
this,
[this](const mtx::events::collections::DeviceEvents &message) {
auto msg =
std::get<mtx::events::DeviceEvent<msgs::KeyVerificationRequest>>(message);
QString tranID = QString::fromStdString(msg.content.transaction_id);
QString deviceId = QString::fromStdString(msg.content.from_device);
QString userId = QString::fromStdString(msg.sender);
if (!(this->dvList->exist(tranID))) {
emit newDeviceVerificationRequest(tranID, userId, deviceId);
}
});
connect(dynamic_cast<ChatPage *>(parent),
&ChatPage::recievedDeviceVerificationStart,
this,
[this](const mtx::events::collections::DeviceEvents &message) {
auto msg =
std::get<mtx::events::DeviceEvent<msgs::KeyVerificationStart>>(message);
QString tranID = QString::fromStdString(msg.content.transaction_id);
QString deviceId = QString::fromStdString(msg.content.from_device);
QString userId = QString::fromStdString(msg.sender);
if (!(this->dvList->exist(tranID))) {
emit newDeviceVerificationRequest(tranID, userId, deviceId);
}
});
} }
void void
@ -468,9 +523,3 @@ TimelineViewManager::queueVideoMessage(const QString &roomid,
model->sendMessage(video); model->sendMessage(video);
} }
void
TimelineViewManager::startDummyVerification()
{
emit deviceVerificationRequest(new DeviceVerificationFlow(this));
}

View file

@ -22,6 +22,18 @@ class BlurhashProvider;
class ColorImageProvider; class ColorImageProvider;
class UserSettings; class UserSettings;
class DeviceVerificationList : public QObject
{
Q_OBJECT
public:
Q_INVOKABLE void add(QString tran_id);
Q_INVOKABLE void remove(QString tran_id);
Q_INVOKABLE bool exist(QString tran_id);
private:
QVector<QString> dv_list;
};
class TimelineViewManager : public QObject class TimelineViewManager : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -44,9 +56,8 @@ public:
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; } Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId) const; Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId) const;
Q_INVOKABLE QColor userColor(QString id, QColor background); Q_INVOKABLE QColor userColor(QString id, QColor background);
Q_INVOKABLE void startDummyVerification();
Q_INVOKABLE QString userPresence(QString id) const; // Q_INVOKABLE QString userPresence(QString id) const;
Q_INVOKABLE QString userStatus(QString id) const; Q_INVOKABLE QString userStatus(QString id) const;
signals: signals:
@ -56,7 +67,7 @@ signals:
void initialSyncChanged(bool isInitialSync); void initialSyncChanged(bool isInitialSync);
void replyingEventChanged(QString replyingEvent); void replyingEventChanged(QString replyingEvent);
void replyClosed(); void replyClosed();
void deviceVerificationRequest(DeviceVerificationFlow *deviceVerificationFlow); void newDeviceVerificationRequest(QString transactionId, QString userId, QString deviceId);
public slots: public slots:
void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids); void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids);
@ -114,4 +125,7 @@ private:
QSharedPointer<UserSettings> settings; QSharedPointer<UserSettings> settings;
QHash<QString, QColor> userColors; QHash<QString, QColor> userColors;
DeviceVerificationList *dvList;
}; };
Q_DECLARE_METATYPE(mtx::events::collections::DeviceEvents)