diff --git a/ui/app/AppLayouts/Wallet/services/dapps/DAppsListProvider.qml b/ui/app/AppLayouts/Wallet/services/dapps/DAppsListProvider.qml index ac43169266..a12a45545e 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/DAppsListProvider.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/DAppsListProvider.qml @@ -60,19 +60,15 @@ QObject { let dappsList = JSON.parse(dappsJson); for (let i = 0; i < dappsList.length; i++) { const cachedEntry = dappsList[i]; - let accountAddresses = cachedEntry.accountAddresses - if (!accountAddresses) { - accountAddresses = [{address: ''}]; - } - + // TODO #15075: on SDK dApps refresh update the model that has data source from persistence instead of using reset const dappEntryWithRequiredRoles = { - description: cachedEntry.description, + description: "", url: cachedEntry.url, name: cachedEntry.name, - iconUrl: cachedEntry.url, - accountAddresses: cachedEntry.accountAddresses + iconUrl: cachedEntry.iconUrl, + accountAddresses: [{address: ''}] } - dapps.append(dappsList[i]); + dapps.append(dappEntryWithRequiredRoles); } } root.store.dappsListReceived.connect(dappsListReceivedFn); @@ -103,7 +99,7 @@ QObject { if (existingDApp) { // In Qt5.15.2 this is the way to make a "union" of two arrays // more modern syntax (ES-6) is not available yet - const combinedAddresses = new Set(existingDApp.accountAddresses.concat(dapp.accountAddresses)); + const combinedAddresses = new Set(existingDApp.accountAddresses.concat(accounts)); existingDApp.accountAddresses = Array.from(combinedAddresses); } else { dapp.accountAddresses = accounts diff --git a/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml b/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml index 9637842835..f13ff0e307 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml @@ -503,7 +503,6 @@ WalletConnectSDKBase { controller.recallDAppPermission(dAppUrl) const session = { url: dAppUrl, name: "", icon: "" } root.wcService.connectorDAppsProvider.revokeSession(JSON.stringify(session)) - root.wcService.displayToastMessage(qsTr("Disconnected from %1").arg(dAppUrl), false) } } diff --git a/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml b/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml index a1298cfc53..ec9de28352 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml @@ -128,6 +128,7 @@ QObject { function disconnectDapp(url) { wcSDK.getActiveSessions((allSessionsAllProfiles) => { const sessions = DAppsHelpers.filterActiveSessionsForKnownAccounts(allSessionsAllProfiles, validAccounts) + let dappFoundInWcSessions = false for (const sessionID in sessions) { const session = sessions[sessionID] const accountsInSession = DAppsHelpers.getAccountsInSession(session) @@ -137,13 +138,19 @@ QObject { if (!dappsProvider.selectedAddress || (accountsInSession.includes(dappsProvider.selectedAddress))) { + dappFoundInWcSessions = true wcSDK.disconnectSession(topic) } } } - }); - root.revokeSession(url) + // TODO: #16044 - Refactor Wallet connect service to handle multiple SDKs + if (!dappFoundInWcSessions) { + // Revoke browser plugin session + root.revokeSession(url) + d.notifyDappDisconnect(url, false) + } + }); } function getDApp(dAppUrl) { @@ -332,18 +339,7 @@ QObject { sdk: root.wcSDK store: root.store - supportedAccountsModel: SortFilterProxyModel { - objectName: "SelectedAddressModelForDAppsListProvider" - sourceModel: d.supportedAccountsModel - filters: FastExpressionFilter { - enabled: !root.walletRootStore.showAllAccounts - - expression: root.walletRootStore.selectedAddress.toLowerCase() === model.address.toLowerCase() - - expectedRoles: ["address"] - } - } - + supportedAccountsModel: d.supportedAccountsModel selectedAddress: root.walletRootStore.selectedAddress }