New copy on passphrase cancel dialog

This commit is contained in:
David Baker 2020-07-06 15:26:40 +01:00
parent 77377821ae
commit ac771f6a60
2 changed files with 7 additions and 18 deletions

View file

@ -40,22 +40,13 @@ export class AccessCancelledError extends Error {
}
}
async function confirmToDismiss(name) {
let description;
if (name === "m.cross_signing.user_signing") {
description = _t("If you cancel now, you won't complete verifying the other user.");
} else if (name === "m.cross_signing.self_signing") {
description = _t("If you cancel now, you won't complete verifying your other session.");
} else {
description = _t("If you cancel now, you won't complete your operation.");
}
async function confirmToDismiss() {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
const [sure] = await Modal.createDialog(QuestionDialog, {
title: _t("Cancel entering passphrase?"),
description,
description: _t("Are you sure you want to cancel entering passphrase?"),
danger: false,
button: _t("Enter passphrase"),
button: _t("Go Back"),
cancelButton: _t("Cancel"),
}).finished;
return !sure;
@ -102,7 +93,7 @@ async function getSecretStorageKey({ keys: keyInfos }, ssssItemName) {
/* options= */ {
onBeforeClose: async (reason) => {
if (reason === "backgroundClick") {
return confirmToDismiss(ssssItemName);
return confirmToDismiss();
}
return true;
},