feat(@wallet): add account button from settings

This commit is contained in:
Anthony Laibe 2023-06-27 08:13:55 +01:00
parent 80fef2179a
commit 7dbf994e1f
51 changed files with 68 additions and 68 deletions

View File

@ -11,10 +11,10 @@ import ./assets/module as assets_module
import ./transactions/module as transactions_module
import ./saved_addresses/module as saved_addresses_module
import ./buy_sell_crypto/module as buy_sell_crypto_module
import ./add_account/module as add_account_module
import ./networks/module as networks_module
import ./overview/module as overview_module
import ./send/module as send_module
import ../../shared_modules/add_account/module as add_account_module
import ./activity/controller as activityc

View File

@ -2,13 +2,13 @@ import times, os, chronicles
import uuids
import io_interface
import ../../../../../app_service/service/accounts/service as accounts_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../../app_service/service/keycard/service as keycard_service
import ../../../../app_service/service/accounts/service as accounts_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../app_service/service/keycard/service as keycard_service
import ../../../shared_modules/keycard_popup/io_interface as keycard_shared_module
import ../keycard_popup/io_interface as keycard_shared_module
import ../../../../core/eventemitter
import ../../../core/eventemitter
logScope:
topics = "wallet-add-account-controller"

View File

@ -1,8 +1,8 @@
import Tables, NimQml
import ../../../../../app_service/service/accounts/dto/generated_accounts
import ../../../../../app_service/service/wallet_account/derived_address
from ../../../../../app_service/service/keycard/service import KeycardEvent
import ../../../../app_service/service/accounts/dto/generated_accounts
import ../../../../app_service/service/wallet_account/derived_address
from ../../../../app_service/service/keycard/service import KeycardEvent
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -4,18 +4,18 @@ import io_interface
import view, controller, derived_address_model
import internal/[state, state_factory]
import ../../../../core/eventemitter
import ../../../core/eventemitter
import ../../../../global/global_singleton
import ../../../global/global_singleton
import ../../../shared/keypairs
import ../../../shared_models/[keypair_model]
import ../../../shared_modules/keycard_popup/module as keycard_shared_module
import ../../shared/keypairs
import ../../shared_models/[keypair_model]
import ../../shared_modules/keycard_popup/module as keycard_shared_module
import ../../../../../app_service/common/account_constants
import ../../../../../app_service/service/accounts/service as accounts_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../../app_service/service/keycard/service as keycard_service
import ../../../../app_service/common/account_constants
import ../../../../app_service/service/accounts/service as accounts_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../app_service/service/keycard/service as keycard_service
export io_interface

View File

@ -2,7 +2,7 @@ import NimQml
import io_interface
import derived_address_model
import internal/[state, state_wrapper]
import ../../../shared_models/[keypair_model, keypair_item]
import ../../shared_models/[keypair_model, keypair_item]
QtObject:
type

View File

@ -43,25 +43,11 @@ QtObject {
return accountsModule.updateAccountPosition(address, position)
}
property var dappList: Global.appIsReady? dappPermissionsModule.dapps : null
function disconnect(dappName) {
dappPermissionsModule.disconnect(dappName)
}
function accountsForDapp(dappName) {
return dappPermissionsModule.accountsForDapp(dappName)
}
function disconnectAddress(dappName, address) {
return dappPermissionsModule.disconnectAddress(dappName, address)
}
function loadDapps() {
dappPermissionsModule.loadDapps()
}
function getAllNetworksSupportedPrefix() {
return networksModule.getAllNetworksSupportedPrefix()
}
function runAddAccountPopup() {
walletSection.runAddAccountPopup(false)
}
}

View File

@ -27,7 +27,10 @@ SettingsContentBase {
readonly property int networksViewIndex: 1;
readonly property int accountOrderViewIndex: 2;
readonly property int accountViewIndex: 3;
readonly property int dappPermissionViewIndex: 4;
Component.onCompleted: {
root.titleRowComponentLoader.sourceComponent = addNewAccountButtonComponent
}
function resetStack() {
stackContainer.currentIndex = mainViewIndex;
@ -44,6 +47,10 @@ SettingsContentBase {
root.sectionTitle = qsTr("Wallet")
root.titleRowComponentLoader.sourceComponent = undefined
if (currentIndex == root.mainViewIndex) {
root.titleRowComponentLoader.sourceComponent = addNewAccountButtonComponent
}
if(currentIndex == root.networksViewIndex) {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = qsTr("Networks")
@ -54,10 +61,6 @@ SettingsContentBase {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = ""
}
else if(currentIndex == root.dappPermissionViewIndex) {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = qsTr("DApp Permissions")
}
else if(currentIndex == root.accountOrderViewIndex) {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = qsTr("Edit account order")
@ -70,6 +73,7 @@ SettingsContentBase {
Layout.fillWidth: true
walletStore: root.walletStore
emojiPopup: root.emojiPopup
onGoToNetworksView: {
stackContainer.currentIndex = networksViewIndex
@ -83,10 +87,6 @@ SettingsContentBase {
onGoToAccountOrderView: {
stackContainer.currentIndex = accountOrderViewIndex
}
onGoToDappPermissionsView: {
stackContainer.currentIndex = dappPermissionViewIndex
}
}
NetworksView {
@ -127,5 +127,13 @@ SettingsContentBase {
onClicked: walletStore.toggleTestNetworksEnabled()
}
}
Component {
id: addNewAccountButtonComponent
StatusButton {
text: qsTr("Add new account")
onClicked: root.walletStore.runAddAccountPopup()
}
}
}
}

View File

@ -7,6 +7,7 @@ import shared.panels 1.0
import StatusQ.Core.Theme 0.1
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import shared.popups.addaccount 1.0
import "../../stores"
import "../../controls"
@ -16,34 +17,40 @@ Column {
id: root
property WalletStore walletStore
property var emojiPopup
signal goToNetworksView()
signal goToAccountOrderView()
signal goToAccountView(var account)
signal goToDappPermissionsView()
Component.onCompleted: {
// TODO remove this call and handle it from the backend
// once the profile is refactored and the navigation is driven from the backend
root.walletStore.loadDapps()
}
spacing: 8
Separator {}
Connections {
target: walletSection
StatusListItem {
title: qsTr("DApp Permissions")
height: 64
width: parent.width
onClicked: goToDappPermissionsView()
label: qsTr("%n DApp(s) connected", "", root.walletStore.dappList.count)
components: [
StatusIcon {
icon: "next"
color: Theme.palette.baseColor1
function onDisplayAddAccountPopup() {
addAccount.active = true
}
function onDestroyAddAccountPopup() {
addAccount.active = false
}
}
Loader {
id: addAccount
active: false
asynchronous: true
sourceComponent: AddAccountPopup {
store.emojiPopup: root.emojiPopup
store.addAccountModule: walletSection.addAccountModule
}
onLoaded: {
addAccount.item.open()
}
]
}
Separator {}

View File

@ -6,8 +6,6 @@ import utils 1.0
import SortFilterProxyModel 0.2
import StatusQ.Core.Theme 0.1
import "../addaccount/stores"
QtObject {
id: root

View File

@ -16,12 +16,12 @@ import shared.panels 1.0
import shared.controls 1.0
import shared.popups 1.0
import shared.popups.keycard 1.0
import shared.popups.addaccount 1.0
import shared.stores 1.0
import "../controls"
import "../popups"
import "../stores"
import "../addaccount"
Rectangle {
id: root

View File

@ -0,0 +1 @@
AddAccountPopup 1.0 AddAccountPopup.qml