feat(@desktop/wallet): Adding feature flag for Simple Send until it is ready for release

fixes #16710
This commit is contained in:
Khushboo Mehta 2024-11-05 16:59:45 +01:00 committed by Khushboo-dev-cpp
parent 7f05a4093a
commit 481350385e
7 changed files with 96 additions and 7 deletions

View File

@ -6,6 +6,7 @@ const DEFAULT_FLAG_SWAP_ENABLED = true
const DEFAULT_FLAG_CONNECTOR_ENABLED* = true const DEFAULT_FLAG_CONNECTOR_ENABLED* = true
const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true
const DEFAULT_FLAG_PAYMENT_REQUEST_ENABLED = true const DEFAULT_FLAG_PAYMENT_REQUEST_ENABLED = true
const DEFAULT_FLAG_SIMPLE_SEND_ENABLED = false
proc boolToEnv*(defaultValue: bool): string = proc boolToEnv*(defaultValue: bool): string =
return if defaultValue: "1" else: "0" return if defaultValue: "1" else: "0"
@ -17,6 +18,7 @@ QtObject:
connectorEnabled: bool connectorEnabled: bool
sendViaPersonalChatEnabled: bool sendViaPersonalChatEnabled: bool
paymentRequestEnabled: bool paymentRequestEnabled: bool
simpleSendEnabled: bool
proc setup(self: FeatureFlags) = proc setup(self: FeatureFlags) =
self.QObject.setup() self.QObject.setup()
@ -25,6 +27,7 @@ QtObject:
self.connectorEnabled = getEnv("FLAG_CONNECTOR_ENABLED", boolToEnv(DEFAULT_FLAG_CONNECTOR_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.sendViaPersonalChatEnabled = getEnv("FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED", boolToEnv(DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED)) != "0"
self.paymentRequestEnabled = getEnv("FLAG_PAYMENT_REQUEST_ENABLED", boolToEnv(DEFAULT_FLAG_PAYMENT_REQUEST_ENABLED)) != "0" self.paymentRequestEnabled = getEnv("FLAG_PAYMENT_REQUEST_ENABLED", boolToEnv(DEFAULT_FLAG_PAYMENT_REQUEST_ENABLED)) != "0"
self.simpleSendEnabled = getEnv("FLAG_SIMPLE_SEND_ENABLED", boolToEnv(DEFAULT_FLAG_SIMPLE_SEND_ENABLED)) != "0"
proc delete*(self: FeatureFlags) = proc delete*(self: FeatureFlags) =
self.QObject.delete() self.QObject.delete()
@ -62,3 +65,9 @@ QtObject:
QtProperty[bool] paymentRequestEnabled: QtProperty[bool] paymentRequestEnabled:
read = getPaymentRequestEnabled read = getPaymentRequestEnabled
proc getSimpleSendEnabled*(self: FeatureFlags): bool {.slot.} =
return self.simpleSendEnabled
QtProperty[bool] simpleSendEnabled:
read = getSimpleSendEnabled

View File

@ -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

View File

@ -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
}
}

View File

@ -0,0 +1 @@
SimpleSendModal 1.0 SimpleSendModal.qml

View File

@ -6,4 +6,5 @@ QtObject {
property bool swapEnabled property bool swapEnabled
property bool sendViaPersonalChatEnabled property bool sendViaPersonalChatEnabled
property bool paymentRequestEnabled property bool paymentRequestEnabled
property bool simpleSendEnabled
} }

View File

@ -100,6 +100,7 @@ Item {
swapEnabled: featureFlags ? featureFlags.swapEnabled : false swapEnabled: featureFlags ? featureFlags.swapEnabled : false
sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false
paymentRequestEnabled: featureFlags ? featureFlags.paymentRequestEnabled : false paymentRequestEnabled: featureFlags ? featureFlags.paymentRequestEnabled : false
simpleSendEnabled: featureFlags ? featureFlags.simpleSendEnabled : false
} }
required property bool isCentralizedMetricsEnabled required property bool isCentralizedMetricsEnabled
@ -657,6 +658,8 @@ Item {
stickersMarketAddress: appMain.rootChatStore.stickersStore.getStickersMarketAddress() stickersMarketAddress: appMain.rootChatStore.stickersStore.getStickersMarketAddress()
stickersNetworkId: appMain.rootChatStore.appNetworkId stickersNetworkId: appMain.rootChatStore.appNetworkId
simpleSendEnabled: appMain.featureFlagsStore.simpleSendEnabled
Component.onCompleted: { Component.onCompleted: {
// It's requested from many nested places, so as a workaround we use // It's requested from many nested places, so as a workaround we use
// Global to shorten the path via global signal. // Global to shorten the path via global signal.

View File

@ -4,6 +4,7 @@ import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 as SQUtils import StatusQ.Core.Utils 0.1 as SQUtils
import AppLayouts.Wallet.stores 1.0 as WalletStores import AppLayouts.Wallet.stores 1.0 as WalletStores
import AppLayouts.Wallet.popups.simpleSend 1.0
import shared.popups.send 1.0 import shared.popups.send 1.0
import shared.stores.send 1.0 import shared.stores.send 1.0
@ -28,12 +29,14 @@ QtObject {
required property string stickersMarketAddress required property string stickersMarketAddress
required property string stickersNetworkId required property string stickersNetworkId
// Feature flag for single network send until its feature complete
required property bool simpleSendEnabled
function openSend(params = {}) { function openSend(params = {}) {
if (!!root._sendModalInstance) { // TODO remove once simple send is feature complete
return let sendModalCmp = root.simpleSendEnabled ? simpleSendModalComponent: sendModalComponent
} let sendModalInst = sendModalCmp.createObject(popupParent, params)
_sendModalInstance = sendModalComponent.createObject(popupParent, params) sendModalInst.open()
_sendModalInstance.open()
} }
function connectUsername(ensName) { function connectUsername(ensName) {
@ -150,6 +153,9 @@ QtObject {
} }
} }
// internally used to handle the instance thats launched readonly property Component simpleSendModalComponent: Component {
property var _sendModalInstance SimpleSendModal {
onClosed: destroy()
}
}
} }