feat(GODT-2772): error handling for Apple Mail auto config.

This commit is contained in:
Xavier Michelon
2023-08-24 18:27:12 +02:00
parent df09d6d221
commit 958e1280d7
5 changed files with 69 additions and 16 deletions

View File

@ -794,7 +794,7 @@ Status GRPCService::InstallTLSCertificate(ServerContext *, Empty const *, Empty
event = newCertificateInstallCanceledEvent(); event = newCertificateInstallCanceledEvent();
break; break;
default: default:
event = newCertificateInstallCanceledEvent(); event = newCertificateInstallFailedEvent();
break; break;
} }
qtProxy_.sendDelayedEvent(event); qtProxy_.sendDelayedEvent(event);

View File

@ -171,7 +171,7 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: root.colorScheme
onShowBugReport: { onBugReportRequested: {
contentWrapper.showBugReport(); contentWrapper.showBugReport();
} }
onWizardEnded: { onWizardEnded: {

View File

@ -30,19 +30,20 @@ Item {
function showAutoconfig() { function showAutoconfig() {
certificateInstall.waitingForCert = false; certificateInstall.waitingForCert = false;
if (Backend.isTLSCertificateInstalled()) { if (Backend.isTLSCertificateInstalled()) {
showCertificateInstall();
} else {
showProfileInstall(); showProfileInstall();
} else {
showCertificateInstall();
} }
} }
function showCertificateInstall() { function showCertificateInstall() {
stack.currentIndex = ClientConfigAppleMail.Screen.ProfileInstall; certificateInstall.reset();
appleMailAutoconfigProfileInstallPageShow();
}
function showProfileInstall() {
stack.currentIndex = ClientConfigAppleMail.Screen.CertificateInstall; stack.currentIndex = ClientConfigAppleMail.Screen.CertificateInstall;
appleMailAutoconfigCertificateInstallPageShown(); appleMailAutoconfigCertificateInstallPageShown();
} }
function showProfileInstall() {
stack.currentIndex = ClientConfigAppleMail.Screen.ProfileInstall;
appleMailAutoconfigProfileInstallPageShow();
}
StackLayout { StackLayout {
id: stack id: stack
@ -52,8 +53,19 @@ Item {
Item { Item {
id: certificateInstall id: certificateInstall
property string errorString: ""
property bool showBugReportLink: false
property bool waitingForCert: false property bool waitingForCert: false
function clearError() {
errorString = "";
showBugReportLink = false;
}
function reset() {
waitingForCert = false;
clearError();
}
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
@ -65,17 +77,17 @@ Item {
Connections { Connections {
function onCertificateInstallCanceled() { function onCertificateInstallCanceled() {
// Note: this will lead to a warning message in the final version.
certificateInstall.waitingForCert = false; certificateInstall.waitingForCert = false;
console.error("Certificate installation was canceled"); certificateInstall.errorString = qsTr("Apple Mail cannot be configured if you do not install the certificate.Please retry.");
certificateInstall.showBugReportLink = false;
} }
function onCertificateInstallFailed() { function onCertificateInstallFailed() {
// Note: this will lead to an error message in the final version.
certificateInstall.waitingForCert = false; certificateInstall.waitingForCert = false;
console.error("Certificate installation failed"); certificateInstall.errorString = qsTr("An error occurred while installing the certificate.");
certificateInstall.showBugReportLink = true;
} }
function onCertificateInstallSuccess() { function onCertificateInstallSuccess() {
certificateInstall.waitingForCert = false; certificateInstall.reset();
root.showAutoconfig(); root.showAutoconfig();
} }
@ -124,6 +136,7 @@ Item {
text: qsTr("Install the certificate") text: qsTr("Install the certificate")
onClicked: { onClicked: {
certificateInstall.clearError();
certificateInstall.waitingForCert = true; certificateInstall.waitingForCert = true;
Backend.installTLSCertificate(); Backend.installTLSCertificate();
} }
@ -139,6 +152,40 @@ Item {
wizard.closeWizard(); wizard.closeWizard();
} }
} }
ColumnLayout {
Layout.fillWidth: true
spacing: 8
RowLayout {
Layout.fillWidth: true
spacing: 4
ColorImage {
color: wizard.colorScheme.signal_danger
height: errorLabel.lineHeight
source: "/qml/icons/ic-exclamation-circle-filled.svg"
sourceSize.height: errorLabel.lineHeight
visible: certificateInstall.errorString.length > 0
}
Label {
id: errorLabel
Layout.fillWidth: true
color: wizard.colorScheme.signal_danger
colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter
text: certificateInstall.errorString
type: Label.LabelType.Body_semibold
wrapMode: Text.WordWrap
}
}
LinkLabel {
Layout.alignment: Qt.AlignHCenter
colorScheme: wizard.colorScheme
callback: wizard.showBugReport
text: link("#", qsTr("Report the problem"))
visible: certificateInstall.showBugReportLink
}
}
} }
} }
} }

View File

@ -47,7 +47,8 @@ Button {
text: qsTr("Get help") text: qsTr("Get help")
onClicked: { onClicked: {
console.error("Get help"); Backend.notifyKBArticleClicked("https://proton.me/support/bridge");
Backend.showHelp();
} }
} }
MenuItem { MenuItem {
@ -56,7 +57,7 @@ Button {
text: qsTr("Report a problem") text: qsTr("Report a problem")
onClicked: { onClicked: {
console.error("Report a problem"); wizard.showBugReport();
} }
} }
} }

View File

@ -41,9 +41,14 @@ Item {
property ColorScheme colorScheme property ColorScheme colorScheme
property var user property var user
signal showBugReport signal bugReportRequested
signal wizardEnded signal wizardEnded
function showBugReport() {
closeWizard()
bugReportRequested()
}
function _showClientConfig() { function _showClientConfig() {
showClientConfig(root.user, root.address); showClientConfig(root.user, root.address);
} }