From d1ccce5d4d32cdbb54493722824567786a273c7a Mon Sep 17 00:00:00 2001 From: Emil Sawicki Date: Sun, 24 Nov 2024 08:30:18 +0100 Subject: [PATCH] feat: Rename to payment request --- .../pages/ChatInputLinksPreviewAreaPage.qml | 6 ++--- storybook/pages/LinksMessageViewPage.qml | 6 ++--- ...ymentModel.qml => PaymentRequestModel.qml} | 0 storybook/src/Models/qmldir | 2 +- .../shared/stores/RequestPaymentStore.qml | 23 ------------------- .../chat/ChatInputLinksPreviewArea.qml | 10 ++++---- ...qml => PaymentRequestMiniCardDelegate.qml} | 0 ui/imports/shared/controls/chat/qmldir | 2 +- ...ate.qml => PaymentRequestCardDelegate.qml} | 0 ui/imports/shared/controls/delegates/qmldir | 2 +- .../shared/stores/RequestPaymentStore.qml | 10 -------- .../shared/views/chat/LinksMessageView.qml | 10 ++++---- ui/imports/shared/views/chat/MessageView.qml | 2 +- 13 files changed, 20 insertions(+), 53 deletions(-) rename storybook/src/Models/{RequestPaymentModel.qml => PaymentRequestModel.qml} (100%) delete mode 100644 storybook/stubs/shared/stores/RequestPaymentStore.qml rename ui/imports/shared/controls/chat/{RequestPaymentMiniCardDelegate.qml => PaymentRequestMiniCardDelegate.qml} (100%) rename ui/imports/shared/controls/delegates/{RequestPaymentCardDelegate.qml => PaymentRequestCardDelegate.qml} (100%) delete mode 100644 ui/imports/shared/stores/RequestPaymentStore.qml diff --git a/storybook/pages/ChatInputLinksPreviewAreaPage.qml b/storybook/pages/ChatInputLinksPreviewAreaPage.qml index 0a0dd78487..7c9adbba35 100644 --- a/storybook/pages/ChatInputLinksPreviewAreaPage.qml +++ b/storybook/pages/ChatInputLinksPreviewAreaPage.qml @@ -32,7 +32,7 @@ SplitView { width: parent.width imagePreviewArray: ["https://picsum.photos/200/300?random=1", "https://picsum.photos/200/300?random=1"] linkPreviewModel: showLinkPreviewSettings ? emptyModel : mockedLinkPreviewModel - requestPaymentModel: mockedRequestPaymentModel + paymentRequestModel: mockedPaymentRequestModel showLinkPreviewSettings: !linkPreviewEnabledSwitch.checked visible: hasContent @@ -84,8 +84,8 @@ SplitView { id: mockedLinkPreviewModel } - RequestPaymentModel { - id: mockedRequestPaymentModel + PaymentRequestModel { + id: mockedPaymentRequestModel } } diff --git a/storybook/pages/LinksMessageViewPage.qml b/storybook/pages/LinksMessageViewPage.qml index a7694c1beb..96d9f8f636 100644 --- a/storybook/pages/LinksMessageViewPage.qml +++ b/storybook/pages/LinksMessageViewPage.qml @@ -13,8 +13,8 @@ SplitView { id: mockedLinkPreviewModel } - RequestPaymentModel { - id: mockedRequestPaymentModel + PaymentRequestModel { + id: mockedPaymentRequestModel } Pane { @@ -31,7 +31,7 @@ SplitView { playAnimations: true linkPreviewModel: mockedLinkPreviewModel gifLinks: [ "https://media.tenor.com/qN_ytiwLh24AAAAC/cold.gif" ] - requestPaymentModel: mockedRequestPaymentModel + paymentRequestModel: mockedPaymentRequestModel senderName: "Alice" diff --git a/storybook/src/Models/RequestPaymentModel.qml b/storybook/src/Models/PaymentRequestModel.qml similarity index 100% rename from storybook/src/Models/RequestPaymentModel.qml rename to storybook/src/Models/PaymentRequestModel.qml diff --git a/storybook/src/Models/qmldir b/storybook/src/Models/qmldir index 0aa9e39459..d72574bb7b 100644 --- a/storybook/src/Models/qmldir +++ b/storybook/src/Models/qmldir @@ -23,7 +23,7 @@ TokensBySymbolModel 1.0 TokensBySymbolModel.qml CommunitiesModel 1.0 CommunitiesModel.qml OnRampProvidersModel 1.0 OnRampProvidersModel.qml SwapTransactionRoutes 1.0 SwapTransactionRoutes.qml -RequestPaymentModel 1.0 RequestPaymentModel.qml +PaymentRequestModel 1.0 PaymentRequestModel.qml singleton ModelsData 1.0 ModelsData.qml singleton NetworksModel 1.0 NetworksModel.qml diff --git a/storybook/stubs/shared/stores/RequestPaymentStore.qml b/storybook/stubs/shared/stores/RequestPaymentStore.qml deleted file mode 100644 index 0b9c09840c..0000000000 --- a/storybook/stubs/shared/stores/RequestPaymentStore.qml +++ /dev/null @@ -1,23 +0,0 @@ -import QtQuick 2.15 - -QtObject { - required property CurrenciesStore currencyStore - required property var flatNetworksModel - required property var processedAssetsModel - required property var accountsModel - - property var requestPaymentModel: ListModel {} - - function addPaymentRequest(symbol, amount, address, chainId) { - requestPaymentModel.append({ - symbol: symbol, - amount: amount, - address: address, - chainId: chainId - }) - } - - function removePaymentRequest(index) { - requestPaymentModel.remove(index) - } -} diff --git a/ui/imports/shared/controls/chat/ChatInputLinksPreviewArea.qml b/ui/imports/shared/controls/chat/ChatInputLinksPreviewArea.qml index 5543fbd777..b287e7e2be 100644 --- a/ui/imports/shared/controls/chat/ChatInputLinksPreviewArea.qml +++ b/ui/imports/shared/controls/chat/ChatInputLinksPreviewArea.qml @@ -37,10 +37,10 @@ Control { string symbol string amount */ - required property var requestPaymentModel + required property var paymentRequestModel readonly property alias hoveredUrl: d.hoveredUrl - readonly property bool hasContent: imagePreviewArray.length > 0 || showLinkPreviewSettings || linkPreviewRepeater.count > 0 || requestPaymentRepeater.count > 0 + readonly property bool hasContent: imagePreviewArray.length > 0 || showLinkPreviewSettings || linkPreviewRepeater.count > 0 || paymentRequestRepeater.count > 0 signal imageRemoved(int index) signal imageClicked(var chatImage) @@ -105,9 +105,9 @@ Control { visible: !!imagePreviewArray && imagePreviewArray.length > 0 } Repeater { - id: requestPaymentRepeater - model: root.requestPaymentModel - delegate: RequestPaymentMiniCardDelegate { + id: paymentRequestRepeater + model: root.paymentRequestModel + delegate: PaymentRequestMiniCardDelegate { required property var model amount: model.amount diff --git a/ui/imports/shared/controls/chat/RequestPaymentMiniCardDelegate.qml b/ui/imports/shared/controls/chat/PaymentRequestMiniCardDelegate.qml similarity index 100% rename from ui/imports/shared/controls/chat/RequestPaymentMiniCardDelegate.qml rename to ui/imports/shared/controls/chat/PaymentRequestMiniCardDelegate.qml diff --git a/ui/imports/shared/controls/chat/qmldir b/ui/imports/shared/controls/chat/qmldir index 60106adacf..b422a4d1ac 100644 --- a/ui/imports/shared/controls/chat/qmldir +++ b/ui/imports/shared/controls/chat/qmldir @@ -10,7 +10,7 @@ LinkPreviewCard 1.0 LinkPreviewCard.qml LinkPreviewMiniCard 1.0 LinkPreviewMiniCard.qml LinkPreviewSettingsCard 1.0 LinkPreviewSettingsCard.qml LinkPreviewSettingsCardMenu 1.0 LinkPreviewSettingsCardMenu.qml -RequestPaymentMiniCardDelegate 1.0 RequestPaymentMiniCardDelegate.qml +PaymentRequestMiniCardDelegate 1.0 PaymentRequestMiniCardDelegate.qml MessageMouseArea 1.0 MessageMouseArea.qml MessageReactionsRow 1.0 MessageReactionsRow.qml ProfileHeader 1.0 ProfileHeader.qml diff --git a/ui/imports/shared/controls/delegates/RequestPaymentCardDelegate.qml b/ui/imports/shared/controls/delegates/PaymentRequestCardDelegate.qml similarity index 100% rename from ui/imports/shared/controls/delegates/RequestPaymentCardDelegate.qml rename to ui/imports/shared/controls/delegates/PaymentRequestCardDelegate.qml diff --git a/ui/imports/shared/controls/delegates/qmldir b/ui/imports/shared/controls/delegates/qmldir index e81ea58eaf..8e630eb00e 100644 --- a/ui/imports/shared/controls/delegates/qmldir +++ b/ui/imports/shared/controls/delegates/qmldir @@ -2,5 +2,5 @@ ContactListItemDelegate 1.0 ContactListItemDelegate.qml LinkPreviewCardDelegate 1.0 LinkPreviewCardDelegate.qml LinkPreviewGifDelegate 1.0 LinkPreviewGifDelegate.qml LinkPreviewMiniCardDelegate 1.0 LinkPreviewMiniCardDelegate.qml -RequestPaymentCardDelegate 1.0 RequestPaymentCardDelegate.qml +PaymentRequestCardDelegate 1.0 PaymentRequestCardDelegate.qml InfoCard 1.0 InfoCard.qml diff --git a/ui/imports/shared/stores/RequestPaymentStore.qml b/ui/imports/shared/stores/RequestPaymentStore.qml deleted file mode 100644 index c4bd78fa80..0000000000 --- a/ui/imports/shared/stores/RequestPaymentStore.qml +++ /dev/null @@ -1,10 +0,0 @@ -import QtQuick 2.15 - -QtObject { - required property CurrenciesStore currencyStore - required property var flatNetworksModel - required property var processedAssetsModel - required property var accountsModel - - property var requestPaymentModel: null -} diff --git a/ui/imports/shared/views/chat/LinksMessageView.qml b/ui/imports/shared/views/chat/LinksMessageView.qml index b749f2eb40..a9dfc79d0e 100644 --- a/ui/imports/shared/views/chat/LinksMessageView.qml +++ b/ui/imports/shared/views/chat/LinksMessageView.qml @@ -40,7 +40,7 @@ Flow { signal imageClicked(var image, var mouse, string imageSource, string url) signal openContextMenu(var item, string url, string domain) signal setNeverAskAboutUnfurlingAgain(bool neverAskAgain) - signal requestPaymentClicked(var symbol, var amount, var receiver, var chainId) + signal paymentRequestClicked(var symbol, var amount, var receiver, var chainId) function resetLocalAskAboutUnfurling() { d.localAskAboutUnfurling = true @@ -64,18 +64,18 @@ Flow { } Repeater { - id: requestPaymentRepeater + id: paymentRequestRepeater model: root.paymentRequestModel - delegate: RequestPaymentCardDelegate { + delegate: PaymentRequestCardDelegate { required property var model - objectName: "RrequestPaymentDelegate_" + model.index + objectName: "RpaymentRequestDelegate_" + model.index amount: model.amount symbol: model.symbol address: model.receiver senderName: root.senderName senderThumbnailImage: root.senderThumbnailImage senderColorId: root.senderColorId - onClicked: root.requestPaymentClicked(model.symbol, model.amount, model.receiver, model.chainId) + onClicked: root.paymentRequestClicked(model.symbol, model.amount, model.receiver, model.chainId) } } diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 0093ef6354..6067588a72 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -992,7 +992,7 @@ Loader { gifUnfurlingEnabled: root.sharedRootStore.gifUnfurlingEnabled canAskToUnfurlGifs: !root.sharedRootStore.neverAskAboutUnfurlingAgain onSetNeverAskAboutUnfurlingAgain: root.sharedRootStore.setNeverAskAboutUnfurlingAgain(neverAskAgain) - onRequestPaymentClicked: Global.paymentRequestClicked(receiver, symbol, amount, chainId) + onPaymentRequestClicked: Global.paymentRequestClicked(receiver, symbol, amount, chainId) Component.onCompleted: { root.messageStore.messageModule.forceLinkPreviewsLocalData(root.messageId)