From 0fccbb03bbc294d678935f659c9f5f2355f53a62 Mon Sep 17 00:00:00 2001
From: KillariDev
Date: Tue, 30 Jul 2024 10:56:34 +0300
Subject: [PATCH] display all pending requests at once
---
.../background/windows/interceptorAccess.ts | 6 +-
app/ts/components/App.tsx | 2 +-
.../components/pages/ChangeActiveAddress.tsx | 10 +-
app/ts/components/pages/InterceptorAccess.tsx | 168 +++++++-----------
app/ts/types/user-interface-types.ts | 2 +-
5 files changed, 76 insertions(+), 112 deletions(-)
diff --git a/app/ts/background/windows/interceptorAccess.ts b/app/ts/background/windows/interceptorAccess.ts
index b5909c4c..32efb2a1 100644
--- a/app/ts/background/windows/interceptorAccess.ts
+++ b/app/ts/background/windows/interceptorAccess.ts
@@ -126,7 +126,6 @@ export async function requestAccessFromUser(
const justAddToPending = await verifyPendingRequests()
const hasAccess = verifyAccess(websiteTabConnections, socket, true, website.websiteOrigin, activeAddressEntry, await getSettings())
-
if (hasAccess === 'hasAccess') { // we already have access, just reply with the gate keeped request right away
if (request !== undefined) await handleInterceptedRequest(undefined, website.websiteOrigin, website, simulator, socket, request, websiteTabConnections)
return
@@ -182,8 +181,9 @@ export async function requestAccessFromUser(
return previousPendingAccessRequests
})
if (pendingRequests.current.find((x) => x.accessRequestId === accessRequestId) === undefined) return pendingAccessRequests.resolve(pendingRequests.current)
-
- if (pendingRequests.previous.find((x) => x.accessRequestId === accessRequestId) !== undefined) {
+ const oldPendingRequest = pendingRequests.previous.find((x) => x.accessRequestId === accessRequestId)
+ if (oldPendingRequest !== undefined) {
+ await tryFocusingTabOrWindow(oldPendingRequest.popupOrTabId)
if (request !== undefined) {
replyToInterceptedRequest(websiteTabConnections, {
type: 'result',
diff --git a/app/ts/components/App.tsx b/app/ts/components/App.tsx
index 38656115..e373aab0 100644
--- a/app/ts/components/App.tsx
+++ b/app/ts/components/App.tsx
@@ -377,7 +377,7 @@ export function App() {
setAndSaveAppPage({ page: 'Home' }) }
activeAddresses = { activeAddresses }
signerName = { tabState?.signerName ?? 'NoSignerDetected' }
renameAddressCallBack = { renameAddressCallBack }
diff --git a/app/ts/components/pages/ChangeActiveAddress.tsx b/app/ts/components/pages/ChangeActiveAddress.tsx
index 532f62ee..c093f158 100644
--- a/app/ts/components/pages/ChangeActiveAddress.tsx
+++ b/app/ts/components/pages/ChangeActiveAddress.tsx
@@ -6,7 +6,7 @@ import { getSignerLogo, getPrettySignerName, SignerLogoText } from '../subcompon
export function ChangeActiveAddress(param: ChangeActiveAddressParam) {
function changeAndStoreActiveAddress(activeAddress: bigint | 'signer') {
- param.setAndSaveAppPage({ page: 'Home' })
+ param.close()
param.setActiveAddressAndInformAboutIt(activeAddress)
}
@@ -21,10 +21,6 @@ export function ChangeActiveAddress(param: ChangeActiveAddressParam) {
return address !== undefined && getSignerAccount() === address
}
- function goHome() {
- param.setAndSaveAppPage({ page: 'Home' })
- }
-
function changePageToAddAddress() {
param.addNewAddress()
}
@@ -45,7 +41,7 @@ export function ChangeActiveAddress(param: ChangeActiveAddressParam) {
Change Active Address
-