From d0d4debdb45b50a66b16f32a4c3157634a1b394d Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Wed, 25 Aug 2021 10:09:33 +0200 Subject: [PATCH] fix(@desktop/wallet): Add wallet confirmation modal For all actions related to the wallet, add a confirmation if the wallet is not enabled fixes #3258 --- .../Sections/Ens/TermsAndConditions.qml | 19 ++++++++++++++- ui/shared/status/StatusChatCommandsPopup.qml | 24 ++++++++++++++----- ui/shared/status/StatusStickerMarket.qml | 22 +++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml b/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml index e046b6558e..c58e894972 100644 --- a/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml +++ b/ui/app/AppLayouts/Profile/Sections/Ens/TermsAndConditions.qml @@ -347,6 +347,23 @@ Item { //% "Register" qsTrId("ens-register") enabled: parseFloat(utilsModel.getSNTBalance()) >= 10 && termsAndConditionsCheckbox.checked - onClicked: transactionDialog.open() + onClicked: appSettings.isWalletEnabled ? transactionDialog.open() : confirmationPopup.open() + } + + ConfirmationDialog { + id: confirmationPopup + height: 310 + showCancelButton: true + confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.") + confirmButtonLabel: qsTr("I understand") + onConfirmButtonClicked: { + appSettings.isWalletEnabled = true + close() + transactionDialog.open() + } + + onCancelButtonClicked: { + close() + } } } diff --git a/ui/shared/status/StatusChatCommandsPopup.qml b/ui/shared/status/StatusChatCommandsPopup.qml index 47aa000910..05f814404b 100644 --- a/ui/shared/status/StatusChatCommandsPopup.qml +++ b/ui/shared/status/StatusChatCommandsPopup.qml @@ -45,9 +45,7 @@ Popup { icon.name: "send" icon.width: 16 icon.height: 18 - onClicked: function () { - root.sendTransactionCommandButtonClicked() - } + onClicked: appSettings.isWalletEnabled ? root.sendTransactionCommandButtonClicked() : confirmationPopup.open() } @@ -59,10 +57,24 @@ Popup { icon.width: 16 icon.height: 18 iconRotation: 180 - onClicked: function () { - root.receiveTransactionCommandButtonClicked() - } + onClicked: appSettings.isWalletEnabled ? root.receiveTransactionCommandButtonClicked() : confirmationPopup.open() } + ConfirmationDialog { + id: confirmationPopup + height: 310 + showCancelButton: true + confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.") + confirmButtonLabel: qsTr("I understand") + onConfirmButtonClicked: { + appSettings.isWalletEnabled = true + close() + root.sendTransactionCommandButtonClicked() + } + + onCancelButtonClicked: { + close() + } + } } } diff --git a/ui/shared/status/StatusStickerMarket.qml b/ui/shared/status/StatusStickerMarket.qml index fe8bc71f44..87162e496f 100644 --- a/ui/shared/status/StatusStickerMarket.qml +++ b/ui/shared/status/StatusStickerMarket.qml @@ -146,11 +146,33 @@ Item { onCancelClicked: root.cancelClicked(packId) onUpdateClicked: root.updateClicked(packId) onBuyClicked: { + if (!appSettings.isWalletEnabled) { + confirmationPopup.open() + return + } root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal) root.buyClicked(packId) } } } + + ConfirmationDialog { + id: confirmationPopup + height: 310 + showCancelButton: true + confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.") + confirmButtonLabel: qsTr("I understand") + onConfirmButtonClicked: { + appSettings.isWalletEnabled = true + close() + root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal) + root.buyClicked(packId) + } + + onCancelButtonClicked: { + close() + } + } } }