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 d389808a53
commit f6572ca56a
6 changed files with 115 additions and 19 deletions

View File

@ -5,6 +5,7 @@ const DEFAULT_FLAG_DAPPS_ENABLED = false
const DEFAULT_FLAG_SWAP_ENABLED = true const DEFAULT_FLAG_SWAP_ENABLED = true
const DEFAULT_FLAG_CONNECTOR_ENABLED* = false const DEFAULT_FLAG_CONNECTOR_ENABLED* = false
const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_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"
@ -15,6 +16,7 @@ QtObject:
swapEnabled: bool swapEnabled: bool
connectorEnabled: bool connectorEnabled: bool
sendViaPersonalChatEnabled: bool sendViaPersonalChatEnabled: bool
simpleSendEnabled: bool
proc setup(self: FeatureFlags) = proc setup(self: FeatureFlags) =
self.QObject.setup() self.QObject.setup()
@ -22,6 +24,7 @@ QtObject:
self.swapEnabled = getEnv("FLAG_SWAP_ENABLED", boolToEnv(DEFAULT_FLAG_SWAP_ENABLED)) != "0" 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.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.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()
@ -53,3 +56,9 @@ QtObject:
QtProperty[bool] sendViaPersonalChatEnabled: QtProperty[bool] sendViaPersonalChatEnabled:
read = getSendViaPersonalChatEnabled 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 dappsEnabled
property bool swapEnabled property bool swapEnabled
property bool sendViaPersonalChatEnabled 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.popups 1.0 as WalletPopups
import AppLayouts.Wallet.stores 1.0 as WalletStores import AppLayouts.Wallet.stores 1.0 as WalletStores
import AppLayouts.stores 1.0 as AppStores 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.stores 1.0
import mainui.activitycenter.popups 1.0 import mainui.activitycenter.popups 1.0
@ -97,6 +98,7 @@ Item {
dappsEnabled: featureFlags ? featureFlags.dappsEnabled : false dappsEnabled: featureFlags ? featureFlags.dappsEnabled : false
swapEnabled: featureFlags ? featureFlags.swapEnabled : false swapEnabled: featureFlags ? featureFlags.swapEnabled : false
sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false
simpleSendEnabled: featureFlags ? featureFlags.simpleSendEnabled : false
} }
required property bool isCentralizedMetricsEnabled required property bool isCentralizedMetricsEnabled
@ -1659,19 +1661,21 @@ Item {
stickersPackId = "") { stickersPackId = "") {
this.active = true this.active = true
if (!!this.item) { if (!!this.item) {
if (!!sendType) this.item.preSelectedSendType = sendType if(!featureFlagsStore.simpleSendEnabled) {
if (!!senderAddress) this.item.preSelectedAccountAddress = senderAddress if (!!sendType) this.item.preSelectedSendType = sendType
if (!!tokenId) this.item.preSelectedHoldingID = tokenId if (!!senderAddress) this.item.preSelectedAccountAddress = senderAddress
this.item.preSelectedHoldingType = tokenType if (!!tokenId) this.item.preSelectedHoldingID = tokenId
if (!!tokenAmount) this.item.preDefinedAmountToSend = tokenAmount this.item.preSelectedHoldingType = tokenType
if (chainId !== 0) this.item.preSelectedChainId = chainId if (!!tokenAmount) this.item.preDefinedAmountToSend = tokenAmount
if (!!recipientAddress) this.item.preSelectedRecipient = recipientAddress if (chainId !== 0) this.item.preSelectedChainId = chainId
this.item.preSelectedRecipientType = recipientType if (!!recipientAddress) this.item.preSelectedRecipient = recipientAddress
this.item.onlyAssets = onlyAssets this.item.preSelectedRecipientType = recipientType
this.item.interactive = interactive this.item.onlyAssets = onlyAssets
this.item.publicKey = publicKey this.item.interactive = interactive
this.item.ensName = ensName this.item.publicKey = publicKey
this.item.stickersPackId = stickersPackId this.item.ensName = ensName
this.item.stickersPackId = stickersPackId
}
this.item.open() this.item.open()
} }
} }
@ -1681,15 +1685,27 @@ Item {
this.active = false this.active = false
} }
sourceComponent: SendPopups.SendModal { sourceComponent: featureFlagsStore.simpleSendEnabled ? simpleSendModal : sendModalAdvanced
loginType: appMain.rootStore.loginType
store: appMain.transactionStore Component {
collectiblesStore: appMain.walletCollectiblesStore 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()
}
} }
} }