From f6572ca56a898898adc4eb2d2f721969ace401a1 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Tue, 5 Nov 2024 16:59:45 +0100 Subject: [PATCH] feat(@desktop/wallet): Adding feature flag for Simple Send until it is ready for release fixes #16710 --- src/app/global/feature_flags.nim | 9 ++++ storybook/pages/SimpleSendModalPage.qml | 52 ++++++++++++++++++ .../popups/simpleSend/SimpleSendModal.qml | 17 ++++++ .../Wallet/popups/simpleSend/qmldir | 1 + .../AppLayouts/stores/FeatureFlagsStore.qml | 1 + ui/app/mainui/AppMain.qml | 54 ++++++++++++------- 6 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 storybook/pages/SimpleSendModalPage.qml create mode 100644 ui/app/AppLayouts/Wallet/popups/simpleSend/SimpleSendModal.qml create mode 100644 ui/app/AppLayouts/Wallet/popups/simpleSend/qmldir diff --git a/src/app/global/feature_flags.nim b/src/app/global/feature_flags.nim index 40cf2bffec..1315fcf5ae 100644 --- a/src/app/global/feature_flags.nim +++ b/src/app/global/feature_flags.nim @@ -5,6 +5,7 @@ const DEFAULT_FLAG_DAPPS_ENABLED = false const DEFAULT_FLAG_SWAP_ENABLED = true const DEFAULT_FLAG_CONNECTOR_ENABLED* = false const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true +const DEFAULT_FLAG_SIMPLE_SEND_ENABLED = false proc boolToEnv*(defaultValue: bool): string = return if defaultValue: "1" else: "0" @@ -15,6 +16,7 @@ QtObject: swapEnabled: bool connectorEnabled: bool sendViaPersonalChatEnabled: bool + simpleSendEnabled: bool proc setup(self: FeatureFlags) = self.QObject.setup() @@ -22,6 +24,7 @@ QtObject: self.swapEnabled = getEnv("FLAG_SWAP_ENABLED", boolToEnv(DEFAULT_FLAG_SWAP_ENABLED)) != "0" self.connectorEnabled = getEnv("FLAG_CONNECTOR_ENABLED", boolToEnv(DEFAULT_FLAG_CONNECTOR_ENABLED)) != "0" self.sendViaPersonalChatEnabled = getEnv("FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED", boolToEnv(DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED)) != "0" + self.simpleSendEnabled = getEnv("FLAG_SIMPLE_SEND_ENABLED", boolToEnv(DEFAULT_FLAG_SIMPLE_SEND_ENABLED)) != "0" proc delete*(self: FeatureFlags) = self.QObject.delete() @@ -53,3 +56,9 @@ QtObject: QtProperty[bool] sendViaPersonalChatEnabled: read = getSendViaPersonalChatEnabled + + proc getSimpleSendEnabled*(self: FeatureFlags): bool {.slot.} = + return self.simpleSendEnabled + + QtProperty[bool] simpleSendEnabled: + read = getSimpleSendEnabled diff --git a/storybook/pages/SimpleSendModalPage.qml b/storybook/pages/SimpleSendModalPage.qml new file mode 100644 index 0000000000..04e0ae4981 --- /dev/null +++ b/storybook/pages/SimpleSendModalPage.qml @@ -0,0 +1,52 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 + +import Storybook 1.0 + +import AppLayouts.Wallet.popups.simpleSend 1.0 + +SplitView { + id: root + + orientation: Qt.Horizontal + + function launchPopup() { + simpleSend.createObject(root) + } + + PopupBackground { + id: popupBg + + SplitView.fillWidth: true + SplitView.fillHeight: true + + Button { + id: reopenButton + anchors.centerIn: parent + text: "Reopen" + enabled: !simpleSend.visible + + onClicked: launchPopup() + } + + Component.onCompleted: launchPopup() + } + + Component { + id: simpleSend + SimpleSendModal { + visible: true + modal: false + closePolicy: Popup.NoAutoClose + } + } + + LogsAndControlsPanel { + SplitView.minimumHeight: 100 + SplitView.preferredHeight: 100 + + } +} + +// category: Popups diff --git a/ui/app/AppLayouts/Wallet/popups/simpleSend/SimpleSendModal.qml b/ui/app/AppLayouts/Wallet/popups/simpleSend/SimpleSendModal.qml new file mode 100644 index 0000000000..40fe860ca2 --- /dev/null +++ b/ui/app/AppLayouts/Wallet/popups/simpleSend/SimpleSendModal.qml @@ -0,0 +1,17 @@ +import QtQuick 2.15 + +import StatusQ.Core.Theme 0.1 +import StatusQ.Popups.Dialog 0.1 + +StatusDialog { + id: popup + + title: qsTr("Send") + + padding: 0 + background: StatusDialogBackground { + implicitHeight: 846 + implicitWidth: 556 + color: Theme.palette.baseColor3 + } +} diff --git a/ui/app/AppLayouts/Wallet/popups/simpleSend/qmldir b/ui/app/AppLayouts/Wallet/popups/simpleSend/qmldir new file mode 100644 index 0000000000..47283cb9e6 --- /dev/null +++ b/ui/app/AppLayouts/Wallet/popups/simpleSend/qmldir @@ -0,0 +1 @@ +SimpleSendModal 1.0 SimpleSendModal.qml diff --git a/ui/app/AppLayouts/stores/FeatureFlagsStore.qml b/ui/app/AppLayouts/stores/FeatureFlagsStore.qml index 02a4f6e589..9eeedb3022 100644 --- a/ui/app/AppLayouts/stores/FeatureFlagsStore.qml +++ b/ui/app/AppLayouts/stores/FeatureFlagsStore.qml @@ -5,4 +5,5 @@ QtObject { property bool dappsEnabled property bool swapEnabled property bool sendViaPersonalChatEnabled + property bool simpleSendEnabled } diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index ff3809ff32..d01b52f063 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -45,6 +45,7 @@ import AppLayouts.Profile.stores 1.0 as ProfileStores import AppLayouts.Wallet.popups 1.0 as WalletPopups import AppLayouts.Wallet.stores 1.0 as WalletStores import AppLayouts.stores 1.0 as AppStores +import AppLayouts.Wallet.popups.simpleSend 1.0 as SimpleSendPopup import mainui.activitycenter.stores 1.0 import mainui.activitycenter.popups 1.0 @@ -97,6 +98,7 @@ Item { dappsEnabled: featureFlags ? featureFlags.dappsEnabled : false swapEnabled: featureFlags ? featureFlags.swapEnabled : false sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false + simpleSendEnabled: featureFlags ? featureFlags.simpleSendEnabled : false } required property bool isCentralizedMetricsEnabled @@ -1659,19 +1661,21 @@ Item { stickersPackId = "") { this.active = true if (!!this.item) { - if (!!sendType) this.item.preSelectedSendType = sendType - if (!!senderAddress) this.item.preSelectedAccountAddress = senderAddress - if (!!tokenId) this.item.preSelectedHoldingID = tokenId - this.item.preSelectedHoldingType = tokenType - if (!!tokenAmount) this.item.preDefinedAmountToSend = tokenAmount - if (chainId !== 0) this.item.preSelectedChainId = chainId - if (!!recipientAddress) this.item.preSelectedRecipient = recipientAddress - this.item.preSelectedRecipientType = recipientType - this.item.onlyAssets = onlyAssets - this.item.interactive = interactive - this.item.publicKey = publicKey - this.item.ensName = ensName - this.item.stickersPackId = stickersPackId + if(!featureFlagsStore.simpleSendEnabled) { + if (!!sendType) this.item.preSelectedSendType = sendType + if (!!senderAddress) this.item.preSelectedAccountAddress = senderAddress + if (!!tokenId) this.item.preSelectedHoldingID = tokenId + this.item.preSelectedHoldingType = tokenType + if (!!tokenAmount) this.item.preDefinedAmountToSend = tokenAmount + if (chainId !== 0) this.item.preSelectedChainId = chainId + if (!!recipientAddress) this.item.preSelectedRecipient = recipientAddress + this.item.preSelectedRecipientType = recipientType + this.item.onlyAssets = onlyAssets + this.item.interactive = interactive + this.item.publicKey = publicKey + this.item.ensName = ensName + this.item.stickersPackId = stickersPackId + } this.item.open() } } @@ -1681,15 +1685,27 @@ Item { this.active = false } - sourceComponent: SendPopups.SendModal { - loginType: appMain.rootStore.loginType + sourceComponent: featureFlagsStore.simpleSendEnabled ? simpleSendModal : sendModalAdvanced - store: appMain.transactionStore - collectiblesStore: appMain.walletCollectiblesStore + Component { + id: sendModalAdvanced + SendPopups.SendModal { + loginType: appMain.rootStore.loginType - showCustomRoutingMode: !production + store: appMain.transactionStore + collectiblesStore: appMain.walletCollectiblesStore - onClosed: sendModal.closed() + showCustomRoutingMode: !production + + onClosed: sendModal.closed() + } + } + + Component { + id: simpleSendModal + SimpleSendPopup.SimpleSendModal { + onClosed: sendModal.closed() + } } }