fix(@desktop/wallet): importing keypairs at the account level (navigating into an account page in Wallet settings) (point 8)

Point 8 of #11968
This commit is contained in:
Sale Djenic 2023-08-23 09:09:50 +02:00 committed by saledjenic
parent 70343c4b4f
commit fadad5f4f6
5 changed files with 57 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import app_service/service/wallet_account/dto/derived_address_dto
type ImportKeypairModuleMode* {.pure.}= enum type ImportKeypairModuleMode* {.pure.}= enum
SelectKeypair = 1 SelectKeypair = 1
SelectImportMethod
ImportViaSeedPhrase ImportViaSeedPhrase
ImportViaPrivateKey ImportViaPrivateKey
ImportViaQr ImportViaQr

View File

@ -79,7 +79,9 @@ method load*[T](self: Module[T], keyUid: string, mode: ImportKeypairModuleMode)
self.closeKeypairImportPopup() self.closeKeypairImportPopup()
return return
self.view.setSelectedKeypairItem(keypairItem) self.view.setSelectedKeypairItem(keypairItem)
if mode == ImportKeypairModuleMode.ImportViaPrivateKey: if mode == ImportKeypairModuleMode.SelectImportMethod:
self.view.setCurrentState(newSelectImportMethodState(nil))
elif mode == ImportKeypairModuleMode.ImportViaPrivateKey:
self.view.setCurrentState(newImportPrivateKeyState(nil)) self.view.setCurrentState(newImportPrivateKeyState(nil))
elif mode == ImportKeypairModuleMode.ImportViaSeedPhrase: elif mode == ImportKeypairModuleMode.ImportViaSeedPhrase:
self.view.setCurrentState(newImportSeedPhraseState(nil)) self.view.setCurrentState(newImportSeedPhraseState(nil))

View File

@ -184,6 +184,9 @@ SettingsContentBase {
removeKeypairPopup.accounts= keyPair.accounts removeKeypairPopup.accounts= keyPair.accounts
removeKeypairPopup.active = true removeKeypairPopup.active = true
} }
onRunImportMissingKeypairFlow: {
root.walletStore.runKeypairImportPopup(keyPair.keyUid, Constants.keypairImportPopup.mode.selectImportMethod)
}
} }
DappPermissionsView { DappPermissionsView {

View File

@ -25,6 +25,7 @@ ColumnLayout {
signal goBack signal goBack
signal runRenameKeypairFlow() signal runRenameKeypairFlow()
signal runRemoveKeypairFlow() signal runRemoveKeypairFlow()
signal runImportMissingKeypairFlow()
property var account property var account
property var keyPair property var keyPair
@ -78,6 +79,50 @@ ColumnLayout {
} }
} }
Rectangle {
Layout.fillWidth: true
Layout.topMargin: Style.current.bigPadding
Layout.preferredHeight: childrenRect.height
visible: !!root.keyPair && root.keyPair.operability === Constants.keypair.operability.nonOperable
radius: Style.current.radius
border.width: 1
border.color: Theme.palette.directColor8
color: Theme.palette.transparent
ColumnLayout {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
spacing: Style.current.halfPadding
StatusBaseText {
Layout.fillWidth: true
Layout.topMargin: Style.current.padding
text: qsTr("Import keypair to use this account")
color: Theme.palette.warningColor1
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: qsTr("This account was added to one of your synced devices. To use this account you will first need import the associated keypair to this device.")
}
StatusButton {
Layout.alignment: Qt.AlignLeft
Layout.bottomMargin: Style.current.padding
text: qsTr("Import keypair")
type: StatusBaseButton.Type.Warning
icon.name: "download"
onClicked: {
root.runImportMissingKeypairFlow()
}
}
}
}
StatusBaseText { StatusBaseText {
Layout.topMargin: Style.current.bigPadding Layout.topMargin: Style.current.bigPadding
text: qsTr("Account details") text: qsTr("Account details")

View File

@ -748,10 +748,11 @@ QtObject {
readonly property QtObject mode: QtObject { readonly property QtObject mode: QtObject {
readonly property int selectKeypair: 1 readonly property int selectKeypair: 1
readonly property int importViaSeedPhrase: 2 readonly property int selectImportMethod: 2
readonly property int importViaPrivateKey: 3 readonly property int importViaSeedPhrase: 3
readonly property int importViaQr: 4 readonly property int importViaPrivateKey: 4
readonly property int exportKeypairQr: 5 readonly property int importViaQr: 5
readonly property int exportKeypairQr: 6
} }
readonly property QtObject state: QtObject { readonly property QtObject state: QtObject {