GODT-1344: notifications for ApiCertError and NoActiveKeyForRecipient.

Phase 1: added the two event in bridge-gui-tester.
Phase 2: implemented QML notifications.
This commit is contained in:
Xavier Michelon
2022-10-12 09:42:52 +02:00
parent 9035dc6bf7
commit b2efed71d3
6 changed files with 106 additions and 29 deletions

View File

@ -68,6 +68,7 @@ Dialog {
Label {
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
Layout.bottomMargin: 8
colorScheme: root.colorScheme
text: root.notification.title

View File

@ -128,4 +128,14 @@ Item {
colorScheme: root.colorScheme
notification: root.notifications.rebuildKeychain
}
NotificationDialog {
colorScheme: root.colorScheme
notification: root.notifications.apiCertIssue
}
NotificationDialog {
colorScheme: root.colorScheme
notification: root.notifications.noActiveKeyForRecipient
}
}

View File

@ -77,7 +77,9 @@ QtObject {
root.deleteAccount,
root.noKeychain,
root.rebuildKeychain,
root.addressChanged
root.addressChanged,
root.apiCertIssue,
root.noActiveKeyForRecipient
]
// Connection
@ -1051,4 +1053,63 @@ QtObject {
}
]
}
property Notification apiCertIssue: Notification {
title: qsTr("Unable to establish a \nsecure connection to \nProton servers")
description: qsTr("Bridge cannot verify the authenticity of Proton servers on your current network due to a TLS certificate error. " +
"Start Bridge again after ensuring your connection is secure and/or connecting to a VPN. Learn more about TLS pinning " +
"<a href=\"https://proton.me/blog/tls-ssl-certificate#Extra-security-precautions-taken-by-ProtonMail\">here</a>.")
brief: title
icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Danger
group: Notifications.Group.Dialogs | Notifications.Group.Connection
Connections {
target: Backend
function onApiCertIssue() {
root.apiCertIssue.active = true
}
}
action: [
Action {
text: qsTr("Quit Bridge")
onTriggered: {
root.apiCertIssue.active = false;
Backend.quit()
}
}
]
}
property Notification noActiveKeyForRecipient: Notification {
title: qsTr("Unable to send \nencrypted message")
description: "#PlaceholderText#"
icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Danger
group: Notifications.Group.Dialogs | Notifications.Group.Connection
Connections {
target: Backend
function onNoActiveKeyForRecipient(email) {
root.noActiveKeyForRecipient.description = qsTr("There are no active keys to encrypt your message to %1. "+
"Please update the setting for this contact.").arg(email)
root.noActiveKeyForRecipient.active = true
}
}
action: [
Action {
text: qsTr("OK")
onTriggered: {
root.noActiveKeyForRecipient.active = false
}
}
]
}
}