feat: allow users to select account when sharing address for tx

Closes #1207
This commit is contained in:
Pascal Precht 2020-10-21 14:30:41 +02:00
parent fc5f7e8270
commit 43e978d205
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 55 additions and 2 deletions

View File

@ -35,8 +35,7 @@ Item {
cursorShape: Qt.PointingHandCursor
onClicked: {
if (root.state === Constants.addressRequested) {
// TODO get address from a modal instead
chatsModel.acceptRequestAddressForTransaction(messageId, walletModel.getDefaultAccount())
selectAccountModal.open()
} else if (root.state === Constants.transactionRequested) {
signTransactionModal.open()
}
@ -97,6 +96,14 @@ Item {
selectedFiatAmount: fiatValue
//outgoing: root.outgoing
}
SelectAccountModal {
id: selectAccountModal
onSelectAndShareAddressButtonClicked: {
chatsModel.acceptRequestAddressForTransaction(messageId, accountSelector.selectedAccount)
selectAccountModal.close()
}
}
}
/*##^##

View File

@ -0,0 +1,46 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3
import "../../../../../../imports"
import "../../../../../../shared"
import "../../../../../../shared/status"
ModalPopup {
id: root
title: qsTr("Select account")
height: 284
property alias accountSelector: selectFromAccount
signal selectAndShareAddressButtonClicked()
TransactionFormGroup {
anchors.fill: parent
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
AccountSelector {
id: selectFromAccount
accounts: walletModel.accounts
currency: walletModel.defaultCurrency
width: parent.width
//% "Choose account"
label: qsTr("Select account to share and receive assets")
reset: function() {
accounts = Qt.binding(function() { return walletModel.accounts })
}
}
}
footer: Item {
id: footerContainer
width: parent.width
height: children[0].height
StatusButton {
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
text: qsTr("Confirm and share address")
anchors.bottom: parent.bottom
onClicked: root.selectAndShareAddressButtonClicked()
}
}
}