feat: qml fixes && open send modal

This commit is contained in:
Emil Sawicki 2024-11-24 08:23:16 +01:00
parent 141174a09f
commit 9ad2726794
8 changed files with 46 additions and 13 deletions

View File

@ -49,6 +49,7 @@ Control {
property string messageAttachments: ""
property var reactionIcons: []
property var linkPreviewModel
property var paymentRequestModel
property var gifLinks
property string messageId: ""
@ -377,7 +378,8 @@ Control {
Layout.preferredHeight: implicitHeight
active: !root.editMode &&
((!!root.linkPreviewModel && root.linkPreviewModel.count > 0)
|| (!!root.gifLinks && root.gifLinks.length > 0))
|| (!!root.gifLinks && root.gifLinks.length > 0)
|| (!!root.paymentRequestModel && root.paymentRequestModel.count > 0))
visible: active
}
Loader {

View File

@ -326,6 +326,7 @@ Item {
deletedByContactColorHash: model.deletedByContactColorHash
linkPreviewModel: model.linkPreviewModel
links: model.links
paymentRequestModel: model.paymentRequestModel
messageAttachments: model.messageAttachments
transactionParams: model.transactionParameters
hasMention: model.mentioned

View File

@ -515,6 +515,21 @@ Item {
sendModal.open(address)
}
function onPaymentRequestClicked(receiverAddress: string, symbol: string, amount: string, chainId: int) {
if (!!symbol) {
sendModal.preSelectedHoldingID = symbol
sendModal.preSelectedHoldingType = Constants.TokenType.ERC20
}
if (!!amount) {
sendModal.preDefinedAmountToSend = amount
}
if (!!chainId) {
sendModal.preSelectedChainId = chainId
}
sendModal.open(receiverAddress)
}
function onSwitchToCommunity(communityId: string) {
appMain.communitiesStore.setActiveCommunity(communityId)
}

View File

@ -40,7 +40,7 @@ Control {
required property var requestPaymentModel
readonly property alias hoveredUrl: d.hoveredUrl
readonly property bool hasContent: imagePreviewArray.length > 0 || showLinkPreviewSettings || linkPreviewRepeater.count > 0
readonly property bool hasContent: imagePreviewArray.length > 0 || showLinkPreviewSettings || linkPreviewRepeater.count > 0 || requestPaymentRepeater.count > 0
signal imageRemoved(int index)
signal imageClicked(var chatImage)

View File

@ -20,7 +20,8 @@ CalloutCard {
required property string address
property string senderName
property var senderImageAssetSettings
property string senderThumbnailImage
property int senderColorId
property bool highlight: false
@ -97,7 +98,13 @@ CalloutCard {
StatusSmartIdenticon {
width: symbolImage.width
height: symbolImage.height
asset: root.senderImageAssetSettings
asset.width: symbolImage.width
asset.height: symbolImage.height
asset.isImage: !!root.senderThumbnailImage
asset.name: root.senderThumbnailImage
asset.isLetterIdenticon: root.senderThumbnailImage === ""
asset.color: Theme.palette.userCustomizationColors[root.senderColorId]
asset.charactersLen: 2
name: root.senderName
}
}

View File

@ -25,13 +25,14 @@ Flow {
required property var linkPreviewModel
required property var gifLinks
required property var requestPaymentModel
required property var paymentRequestModel
required property bool gifUnfurlingEnabled
required property bool canAskToUnfurlGifs
property string senderName
property var senderImageAssetSettings
property string senderThumbnailImage
property int senderColorId
readonly property alias hoveredLink: linksRepeater.hoveredUrl
property string highlightLink: ""
@ -39,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 address, var chainId)
signal requestPaymentClicked(var symbol, var amount, var receiver, var chainId)
function resetLocalAskAboutUnfurling() {
d.localAskAboutUnfurling = true
@ -64,16 +65,17 @@ Flow {
Repeater {
id: requestPaymentRepeater
model: root.requestPaymentModel
model: root.paymentRequestModel
delegate: RequestPaymentCardDelegate {
required property var model
objectName: "RrequestPaymentDelegate_" + model.index
amount: model.amount
symbol: model.symbol
address: model.address
address: model.receiver
senderName: root.senderName
senderImageAssetSettings: root.senderImageAssetSettings
onClicked: root.requestPaymentClicked(model.symbol, model.amount, model.address, model.chainId)
senderThumbnailImage: root.senderThumbnailImage
senderColorId: root.senderColorId
onClicked: root.requestPaymentClicked(model.symbol, model.amount, model.receiver, model.chainId)
}
}

View File

@ -70,7 +70,7 @@ Loader {
property string messagePinnedBy: ""
property var reactionsModel: []
property var linkPreviewModel
property var requestPaymentModel
property var paymentRequestModel
property string messageAttachments: ""
property var transactionParams
property var emojiReactionsModel
@ -721,6 +721,7 @@ Loader {
resendError: root.resendError
reactionsModel: root.reactionsModel
linkPreviewModel: root.linkPreviewModel
paymentRequestModel: root.paymentRequestModel
gifLinks: root.gifLinks
showHeader: root.shouldRepeatHeader || dateGroupLabel.visible || isAReply ||
@ -974,7 +975,10 @@ Loader {
linkPreviewModel: root.linkPreviewModel
gifLinks: root.gifLinks
requestPaymentModel: root.requestPaymentModel
senderName: root.senderDisplayName
senderThumbnailImage: root.senderIcon || ""
senderColorId: Utils.colorIdForPubkey(root.senderId)
paymentRequestModel: root.paymentRequestModel
playAnimations: root.Window.active && root.messageStore.isChatActive
isOnline: root.rootStore.mainModuleInst.isOnline
highlightLink: delegate.hoveredLink
@ -988,6 +992,7 @@ Loader {
gifUnfurlingEnabled: root.sharedRootStore.gifUnfurlingEnabled
canAskToUnfurlGifs: !root.sharedRootStore.neverAskAboutUnfurlingAgain
onSetNeverAskAboutUnfurlingAgain: root.sharedRootStore.setNeverAskAboutUnfurlingAgain(neverAskAgain)
onRequestPaymentClicked: Global.paymentRequestClicked(receiver, symbol, amount, chainId)
Component.onCompleted: {
root.messageStore.messageModule.forceLinkPreviewsLocalData(root.messageId)

View File

@ -73,6 +73,7 @@ QtObject {
signal appSectionBySectionTypeChanged(int sectionType, int subsection, int subSubsection, var data)
signal openSendModal(string address)
signal paymentRequestClicked(string receiverAddress, string symbol, string amount, int chainId)
signal switchToCommunity(string communityId)
signal switchToCommunitySettings(string communityId)
signal switchToCommunityChannelsView(string communityId)