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
parent 943ab34724
commit d449c84a8a
6 changed files with 115 additions and 19 deletions

View File

@ -5,6 +5,7 @@ const DEFAULT_FLAG_DAPPS_ENABLED = true
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

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

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

View File

@ -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
@ -1641,19 +1643,21 @@ Item {
ensName, 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()
}
}
@ -1663,15 +1667,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()
}
}
}