From 702f52f6edc4848af8362da9449ca887b73487c6 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 22 Jun 2021 12:59:11 -0400 Subject: [PATCH] fix(browser): fix browser undefined model --- src/app/wallet/view.nim | 4 ++++ ui/app/AppLayouts/Browser/BrowserConnectionModal.qml | 2 +- ui/app/AppLayouts/Browser/BrowserHeader.qml | 4 ++-- ui/app/AppLayouts/Browser/BrowserLayout.qml | 6 +++--- ui/app/AppLayouts/Browser/BrowserWalletMenu.qml | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/app/wallet/view.nim b/src/app/wallet/view.nim index 4b1752bafa..b83863b956 100644 --- a/src/app/wallet/view.nim +++ b/src/app/wallet/view.nim @@ -85,6 +85,10 @@ QtObject: QtProperty[QVariant] utilsView: read = getUtils + proc getDappBrowserView(self: WalletView): QVariant {.slot.} = newQVariant(self.dappBrowserView) + QtProperty[QVariant] dappBrowserView: + read = getDappBrowserView + proc updateView*(self: WalletView) = self.balanceView.setTotalFiatBalance(self.status.wallet.getTotalFiatBalance()) self.balanceView.totalFiatBalanceChanged() diff --git a/ui/app/AppLayouts/Browser/BrowserConnectionModal.qml b/ui/app/AppLayouts/Browser/BrowserConnectionModal.qml index 02bd5a4e35..792717f5c6 100644 --- a/ui/app/AppLayouts/Browser/BrowserConnectionModal.qml +++ b/ui/app/AppLayouts/Browser/BrowserConnectionModal.qml @@ -118,7 +118,7 @@ Popup { Layout.alignment: Qt.AlignHCenter | Qt.AlignTop showAccountDetails: false accounts: walletModel.accountsView.accounts - selectedAccount: walletModel.dappBrowserAccount + selectedAccount: walletModel.dappBrowserView.dappBrowserAccount currency: walletModel.balanceView.defaultCurrency onSelectedAccountChanged: { if (!root.currentAddress) { diff --git a/ui/app/AppLayouts/Browser/BrowserHeader.qml b/ui/app/AppLayouts/Browser/BrowserHeader.qml index 4a74da73b1..5853e806ea 100644 --- a/ui/app/AppLayouts/Browser/BrowserHeader.qml +++ b/ui/app/AppLayouts/Browser/BrowserHeader.qml @@ -226,8 +226,8 @@ Rectangle { icon.source: "../../img/walletIcon.svg" icon.width: 18 icon.height: 18 - icon.color: walletModel.dappBrowserAccount.iconColor - text: walletModel.dappBrowserAccount.name + icon.color: walletModel.dappBrowserView.dappBrowserAccount.iconColor + text: walletModel.dappBrowserView.dappBrowserAccount.name implicitHeight: 32 type: "secondary" onClicked: { diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml index 868012a85d..71837c5e63 100644 --- a/ui/app/AppLayouts/Browser/BrowserLayout.qml +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -164,7 +164,7 @@ property Component sendTransactionModalComponent: SignTransactionModal {} } } else if (request.type === Constants.web3SendAsyncReadOnly && request.payload.method === "eth_sendTransaction") { - var acc = walletModel.dappBrowserAccount + var acc = walletModel.dappBrowserView.dappBrowserAccount const value = utilsModel.wei2Eth(request.payload.params[0].value, 18); const sendDialog = sendTransactionModalComponent.createObject(browserWindow, { trxData: request.payload.params[0].data || "", @@ -234,8 +234,8 @@ property Component sendTransactionModalComponent: SignTransactionModal {} const signDialog = signMessageModalComponent.createObject(browserWindow, { request, selectedAccount: { - name: walletModel.dappBrowserAccount.name, - iconColor: walletModel.dappBrowserAccount.iconColor + name: walletModel.dappBrowserView.dappBrowserAccount.name, + iconColor: walletModel.dappBrowserView.dappBrowserAccount.iconColor } }); signDialog.web3Response = web3Response diff --git a/ui/app/AppLayouts/Browser/BrowserWalletMenu.qml b/ui/app/AppLayouts/Browser/BrowserWalletMenu.qml index 05f7df771d..b355fa7f19 100644 --- a/ui/app/AppLayouts/Browser/BrowserWalletMenu.qml +++ b/ui/app/AppLayouts/Browser/BrowserWalletMenu.qml @@ -110,7 +110,7 @@ Popup { anchors.right: copyBtn.left anchors.rightMargin: Style.current.padding accounts: walletModel.accountsView.accounts - selectedAccount: walletModel.dappBrowserAccount + selectedAccount: walletModel.dappBrowserView.dappBrowserAccount currency: walletModel.balanceView.defaultCurrency onSelectedAccountChanged: { if (!accountSelectorRow.currentAddress) {