diff --git a/src/app/global/feature_flags.nim b/src/app/global/feature_flags.nim index 40cf2bffec..f8ffcd05c9 100644 --- a/src/app/global/feature_flags.nim +++ b/src/app/global/feature_flags.nim @@ -5,6 +5,7 @@ const DEFAULT_FLAG_DAPPS_ENABLED = false const DEFAULT_FLAG_SWAP_ENABLED = true const DEFAULT_FLAG_CONNECTOR_ENABLED* = false const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true +const DEFAULT_FLAG_REQUEST_PAYMENT_ENABLED = true proc boolToEnv*(defaultValue: bool): string = return if defaultValue: "1" else: "0" @@ -22,6 +23,7 @@ QtObject: 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.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) = self.QObject.delete() @@ -53,3 +55,9 @@ QtObject: QtProperty[bool] sendViaPersonalChatEnabled: read = getSendViaPersonalChatEnabled + + proc getRequestPaymentEnabled*(self: FeatureFlags): bool {.slot.} = + return self.requestPaymentEnabled + + QtProperty[bool] requestPaymentEnabled: + read = getRequestPaymentEnabled diff --git a/storybook/pages/StatusChatInputPage.qml b/storybook/pages/StatusChatInputPage.qml index 50aefbb5bd..5422f03703 100644 --- a/storybook/pages/StatusChatInputPage.qml +++ b/storybook/pages/StatusChatInputPage.qml @@ -101,6 +101,7 @@ SplitView { } requestPaymentStore: d.requestPaymentStore + requestPaymentEnabled: true onSendMessage: { logs.logEvent("StatusChatInput::sendMessage", ["MessageWithPk"], [chatInput.getTextWithPublicKeys()]) diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 49874d4277..45bba8f1ba 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -37,6 +37,7 @@ StackLayout { required property WalletStore.WalletAssetsStore walletAssetsStore required property SharedStores.CurrenciesStore currencyStore property bool areTestNetworksEnabled + property bool requestPaymentEnabled property var sectionItemModel @@ -168,12 +169,14 @@ StackLayout { sendModalPopup: root.sendModalPopup sectionItemModel: root.sectionItemModel joinedMembersCount: membersModelAdaptor.joinedMembers.ModelCount.count + areTestNetworksEnabled: root.areTestNetworksEnabled amIMember: sectionItem.amIMember amISectionAdmin: root.sectionItemModel.memberRole === Constants.memberRole.owner || root.sectionItemModel.memberRole === Constants.memberRole.admin || root.sectionItemModel.memberRole === Constants.memberRole.tokenMaster hasViewOnlyPermissions: root.permissionsStore.viewOnlyPermissionsModel.count > 0 sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled + requestPaymentEnabled: root.requestPaymentEnabled hasUnrestrictedViewOnlyPermission: { viewOnlyUnrestrictedPermissionHelper.revision diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index 6204525865..bb771cf597 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -60,6 +60,7 @@ Item { property bool amISectionAdmin: false property bool sendViaPersonalChatEnabled + property bool requestPaymentEnabled signal openStickerPackPopup(string stickerPackId) @@ -329,6 +330,7 @@ Item { stickersPopup: root.stickersPopup chatType: root.activeChatType areTestNetworksEnabled: root.areTestNetworksEnabled + requestPaymentEnabled: root.requestPaymentEnabled textInput.onTextChanged: { if (!!d.activeChatContentModule && textInput.text !== d.activeChatContentModule.inputAreaModule.preservedProperties.text) { diff --git a/ui/app/AppLayouts/Chat/views/ChatView.qml b/ui/app/AppLayouts/Chat/views/ChatView.qml index 466ac2f686..2ad01103d6 100644 --- a/ui/app/AppLayouts/Chat/views/ChatView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatView.qml @@ -78,6 +78,7 @@ StatusSectionLayout { property var collectiblesModel property bool sendViaPersonalChatEnabled + property bool requestPaymentEnabled readonly property bool contentLocked: { if (!rootStore.chatCommunitySectionModule.isCommunity()) { @@ -253,6 +254,7 @@ StatusSectionLayout { canPost: !root.rootStore.chatCommunitySectionModule.isCommunity() || root.canPost amISectionAdmin: root.amISectionAdmin sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled + requestPaymentEnabled: root.requestPaymentEnabled onOpenStickerPackPopup: { Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId, store: root.stickersPopup.store} ) } diff --git a/ui/app/AppLayouts/stores/FeatureFlagsStore.qml b/ui/app/AppLayouts/stores/FeatureFlagsStore.qml index 02a4f6e589..303efe410b 100644 --- a/ui/app/AppLayouts/stores/FeatureFlagsStore.qml +++ b/ui/app/AppLayouts/stores/FeatureFlagsStore.qml @@ -5,4 +5,5 @@ QtObject { property bool dappsEnabled property bool swapEnabled property bool sendViaPersonalChatEnabled + property bool requestPaymentEnabled } diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index ff0be0d876..80c3c7cd4a 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -97,6 +97,7 @@ Item { dappsEnabled: featureFlags ? featureFlags.dappsEnabled : false swapEnabled: featureFlags ? featureFlags.swapEnabled : false sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false + requestPaymentEnabled: featureFlags ? featureFlags.requestPaymentEnabled : false } required property bool isCentralizedMetricsEnabled @@ -1535,6 +1536,7 @@ Item { stickersPopup: statusStickersPopupLoader.item sectionItemModel: model createChatPropertiesStore: appMain.createChatPropertiesStore + areTestNetworksEnabled: appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled communitiesStore: appMain.communitiesStore communitySettingsDisabled: !chatLayoutComponent.isManageCommunityEnabledInAdvanced && (production && appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled) diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index d4b19f6d9f..9874572946 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -49,6 +49,7 @@ Rectangle { // Use this to only enable the Connections only when this Input opens the Emoji popup property bool closeGifPopupAfterSelection: true property bool areTestNetworksEnabled + property bool requestPaymentEnabled: false property bool emojiEvent: false property bool isColonPressed: false @@ -962,6 +963,8 @@ Rectangle { } function openPaymentRequestPopup() { + if (!control.requestPaymentEnabled) + return d.requestPaymentPopup = requestPaymentPopupComponent.createObject(control) d.requestPaymentPopup.open() } @@ -1035,8 +1038,8 @@ Rectangle { StatusAction { text: qsTr("Add payment request") icon.name: "wallet" - visibleOnDisabled: true - enabled: !root.areTestNetworksEnabled + visibleOnDisabled: control.requestPaymentEnabled + enabled: control.requestPaymentEnabled && !root.areTestNetworksEnabled onTriggered: control.openPaymentRequestPopup() }