feat(@desktop/wallet): Add Swap Feature Flag

fixes #14627
This commit is contained in:
Khushboo Mehta 2024-05-07 16:18:08 +02:00 committed by Khushboo-dev-cpp
parent 05000c5743
commit 03495265d5
2 changed files with 20 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import NimQml
import os
const DEFAULT_FLAG_DAPPS_ENABLED = false
const DEFAULT_FLAG_SWAP_ENABLED = false
proc boolToEnv(defaultValue: bool): string =
return if defaultValue: "1" else: "0"
@ -9,10 +10,12 @@ proc boolToEnv(defaultValue: bool): string =
QtObject:
type FeatureFlags* = ref object of QObject
dappsEnabled: bool
swapEnabled: bool
proc setup(self: FeatureFlags) =
self.QObject.setup()
self.dappsEnabled = getEnv("FLAG_DAPPS_ENABLED", boolToEnv(DEFAULT_FLAG_DAPPS_ENABLED)) != "0"
self.swapEnabled = getEnv("FLAG_SWAP_ENABLED", boolToEnv(DEFAULT_FLAG_SWAP_ENABLED)) != "0"
proc delete*(self: FeatureFlags) =
self.QObject.delete()
@ -26,3 +29,9 @@ QtObject:
QtProperty[bool] dappsEnabled:
read = getDappsEnabled
proc getSwapEnabled*(self: FeatureFlags): bool {.slot.} =
return self.swapEnabled
QtProperty[bool] swapEnabled:
read = getSwapEnabled

View File

@ -80,6 +80,17 @@ Rectangle {
onClicked: function () {
Global.openPopup(buySellModal);
}
}
StatusFlatButton {
id: swap
visible: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled && Global.featureFlags.swapEnabled
icon.name: "swap"
text: qsTr("Swap")
onClicked: function () {
console.warn("TODO: launch swap modal...")
}
}
}