From 91f5aae9e7a4202bcd50e7cc97750a6652932ec4 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 27 Nov 2020 12:21:15 -0400 Subject: [PATCH] feat: show sign phrase modal in wallet --- ui/app/AppLayouts/Wallet/SignPhraseModal.qml | 104 +++++++++++++++++++ ui/app/AppLayouts/Wallet/WalletLayout.qml | 12 +++ ui/app/AppMain.qml | 4 + ui/main.qml | 2 + 4 files changed, 122 insertions(+) create mode 100644 ui/app/AppLayouts/Wallet/SignPhraseModal.qml diff --git a/ui/app/AppLayouts/Wallet/SignPhraseModal.qml b/ui/app/AppLayouts/Wallet/SignPhraseModal.qml new file mode 100644 index 0000000000..8be324992d --- /dev/null +++ b/ui/app/AppLayouts/Wallet/SignPhraseModal.qml @@ -0,0 +1,104 @@ +import QtQuick 2.13 +import QtQuick.Controls 2.13 +import QtQuick.Layouts 1.13 +import "../../../imports" +import "../../../shared" +import "../../../shared/status" +import "." + +ModalPopup { + id: signPhrasePopup + title: qsTr("Signing phrase") + height: 390 + closePolicy: Popup.NoAutoClose + + Column { + anchors.horizontalCenter: parent.horizontalCenter + + StyledText { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("This is your signing phrase") + font.pixelSize: 17 + font.weight: Font.Bold + horizontalAlignment: Text.AlignHCenter + height: Style.current.padding * 3 + } + + StyledText { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("You should see these 3 words before signing each transaction") + font.pixelSize: 15 + width: 330 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + height: Style.current.padding * 4 + } + + Rectangle { + color: Style.current.inputBackground + height: 44 + width: signPhrasePopup.width + anchors.left: signPhrasePopup.left + StyledText { + id: signingPhrase + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 15 + text: walletModel.signingPhrase + } + } + + Item { + height: 30 + width: parent.width + SVGImage { + width: 13.33 + height: 13.33 + sourceSize.height: height * 2 + sourceSize.width: width * 2 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + fillMode: Image.PreserveAspectFit + source: "../../img/exclamation_outline.svg" + } + } + + StyledText { + text: qsTr("If you see a different combination, cancel the transaction and sign out") + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 13 + height: 18 + color: Style.current.danger + anchors.horizontalCenter: parent.horizontalCenter + } + } + + footer: Item { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + StatusButton { + anchors.right: btnRemindLater.left + anchors.rightMargin: Style.current.padding + text: qsTr("Ok, got it") + type: "secondary" + onClicked: { + appSettings.hideSignPhraseModal = true; + close(); + } + } + + + StatusButton { + id: btnRemindLater + anchors.right: parent.right + text: qsTr("Remind me later") + onClicked: { + hideSignPhraseModal = true; + close(); + } + } + } +} \ No newline at end of file diff --git a/ui/app/AppLayouts/Wallet/WalletLayout.qml b/ui/app/AppLayouts/Wallet/WalletLayout.qml index 392d9ee1f3..d15eb23ebf 100644 --- a/ui/app/AppLayouts/Wallet/WalletLayout.qml +++ b/ui/app/AppLayouts/Wallet/WalletLayout.qml @@ -28,6 +28,18 @@ SplitView { SplitView.maximumWidth: Style.current.leftTabMaximumWidth } + property bool hideSignPhraseModal: false + + SignPhraseModal { + id: signPhrasePopup + } + + function showSigningPhrasePopup(){ + if(!hideSignPhraseModal && !appSettings.hideSignPhraseModal){ + signPhrasePopup.open(); + } + } + Item { id: walletContainer anchors.top: parent.top diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 2f0a85caf0..8795df19f1 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -189,6 +189,10 @@ RowLayout { if(this.children[currentIndex] === chatLayoutContainer){ chatLayoutContainer.chatColumn.chatMessages.chatLogView.scrollToBottom(true); } + + if(this.children[currentIndex] === walletLayoutContainer){ + walletLayoutContainer.showSigningPhrasePopup(); + } } ChatLayout { diff --git a/ui/main.qml b/ui/main.qml index 54b8dc8bb3..8789029822 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -107,6 +107,7 @@ ApplicationWindow { property var whitelistedUnfurlingSites: ({}) property bool neverAskAboutUnfurlingAgain: false property bool hideChannelSuggestions: false + property bool hideSignPhraseModal: false property int fontSize: Constants.fontSizeM @@ -144,6 +145,7 @@ ApplicationWindow { property bool neverAskAboutUnfurlingAgain: defaultAppSettings.neverAskAboutUnfurlingAgain property bool hideChannelSuggestions: defaultAppSettings.hideChannelSuggestions property int fontSize: defaultAppSettings.fontSize + property bool hideSignPhraseModal: defaultAppSettings.hideSignPhraseModal // Browser settings property bool autoLoadImages: defaultAppSettings.autoLoadImages