feat: Add feature flag
This commit is contained in:
parent
ccad5cfed9
commit
5b15300f3d
|
@ -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_REQUEST_PAYMENT_ENABLED = true
|
||||||
|
|
||||||
proc boolToEnv*(defaultValue: bool): string =
|
proc boolToEnv*(defaultValue: bool): string =
|
||||||
return if defaultValue: "1" else: "0"
|
return if defaultValue: "1" else: "0"
|
||||||
|
@ -22,6 +23,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.requestPaymentEnabled = getEnv("FLAG_REQUEST_PAYMENT_ENABLED", boolToEnv(DEFAULT_FLAG_REQUEST_PAYMENT_ENABLED)) != "0"
|
||||||
|
|
||||||
proc delete*(self: FeatureFlags) =
|
proc delete*(self: FeatureFlags) =
|
||||||
self.QObject.delete()
|
self.QObject.delete()
|
||||||
|
@ -53,3 +55,9 @@ QtObject:
|
||||||
|
|
||||||
QtProperty[bool] sendViaPersonalChatEnabled:
|
QtProperty[bool] sendViaPersonalChatEnabled:
|
||||||
read = getSendViaPersonalChatEnabled
|
read = getSendViaPersonalChatEnabled
|
||||||
|
|
||||||
|
proc getRequestPaymentEnabled*(self: FeatureFlags): bool {.slot.} =
|
||||||
|
return self.requestPaymentEnabled
|
||||||
|
|
||||||
|
QtProperty[bool] requestPaymentEnabled:
|
||||||
|
read = getRequestPaymentEnabled
|
||||||
|
|
|
@ -101,6 +101,7 @@ SplitView {
|
||||||
}
|
}
|
||||||
|
|
||||||
requestPaymentStore: d.requestPaymentStore
|
requestPaymentStore: d.requestPaymentStore
|
||||||
|
requestPaymentEnabled: true
|
||||||
|
|
||||||
onSendMessage: {
|
onSendMessage: {
|
||||||
logs.logEvent("StatusChatInput::sendMessage", ["MessageWithPk"], [chatInput.getTextWithPublicKeys()])
|
logs.logEvent("StatusChatInput::sendMessage", ["MessageWithPk"], [chatInput.getTextWithPublicKeys()])
|
||||||
|
|
|
@ -37,6 +37,7 @@ StackLayout {
|
||||||
required property WalletStore.WalletAssetsStore walletAssetsStore
|
required property WalletStore.WalletAssetsStore walletAssetsStore
|
||||||
required property SharedStores.CurrenciesStore currencyStore
|
required property SharedStores.CurrenciesStore currencyStore
|
||||||
property bool areTestNetworksEnabled
|
property bool areTestNetworksEnabled
|
||||||
|
property bool requestPaymentEnabled
|
||||||
|
|
||||||
property var sectionItemModel
|
property var sectionItemModel
|
||||||
|
|
||||||
|
@ -168,12 +169,14 @@ StackLayout {
|
||||||
sendModalPopup: root.sendModalPopup
|
sendModalPopup: root.sendModalPopup
|
||||||
sectionItemModel: root.sectionItemModel
|
sectionItemModel: root.sectionItemModel
|
||||||
joinedMembersCount: membersModelAdaptor.joinedMembers.ModelCount.count
|
joinedMembersCount: membersModelAdaptor.joinedMembers.ModelCount.count
|
||||||
|
areTestNetworksEnabled: root.areTestNetworksEnabled
|
||||||
amIMember: sectionItem.amIMember
|
amIMember: sectionItem.amIMember
|
||||||
amISectionAdmin: root.sectionItemModel.memberRole === Constants.memberRole.owner ||
|
amISectionAdmin: root.sectionItemModel.memberRole === Constants.memberRole.owner ||
|
||||||
root.sectionItemModel.memberRole === Constants.memberRole.admin ||
|
root.sectionItemModel.memberRole === Constants.memberRole.admin ||
|
||||||
root.sectionItemModel.memberRole === Constants.memberRole.tokenMaster
|
root.sectionItemModel.memberRole === Constants.memberRole.tokenMaster
|
||||||
hasViewOnlyPermissions: root.permissionsStore.viewOnlyPermissionsModel.count > 0
|
hasViewOnlyPermissions: root.permissionsStore.viewOnlyPermissionsModel.count > 0
|
||||||
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
|
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
|
||||||
|
requestPaymentEnabled: root.requestPaymentEnabled
|
||||||
|
|
||||||
hasUnrestrictedViewOnlyPermission: {
|
hasUnrestrictedViewOnlyPermission: {
|
||||||
viewOnlyUnrestrictedPermissionHelper.revision
|
viewOnlyUnrestrictedPermissionHelper.revision
|
||||||
|
|
|
@ -60,6 +60,7 @@ Item {
|
||||||
property bool amISectionAdmin: false
|
property bool amISectionAdmin: false
|
||||||
|
|
||||||
property bool sendViaPersonalChatEnabled
|
property bool sendViaPersonalChatEnabled
|
||||||
|
property bool requestPaymentEnabled
|
||||||
|
|
||||||
signal openStickerPackPopup(string stickerPackId)
|
signal openStickerPackPopup(string stickerPackId)
|
||||||
|
|
||||||
|
@ -329,6 +330,7 @@ Item {
|
||||||
stickersPopup: root.stickersPopup
|
stickersPopup: root.stickersPopup
|
||||||
chatType: root.activeChatType
|
chatType: root.activeChatType
|
||||||
areTestNetworksEnabled: root.areTestNetworksEnabled
|
areTestNetworksEnabled: root.areTestNetworksEnabled
|
||||||
|
requestPaymentEnabled: root.requestPaymentEnabled
|
||||||
|
|
||||||
textInput.onTextChanged: {
|
textInput.onTextChanged: {
|
||||||
if (!!d.activeChatContentModule && textInput.text !== d.activeChatContentModule.inputAreaModule.preservedProperties.text) {
|
if (!!d.activeChatContentModule && textInput.text !== d.activeChatContentModule.inputAreaModule.preservedProperties.text) {
|
||||||
|
|
|
@ -78,6 +78,7 @@ StatusSectionLayout {
|
||||||
property var collectiblesModel
|
property var collectiblesModel
|
||||||
|
|
||||||
property bool sendViaPersonalChatEnabled
|
property bool sendViaPersonalChatEnabled
|
||||||
|
property bool requestPaymentEnabled
|
||||||
|
|
||||||
readonly property bool contentLocked: {
|
readonly property bool contentLocked: {
|
||||||
if (!rootStore.chatCommunitySectionModule.isCommunity()) {
|
if (!rootStore.chatCommunitySectionModule.isCommunity()) {
|
||||||
|
@ -253,6 +254,7 @@ StatusSectionLayout {
|
||||||
canPost: !root.rootStore.chatCommunitySectionModule.isCommunity() || root.canPost
|
canPost: !root.rootStore.chatCommunitySectionModule.isCommunity() || root.canPost
|
||||||
amISectionAdmin: root.amISectionAdmin
|
amISectionAdmin: root.amISectionAdmin
|
||||||
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
|
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
|
||||||
|
requestPaymentEnabled: root.requestPaymentEnabled
|
||||||
onOpenStickerPackPopup: {
|
onOpenStickerPackPopup: {
|
||||||
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId, store: root.stickersPopup.store} )
|
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId, store: root.stickersPopup.store} )
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 requestPaymentEnabled
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,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
|
||||||
|
requestPaymentEnabled: featureFlags ? featureFlags.requestPaymentEnabled : false
|
||||||
}
|
}
|
||||||
|
|
||||||
required property bool isCentralizedMetricsEnabled
|
required property bool isCentralizedMetricsEnabled
|
||||||
|
@ -1535,6 +1536,7 @@ Item {
|
||||||
stickersPopup: statusStickersPopupLoader.item
|
stickersPopup: statusStickersPopupLoader.item
|
||||||
sectionItemModel: model
|
sectionItemModel: model
|
||||||
createChatPropertiesStore: appMain.createChatPropertiesStore
|
createChatPropertiesStore: appMain.createChatPropertiesStore
|
||||||
|
areTestNetworksEnabled: appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled
|
||||||
communitiesStore: appMain.communitiesStore
|
communitiesStore: appMain.communitiesStore
|
||||||
communitySettingsDisabled: !chatLayoutComponent.isManageCommunityEnabledInAdvanced &&
|
communitySettingsDisabled: !chatLayoutComponent.isManageCommunityEnabledInAdvanced &&
|
||||||
(production && appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled)
|
(production && appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled)
|
||||||
|
|
|
@ -49,6 +49,7 @@ Rectangle {
|
||||||
// Use this to only enable the Connections only when this Input opens the Emoji popup
|
// Use this to only enable the Connections only when this Input opens the Emoji popup
|
||||||
property bool closeGifPopupAfterSelection: true
|
property bool closeGifPopupAfterSelection: true
|
||||||
property bool areTestNetworksEnabled
|
property bool areTestNetworksEnabled
|
||||||
|
property bool requestPaymentEnabled: false
|
||||||
|
|
||||||
property bool emojiEvent: false
|
property bool emojiEvent: false
|
||||||
property bool isColonPressed: false
|
property bool isColonPressed: false
|
||||||
|
@ -962,6 +963,8 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPaymentRequestPopup() {
|
function openPaymentRequestPopup() {
|
||||||
|
if (!control.requestPaymentEnabled)
|
||||||
|
return
|
||||||
d.requestPaymentPopup = requestPaymentPopupComponent.createObject(control)
|
d.requestPaymentPopup = requestPaymentPopupComponent.createObject(control)
|
||||||
d.requestPaymentPopup.open()
|
d.requestPaymentPopup.open()
|
||||||
}
|
}
|
||||||
|
@ -1035,8 +1038,8 @@ Rectangle {
|
||||||
StatusAction {
|
StatusAction {
|
||||||
text: qsTr("Add payment request")
|
text: qsTr("Add payment request")
|
||||||
icon.name: "wallet"
|
icon.name: "wallet"
|
||||||
visibleOnDisabled: true
|
visibleOnDisabled: control.requestPaymentEnabled
|
||||||
enabled: !root.areTestNetworksEnabled
|
enabled: control.requestPaymentEnabled && !root.areTestNetworksEnabled
|
||||||
onTriggered: control.openPaymentRequestPopup()
|
onTriggered: control.openPaymentRequestPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue