mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-14 15:47:41 +00:00
feat(@desktop/wallet): Adding feature flag for Simple Send until it is ready for release
fixes #16710
This commit is contained in:
parent
7f05a4093a
commit
481350385e
@ -6,6 +6,7 @@ const DEFAULT_FLAG_SWAP_ENABLED = true
|
||||
const DEFAULT_FLAG_CONNECTOR_ENABLED* = true
|
||||
const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true
|
||||
const DEFAULT_FLAG_PAYMENT_REQUEST_ENABLED = true
|
||||
const DEFAULT_FLAG_SIMPLE_SEND_ENABLED = false
|
||||
|
||||
proc boolToEnv*(defaultValue: bool): string =
|
||||
return if defaultValue: "1" else: "0"
|
||||
@ -17,6 +18,7 @@ QtObject:
|
||||
connectorEnabled: bool
|
||||
sendViaPersonalChatEnabled: bool
|
||||
paymentRequestEnabled: bool
|
||||
simpleSendEnabled: bool
|
||||
|
||||
proc setup(self: FeatureFlags) =
|
||||
self.QObject.setup()
|
||||
@ -25,6 +27,7 @@ QtObject:
|
||||
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.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) =
|
||||
self.QObject.delete()
|
||||
@ -62,3 +65,9 @@ QtObject:
|
||||
|
||||
QtProperty[bool] paymentRequestEnabled:
|
||||
read = getPaymentRequestEnabled
|
||||
|
||||
proc getSimpleSendEnabled*(self: FeatureFlags): bool {.slot.} =
|
||||
return self.simpleSendEnabled
|
||||
|
||||
QtProperty[bool] simpleSendEnabled:
|
||||
read = getSimpleSendEnabled
|
||||
|
52
storybook/pages/SimpleSendModalPage.qml
Normal file
52
storybook/pages/SimpleSendModalPage.qml
Normal 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
|
@ -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
|
||||
}
|
||||
}
|
1
ui/app/AppLayouts/Wallet/popups/simpleSend/qmldir
Normal file
1
ui/app/AppLayouts/Wallet/popups/simpleSend/qmldir
Normal file
@ -0,0 +1 @@
|
||||
SimpleSendModal 1.0 SimpleSendModal.qml
|
@ -6,4 +6,5 @@ QtObject {
|
||||
property bool swapEnabled
|
||||
property bool sendViaPersonalChatEnabled
|
||||
property bool paymentRequestEnabled
|
||||
property bool simpleSendEnabled
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ Item {
|
||||
swapEnabled: featureFlags ? featureFlags.swapEnabled : false
|
||||
sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false
|
||||
paymentRequestEnabled: featureFlags ? featureFlags.paymentRequestEnabled : false
|
||||
simpleSendEnabled: featureFlags ? featureFlags.simpleSendEnabled : false
|
||||
}
|
||||
|
||||
required property bool isCentralizedMetricsEnabled
|
||||
@ -657,6 +658,8 @@ Item {
|
||||
stickersMarketAddress: appMain.rootChatStore.stickersStore.getStickersMarketAddress()
|
||||
stickersNetworkId: appMain.rootChatStore.appNetworkId
|
||||
|
||||
simpleSendEnabled: appMain.featureFlagsStore.simpleSendEnabled
|
||||
|
||||
Component.onCompleted: {
|
||||
// It's requested from many nested places, so as a workaround we use
|
||||
// Global to shorten the path via global signal.
|
||||
|
@ -4,6 +4,7 @@ import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||
|
||||
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
||||
import AppLayouts.Wallet.popups.simpleSend 1.0
|
||||
|
||||
import shared.popups.send 1.0
|
||||
import shared.stores.send 1.0
|
||||
@ -28,12 +29,14 @@ QtObject {
|
||||
required property string stickersMarketAddress
|
||||
required property string stickersNetworkId
|
||||
|
||||
// Feature flag for single network send until its feature complete
|
||||
required property bool simpleSendEnabled
|
||||
|
||||
function openSend(params = {}) {
|
||||
if (!!root._sendModalInstance) {
|
||||
return
|
||||
}
|
||||
_sendModalInstance = sendModalComponent.createObject(popupParent, params)
|
||||
_sendModalInstance.open()
|
||||
// TODO remove once simple send is feature complete
|
||||
let sendModalCmp = root.simpleSendEnabled ? simpleSendModalComponent: sendModalComponent
|
||||
let sendModalInst = sendModalCmp.createObject(popupParent, params)
|
||||
sendModalInst.open()
|
||||
}
|
||||
|
||||
function connectUsername(ensName) {
|
||||
@ -150,6 +153,9 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
// internally used to handle the instance thats launched
|
||||
property var _sendModalInstance
|
||||
readonly property Component simpleSendModalComponent: Component {
|
||||
SimpleSendModal {
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user