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,6 +1661,7 @@ Item {
stickersPackId = "") { stickersPackId = "") {
this.active = true this.active = true
if (!!this.item) { if (!!this.item) {
if(!featureFlagsStore.simpleSendEnabled) {
if (!!sendType) this.item.preSelectedSendType = sendType if (!!sendType) this.item.preSelectedSendType = sendType
if (!!senderAddress) this.item.preSelectedAccountAddress = senderAddress if (!!senderAddress) this.item.preSelectedAccountAddress = senderAddress
if (!!tokenId) this.item.preSelectedHoldingID = tokenId if (!!tokenId) this.item.preSelectedHoldingID = tokenId
@ -1672,6 +1675,7 @@ Item {
this.item.publicKey = publicKey this.item.publicKey = publicKey
this.item.ensName = ensName this.item.ensName = ensName
this.item.stickersPackId = stickersPackId this.item.stickersPackId = stickersPackId
}
this.item.open() this.item.open()
} }
} }
@ -1681,7 +1685,11 @@ Item {
this.active = false this.active = false
} }
sourceComponent: SendPopups.SendModal { sourceComponent: featureFlagsStore.simpleSendEnabled ? simpleSendModal : sendModalAdvanced
Component {
id: sendModalAdvanced
SendPopups.SendModal {
loginType: appMain.rootStore.loginType loginType: appMain.rootStore.loginType
store: appMain.transactionStore store: appMain.transactionStore
@ -1693,6 +1701,14 @@ Item {
} }
} }
Component {
id: simpleSendModal
SimpleSendPopup.SimpleSendModal {
onClosed: sendModal.closed()
}
}
}
Action { Action {
shortcut: "Ctrl+1" shortcut: "Ctrl+1"
onTriggered: { onTriggered: {