From ccad5cfed9589e6a18796794a6827e5542695144 Mon Sep 17 00:00:00 2001 From: Emil Sawicki Date: Mon, 11 Nov 2024 15:19:49 +0100 Subject: [PATCH] feat: Disable request payment for testnet --- storybook/pages/StatusChatInputPage.qml | 2 +- ui/app/AppLayouts/Chat/ChatLayout.qml | 1 + ui/app/AppLayouts/Chat/views/ChatColumnView.qml | 2 ++ ui/app/AppLayouts/Chat/views/ChatView.qml | 2 ++ ui/imports/shared/status/StatusChatInput.qml | 7 +++---- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/storybook/pages/StatusChatInputPage.qml b/storybook/pages/StatusChatInputPage.qml index eae48bf04c..50aefbb5bd 100644 --- a/storybook/pages/StatusChatInputPage.qml +++ b/storybook/pages/StatusChatInputPage.qml @@ -153,7 +153,7 @@ SplitView { readonly property SharedStores.RequestPaymentStore requestPaymentStore: SharedStores.RequestPaymentStore { currencyStore: SharedStores.CurrenciesStore {} flatNetworksModel: NetworksModel.flatNetworks - processedAssetsModel: d.walletAssetsStore.renamedTokensBySymbolModel + processedAssetsModel: d.walletAssetsStore.jointModel plainAssetsModel: d.walletAssetsStore.walletTokensStore.plainTokensBySymbolModel accountsModel: WalletAccountsModel {} } diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 42345f2a4a..49874d4277 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -36,6 +36,7 @@ StackLayout { required property SendStores.TransactionStore transactionStore required property WalletStore.WalletAssetsStore walletAssetsStore required property SharedStores.CurrenciesStore currencyStore + property bool areTestNetworksEnabled property var sectionItemModel diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index 2e9c81a731..6204525865 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -46,6 +46,7 @@ Item { property ProfileStores.ContactsStore contactsStore property var emojiPopup property var stickersPopup + property bool areTestNetworksEnabled property string activeChatId: parentModule && parentModule.activeItem.id property int chatsCount: parentModule && parentModule.model ? parentModule.model.count : 0 @@ -327,6 +328,7 @@ Item { emojiPopup: root.emojiPopup stickersPopup: root.stickersPopup chatType: root.activeChatType + areTestNetworksEnabled: root.areTestNetworksEnabled 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 82592982f0..466ac2f686 100644 --- a/ui/app/AppLayouts/Chat/views/ChatView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatView.qml @@ -51,6 +51,7 @@ StatusSectionLayout { required property var sendModalPopup property var sectionItemModel property int joinedMembersCount + property bool areTestNetworksEnabled property var emojiPopup property var stickersPopup @@ -242,6 +243,7 @@ StatusSectionLayout { sharedRootStore: root.sharedRootStore utilsStore: root.utilsStore rootStore: root.rootStore + areTestNetworksEnabled: root.areTestNetworksEnabled createChatPropertiesStore: root.createChatPropertiesStore contactsStore: root.contactsStore stickersLoaded: root.stickersLoaded diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index fa365cc993..d4b19f6d9f 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -48,6 +48,7 @@ Rectangle { property var stickersPopup: null // Use this to only enable the Connections only when this Input opens the Emoji popup property bool closeGifPopupAfterSelection: true + property bool areTestNetworksEnabled property bool emojiEvent: false property bool isColonPressed: false @@ -1034,8 +1035,8 @@ Rectangle { StatusAction { text: qsTr("Add payment request") icon.name: "wallet" - // TODO_ES disable for testnet (only production) - // TODO_ES error message when disabled on testnet (only production) + visibleOnDisabled: true + enabled: !root.areTestNetworksEnabled onTriggered: control.openPaymentRequestPopup() } @@ -1273,7 +1274,6 @@ Rectangle { topPadding: 12 imagePreviewArray: control.fileUrlsAndSources linkPreviewModel: control.linkPreviewModel - requestPaymentModel: control.requestPaymentStore.requestPaymentModel showLinkPreviewSettings: control.askToEnableLinkPreview onImageRemoved: (index) => { //Just do a copy and replace the whole thing because it's a plain JS array and thre's no signal when a single item is removed @@ -1292,7 +1292,6 @@ Rectangle { onDisableLinkPreview: () => control.disableLinkPreview() onDismissLinkPreviewSettings: () => control.dismissLinkPreviewSettings() onDismissLinkPreview: (index) => control.dismissLinkPreview(index) - onPaymentRequestRemoved: (index) => control.requestPaymentStore.removePaymentRequest(index) } RowLayout {