parent
05000c5743
commit
03495265d5
|
@ -2,6 +2,7 @@ import NimQml
|
||||||
import os
|
import os
|
||||||
|
|
||||||
const DEFAULT_FLAG_DAPPS_ENABLED = false
|
const DEFAULT_FLAG_DAPPS_ENABLED = false
|
||||||
|
const DEFAULT_FLAG_SWAP_ENABLED = false
|
||||||
|
|
||||||
proc boolToEnv(defaultValue: bool): string =
|
proc boolToEnv(defaultValue: bool): string =
|
||||||
return if defaultValue: "1" else: "0"
|
return if defaultValue: "1" else: "0"
|
||||||
|
@ -9,10 +10,12 @@ proc boolToEnv(defaultValue: bool): string =
|
||||||
QtObject:
|
QtObject:
|
||||||
type FeatureFlags* = ref object of QObject
|
type FeatureFlags* = ref object of QObject
|
||||||
dappsEnabled: bool
|
dappsEnabled: bool
|
||||||
|
swapEnabled: bool
|
||||||
|
|
||||||
proc setup(self: FeatureFlags) =
|
proc setup(self: FeatureFlags) =
|
||||||
self.QObject.setup()
|
self.QObject.setup()
|
||||||
self.dappsEnabled = getEnv("FLAG_DAPPS_ENABLED", boolToEnv(DEFAULT_FLAG_DAPPS_ENABLED)) != "0"
|
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) =
|
proc delete*(self: FeatureFlags) =
|
||||||
self.QObject.delete()
|
self.QObject.delete()
|
||||||
|
@ -26,3 +29,9 @@ QtObject:
|
||||||
|
|
||||||
QtProperty[bool] dappsEnabled:
|
QtProperty[bool] dappsEnabled:
|
||||||
read = getDappsEnabled
|
read = getDappsEnabled
|
||||||
|
|
||||||
|
proc getSwapEnabled*(self: FeatureFlags): bool {.slot.} =
|
||||||
|
return self.swapEnabled
|
||||||
|
|
||||||
|
QtProperty[bool] swapEnabled:
|
||||||
|
read = getSwapEnabled
|
||||||
|
|
|
@ -80,6 +80,17 @@ Rectangle {
|
||||||
onClicked: function () {
|
onClicked: function () {
|
||||||
Global.openPopup(buySellModal);
|
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...")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue