2020-08-25 18:44:29 +00:00
|
|
|
import QtQuick 2.3
|
2021-10-27 21:27:49 +00:00
|
|
|
|
|
|
|
import shared 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.controls 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2020-08-25 18:44:29 +00:00
|
|
|
|
2021-10-22 20:49:47 +00:00
|
|
|
//TODO remove dynamic scoping
|
2020-08-25 18:44:29 +00:00
|
|
|
Item {
|
2021-10-22 20:49:47 +00:00
|
|
|
id: root
|
2020-08-25 18:44:29 +00:00
|
|
|
width: parent.width
|
|
|
|
height: childrenRect.height
|
2021-10-22 20:49:47 +00:00
|
|
|
|
2023-06-29 17:35:18 +00:00
|
|
|
property var store // Expected ui/app/AppLayouts/Chat/stores/RootStore.qml
|
2022-01-04 12:06:05 +00:00
|
|
|
property var contactsStore
|
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
property var token
|
|
|
|
property string tokenAmount
|
|
|
|
property string fiatValue
|
2022-02-09 00:04:49 +00:00
|
|
|
property var selectedRecipient
|
2021-10-22 20:49:47 +00:00
|
|
|
property int state: Constants.addressRequested
|
2020-08-25 18:44:29 +00:00
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: separator1
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: acceptText
|
|
|
|
color: Style.current.blue
|
2022-02-09 09:43:23 +00:00
|
|
|
text: root.state === Constants.addressRequested ?
|
2022-04-04 11:26:30 +00:00
|
|
|
qsTr("Accept and share address") :
|
|
|
|
qsTr("Accept and send")
|
2020-09-03 20:43:08 +00:00
|
|
|
padding: Style.current.halfPadding
|
2020-08-25 18:44:29 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.weight: Font.Medium
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: separator1.bottom
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
2020-09-03 20:43:08 +00:00
|
|
|
if (root.state === Constants.addressRequested) {
|
2023-05-23 12:46:16 +00:00
|
|
|
Global.openPopup(selectAccountModalComponent);
|
2020-09-03 20:43:08 +00:00
|
|
|
} else if (root.state === Constants.transactionRequested) {
|
2021-12-07 20:33:12 +00:00
|
|
|
Global.openPopup(signTxComponent)
|
2020-09-03 20:43:08 +00:00
|
|
|
}
|
2020-08-25 18:44:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: separator2
|
|
|
|
anchors.topMargin: 0
|
|
|
|
anchors.top: acceptText.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: declineText
|
|
|
|
color: Style.current.blue
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Decline")
|
2020-08-25 18:44:29 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.weight: Font.Medium
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
2020-09-03 20:43:08 +00:00
|
|
|
padding: Style.current.halfPadding
|
2020-08-25 18:44:29 +00:00
|
|
|
anchors.top: separator2.bottom
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
2022-02-09 00:04:49 +00:00
|
|
|
if (root.state === Constants.addressRequested) {
|
|
|
|
root.store.declineAddressRequest(messageId)
|
|
|
|
} else if (root.state === Constants.transactionRequested) {
|
|
|
|
root.store.declineRequest(messageId)
|
|
|
|
}
|
2020-08-25 18:44:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-19 00:57:38 +00:00
|
|
|
|
2021-01-18 12:44:33 +00:00
|
|
|
ConfirmationDialog {
|
|
|
|
id: gasEstimateErrorPopup
|
|
|
|
height: 220
|
|
|
|
onConfirmButtonClicked: {
|
|
|
|
gasEstimateErrorPopup.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-20 17:05:07 +00:00
|
|
|
Component {
|
|
|
|
id: signTxComponent
|
|
|
|
SignTransactionModal {
|
2022-02-09 00:04:49 +00:00
|
|
|
anchors.centerIn: parent
|
2021-10-22 20:49:47 +00:00
|
|
|
store: root.store
|
2022-01-04 12:06:05 +00:00
|
|
|
contactsStore: root.contactsStore
|
2021-12-08 21:20:43 +00:00
|
|
|
msgId: messageId
|
2022-02-24 19:24:58 +00:00
|
|
|
isARequest: true
|
2022-05-19 08:53:57 +00:00
|
|
|
chainId: root.store.getChainIdForChat()
|
2022-02-09 00:04:49 +00:00
|
|
|
onClosed: destroy()
|
2021-12-08 21:20:43 +00:00
|
|
|
onOpenGasEstimateErrorPopup: {
|
2022-04-04 11:26:30 +00:00
|
|
|
gasEstimateErrorPopup.confirmationText = message + qsTr("Decline");
|
2021-12-08 21:20:43 +00:00
|
|
|
gasEstimateErrorPopup.open();
|
|
|
|
return;
|
|
|
|
}
|
2020-11-03 10:29:56 +00:00
|
|
|
selectedAccount: {}
|
2022-02-09 00:04:49 +00:00
|
|
|
selectedRecipient: root.selectedRecipient
|
2020-11-03 10:29:56 +00:00
|
|
|
selectedAsset: token
|
|
|
|
selectedAmount: tokenAmount
|
|
|
|
selectedFiatAmount: fiatValue
|
2020-10-19 00:57:38 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-21 12:30:41 +00:00
|
|
|
|
2023-05-23 12:46:16 +00:00
|
|
|
Component {
|
|
|
|
id: selectAccountModalComponent
|
|
|
|
SelectAccountModal {
|
|
|
|
id: selectAccountModal
|
|
|
|
anchors.centerIn: parent
|
|
|
|
accounts: root.store.accounts
|
|
|
|
currency: root.store.currentCurrency
|
|
|
|
onSelectAndShareAddressButtonClicked: {
|
|
|
|
root.store.acceptAddressRequest(messageId, accountSelector.selectedAccount.address)
|
|
|
|
selectAccountModal.close()
|
|
|
|
}
|
2020-10-21 12:30:41 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-25 18:44:29 +00:00
|
|
|
}
|