mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 06:08:48 +03:00
Make device verification request dialogs easier to understand.
This commit is contained in:
parent
74e32dd96b
commit
81762119b9
3 changed files with 31 additions and 2 deletions
|
@ -4,7 +4,7 @@ import QtQuick.Layouts 1.10
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
Pane {
|
Pane {
|
||||||
property string title: flow.sender ? qsTr("Send Device Verification Request") : qsTr("Recieved Device Verification Request")
|
property string title: flow.sender ? qsTr("Send Verification Request") : qsTr("Recieved Verification Request")
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 16
|
spacing: 16
|
||||||
|
@ -14,7 +14,23 @@ Pane {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
text: flow.sender ? qsTr("To ensure that no malicious user can eavesdrop on your encrypted communications, you can verify this device.") : qsTr("The device was requested to be verified")
|
text: {
|
||||||
|
if (flow.sender) {
|
||||||
|
if (flow.isSelfVerification)
|
||||||
|
return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify %1 now?").arg(flow.deviceId);
|
||||||
|
else
|
||||||
|
return qsTr("To ensure that no malicious user can eavesdrop on your encrypted communications you can verify the other party.");
|
||||||
|
} else {
|
||||||
|
// Self verification
|
||||||
|
|
||||||
|
if (!flow.isSelfVerification && flow.isDeviceVerification)
|
||||||
|
return qsTr("%1 has requested to verify their device %2.").arg(flow.userId).arg(flow.deviceId);
|
||||||
|
else if (!flow.isSelfVerification && !flow.isDeviceVerification)
|
||||||
|
return qsTr("%1 using the device %2 has requested to be verified.").arg(flow.userId).arg(flow.deviceId);
|
||||||
|
else
|
||||||
|
return qsTr("Your devices (%1) has requested to be verified.").arg(flow.deviceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
color: colors.text
|
color: colors.text
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,6 +505,12 @@ DeviceVerificationFlow::getSasList()
|
||||||
return this->sasList;
|
return this->sasList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DeviceVerificationFlow::isSelfVerification() const
|
||||||
|
{
|
||||||
|
return this->toClient.to_string() == http::client()->user_id().to_string();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeviceVerificationFlow::setEventId(std::string event_id_)
|
DeviceVerificationFlow::setEventId(std::string event_id_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,8 @@ class DeviceVerificationFlow : public QObject
|
||||||
Q_PROPERTY(QString deviceId READ getDeviceId CONSTANT)
|
Q_PROPERTY(QString deviceId READ getDeviceId CONSTANT)
|
||||||
Q_PROPERTY(bool sender READ getSender CONSTANT)
|
Q_PROPERTY(bool sender READ getSender CONSTANT)
|
||||||
Q_PROPERTY(std::vector<int> sasList READ getSasList CONSTANT)
|
Q_PROPERTY(std::vector<int> sasList READ getSasList CONSTANT)
|
||||||
|
Q_PROPERTY(bool isDeviceVerification READ isDeviceVerification CONSTANT)
|
||||||
|
Q_PROPERTY(bool isSelfVerification READ isSelfVerification CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum State
|
enum State
|
||||||
|
@ -129,6 +131,11 @@ public:
|
||||||
// setters
|
// setters
|
||||||
void setDeviceId(QString deviceID);
|
void setDeviceId(QString deviceID);
|
||||||
void setEventId(std::string event_id);
|
void setEventId(std::string event_id);
|
||||||
|
bool isDeviceVerification() const
|
||||||
|
{
|
||||||
|
return this->type == DeviceVerificationFlow::Type::ToDevice;
|
||||||
|
}
|
||||||
|
bool isSelfVerification() const;
|
||||||
|
|
||||||
void callback_fn(const UserKeyCache &res, mtx::http::RequestErr err, std::string user_id);
|
void callback_fn(const UserKeyCache &res, mtx::http::RequestErr err, std::string user_id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue