From 60fb566580a5ec2dbb219622be4521672faed077 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Wed, 2 Oct 2024 19:50:08 +0200 Subject: [PATCH] feat(@desktop/wallet): remove address prefixes from wallet account settings --- storybook/pages/AccountViewPage.qml | 4 -- .../controls/WalletAccountDelegate.qml | 5 +- .../controls/WalletAccountDetailsListItem.qml | 1 + .../controls/WalletKeyPairDelegate.qml | 2 - .../Profile/popups/RemoveKeypairPopup.qml | 2 - .../Profile/popups/WalletAddressMenu.qml | 8 +-- .../AppLayouts/Profile/stores/WalletStore.qml | 9 ---- .../AppLayouts/Profile/views/WalletView.qml | 1 - .../Profile/views/wallet/AccountView.qml | 50 ++----------------- .../Profile/views/wallet/MainView.qml | 1 - 10 files changed, 9 insertions(+), 74 deletions(-) diff --git a/storybook/pages/AccountViewPage.qml b/storybook/pages/AccountViewPage.qml index 53c6e5d3d1..79fb45eac2 100644 --- a/storybook/pages/AccountViewPage.qml +++ b/storybook/pages/AccountViewPage.qml @@ -66,10 +66,6 @@ SplitView { function getAllNetworksChainIds() { return "1:10:42161" } - - function updateWalletAccountPreferredChains(address, preferredChainIds) { - console.warn("updateWalletAccountPreferredChains :: address ::", address, "preferredChainIds :: ", preferredChainIds) - } } property var keyPairModel: WalletKeyPairModel {} diff --git a/ui/app/AppLayouts/Profile/controls/WalletAccountDelegate.qml b/ui/app/AppLayouts/Profile/controls/WalletAccountDelegate.qml index da3cbea27d..cac98cdbfd 100644 --- a/ui/app/AppLayouts/Profile/controls/WalletAccountDelegate.qml +++ b/ui/app/AppLayouts/Profile/controls/WalletAccountDelegate.qml @@ -3,6 +3,7 @@ import QtQuick 2.14 import StatusQ.Components 0.1 import StatusQ.Core.Theme 0.1 import StatusQ.Core 0.1 +import StatusQ.Core.Utils 0.1 as SQUtils import AppLayouts.Wallet 1.0 @@ -12,7 +13,6 @@ StatusListItem { id: root property var account - property var getNetworkShortNames: function(chainIds){} property int totalCount: 0 property bool nextIconVisible: true @@ -20,7 +20,8 @@ StatusListItem { objectName: account.name title: account.name - subTitle: WalletUtils.addressToDisplay(account.address, root.getNetworkShortNames(account.preferredSharingChainIds), true, sensor.containsMouse) + subTitle: SQUtils.Utils.elideText(account.address, 6, 4) + statusListItemSubTitle.customColor: sensor.containsMouse ? Theme.palette.directColor1 : Theme.palette.baseColor1 asset.color: !!account.colorId ? Utils.getColorForId(account.colorId): "" asset.emoji: account.emoji asset.name: !account.emoji ? "filled-account": "" diff --git a/ui/app/AppLayouts/Profile/controls/WalletAccountDetailsListItem.qml b/ui/app/AppLayouts/Profile/controls/WalletAccountDetailsListItem.qml index 677ff1bc68..bd6887a69a 100644 --- a/ui/app/AppLayouts/Profile/controls/WalletAccountDetailsListItem.qml +++ b/ui/app/AppLayouts/Profile/controls/WalletAccountDetailsListItem.qml @@ -21,6 +21,7 @@ StatusListItem { readonly property var timer: Timer {} } + sensor.enabled: isInteractive statusListItemTitle.customColor: Theme.palette.baseColor1 statusListItemTitle.font.pixelSize: 13 statusListItemTitle.lineHeightMode: Text.FixedHeight diff --git a/ui/app/AppLayouts/Profile/controls/WalletKeyPairDelegate.qml b/ui/app/AppLayouts/Profile/controls/WalletKeyPairDelegate.qml index d5b08f35d2..80b3f09470 100644 --- a/ui/app/AppLayouts/Profile/controls/WalletKeyPairDelegate.qml +++ b/ui/app/AppLayouts/Profile/controls/WalletKeyPairDelegate.qml @@ -16,7 +16,6 @@ Rectangle { property var keyPair property bool hasPairedDevices - property var getNetworkShortNames: function(chainIds){} property string userProfilePublicKey signal goToAccountView(var account) @@ -112,7 +111,6 @@ Rectangle { width: ListView.view.width account: model.account totalCount: ListView.view.count - getNetworkShortNames: root.getNetworkShortNames onGoToAccountView: root.goToAccountView(model.account) RowLayout { diff --git a/ui/app/AppLayouts/Profile/popups/RemoveKeypairPopup.qml b/ui/app/AppLayouts/Profile/popups/RemoveKeypairPopup.qml index c41f54734a..ecae4b4a1c 100644 --- a/ui/app/AppLayouts/Profile/popups/RemoveKeypairPopup.qml +++ b/ui/app/AppLayouts/Profile/popups/RemoveKeypairPopup.qml @@ -19,7 +19,6 @@ StatusDialog { property string name property var relatedAccounts - property var getNetworkShortNames: function(chainIds){} signal confirmClicked() @@ -68,7 +67,6 @@ StatusDialog { id: delegate width: parent.width account : model.account - getNetworkShortNames: root.getNetworkShortNames color: Theme.palette.transparent nextIconVisible: false components: StatusBaseText { diff --git a/ui/app/AppLayouts/Profile/popups/WalletAddressMenu.qml b/ui/app/AppLayouts/Profile/popups/WalletAddressMenu.qml index 30a48247f1..6b29be51bf 100644 --- a/ui/app/AppLayouts/Profile/popups/WalletAddressMenu.qml +++ b/ui/app/AppLayouts/Profile/popups/WalletAddressMenu.qml @@ -26,11 +26,9 @@ StatusMenu { name: "", emoji: "", colorId: "", - preferredSharingChainIds: "" }) property bool areTestNetworksEnabled: false property bool isGoerliEnabled: false - property var preferredSharedNetworkNamesArray signal copyToClipboard(string address) @@ -42,7 +40,6 @@ StatusMenu { StatusAction { text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.mainnet) - enabled: root.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.mainnet) icon.name: "link" onTriggered: { let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.mainnet, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "") @@ -52,7 +49,6 @@ StatusMenu { StatusAction { text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.arbitrum) - enabled: root.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.arbitrum) icon.name: "link" onTriggered: { let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.arbitrum, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "") @@ -62,7 +58,6 @@ StatusMenu { StatusAction { text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.optimism) - enabled: root.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.optimism) icon.name: "link" onTriggered: { let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.optimism, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "") @@ -89,8 +84,7 @@ StatusMenu { name: root.selectedAccount.name?? "", address: root.selectedAccount.address?? "", emoji: root.selectedAccount.emoji?? "", - colorId: root.selectedAccount.colorId?? "", - preferredSharingChainIds: root.selectedAccount.preferredSharingChainIds?? "" + colorId: root.selectedAccount.colorId?? "" }) } } diff --git a/ui/app/AppLayouts/Profile/stores/WalletStore.qml b/ui/app/AppLayouts/Profile/stores/WalletStore.qml index c423c8b909..78d7446a72 100644 --- a/ui/app/AppLayouts/Profile/stores/WalletStore.qml +++ b/ui/app/AppLayouts/Profile/stores/WalletStore.qml @@ -163,15 +163,6 @@ QtObject { networksModuleInst.updateNetworkEndPointValues(chainId, testNetwork, newMainRpcInput, newFailoverRpcUrl, revertToDefault) } - function updateWalletAccountPreferredChains(address, preferredChainIds) { - if(areTestNetworksEnabled) { - accountsModule.updateWalletAccountTestPreferredChains(address, preferredChainIds) - } - else { - accountsModule.updateWalletAccountProdPreferredChains(address, preferredChainIds) - } - } - function getNetworkShortNames(chainIds) { return networksModuleInst.getNetworkShortNames(chainIds) } diff --git a/ui/app/AppLayouts/Profile/views/WalletView.qml b/ui/app/AppLayouts/Profile/views/WalletView.qml index 05f9b10d48..2f3e3fa76d 100644 --- a/ui/app/AppLayouts/Profile/views/WalletView.qml +++ b/ui/app/AppLayouts/Profile/views/WalletView.qml @@ -447,7 +447,6 @@ SettingsContentBase { sourceComponent: RemoveKeypairPopup { name: removeKeypairPopup.name relatedAccounts: removeKeypairPopup.accounts - getNetworkShortNames: function(chainIds) {return root.walletStore.getNetworkShortNames(chainIds)} onClosed: removeKeypairPopup.active = false onConfirmClicked: { root.walletStore.deleteKeypair(removeKeypairPopup.keyUid) diff --git a/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml b/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml index 527c3e4056..cb6fb73222 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/AccountView.qml @@ -44,9 +44,6 @@ ColumnLayout { readonly property bool watchOnlyAccount: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.watchOnly: false readonly property bool privateKeyAccount: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.privateKeyImport: false readonly property bool seedImport: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.seedImport: false - readonly property string preferredSharingNetworks: !!root.account? root.account.preferredSharingChainIds: "" - property var preferredSharingNetworksArray: preferredSharingNetworks.split(":").filter(Boolean).map(Number) - property string preferredSharingNetworkShortNames: walletStore.getNetworkShortNames(preferredSharingNetworks) } spacing: 0 @@ -130,10 +127,7 @@ ColumnLayout { isInteractive: true moreButtonEnabled: true title: qsTr("Address") - subTitle: { - let address = !!root.account && root.account.address ? root.account.address: "" - return WalletUtils.colorizedChainPrefix(d.preferredSharingNetworkShortNames) + address - } + subTitle: !!root.account && root.account.address ? root.account.address: "" onButtonClicked: addressMenu.openMenu(this) } Separator { @@ -219,6 +213,7 @@ ColumnLayout { } Separator { + visible: d.watchOnlyAccount Layout.topMargin: 40 Layout.fillWidth: true Layout.preferredHeight: 1 @@ -246,43 +241,6 @@ ColumnLayout { color: Theme.palette.baseColor2 } - StatusListItem { - objectName: "PreferredNetworks_ListItem" - Layout.fillWidth: true - Layout.topMargin: Style.current.halfPadding - title: qsTr("Preferred networks when sharing this address") - color: Theme.palette.transparent - components: [ - NetworkFilter { - flatNetworks: root.walletStore.filteredFlatModel - multiSelection: true - selection: d.preferredSharingNetworksArray - - property string initialSelection - - onSelectionChanged: { - if (selection !== d.preferredSharingNetworksArray) { - d.preferredSharingNetworksArray = selection - } - } - - control.popup.onOpened: initialSelection = JSON.stringify(selection) - - control.popup.onClosed: { - if (!!root.account && initialSelection !== JSON.stringify(selection)) { - root.walletStore.updateWalletAccountPreferredChains(root.account.address, d.preferredSharingNetworksArray.join(":")) - } - } - } - ] - } - - Separator { - Layout.fillWidth: true - Layout.preferredHeight: 1 - color: Theme.palette.baseColor2 - } - StatusButton { Layout.topMargin: 20 Layout.fillWidth: true @@ -309,7 +267,8 @@ ColumnLayout { accountName: !!root.account ? root.account.name : "" accountAddress: !!root.account ? root.account.address : "" accountDerivationPath: !!root.account ? root.account.path : "" - preferredSharingNetworkShortNames: d.preferredSharingNetworkShortNames + // TODO: remove in when RemoveAccountConfirmationPopup.qml removes preferred networks + preferredSharingNetworkShortNames: "" emoji: !!root.account ? root.account.emoji : "" color: !!root.account ? Utils.getColorForId(root.account.colorId) : "" @@ -337,7 +296,6 @@ ColumnLayout { selectedAccount: root.account areTestNetworksEnabled: root.walletStore.areTestNetworksEnabled isGoerliEnabled: root.walletStore.isGoerliEnabled - preferredSharedNetworkNamesArray: d.preferredSharingNetworkShortNames.split(":").filter(Boolean) onCopyToClipboard: ClipboardUtils.setText(address) } diff --git a/ui/app/AppLayouts/Profile/views/wallet/MainView.qml b/ui/app/AppLayouts/Profile/views/wallet/MainView.qml index 0596d08fa2..9cbab3b882 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/MainView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/MainView.qml @@ -285,7 +285,6 @@ Column { width: parent.width keyPair: model.keyPair hasPairedDevices: root.walletStore.walletModule.hasPairedDevices - getNetworkShortNames: walletStore.getNetworkShortNames userProfilePublicKey: walletStore.userProfilePublicKey onGoToAccountView: root.goToAccountView(account) onRunRenameKeypairFlow: root.runRenameKeypairFlow(model)