Skip to content

Commit

Permalink
fix(): do not block permission request
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasGassmann committed Oct 13, 2023
1 parent b35e30f commit 324be0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/app/services/beacon.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ export class BeaconService {
});
}
async handleMessage(message: BeaconRequestOutputMessage) {
if (localStorage.getItem(StorageKeys.METAMASK_BUSY)) {
console.log('MetaMask is busy handling another request');
if (
localStorage.getItem(StorageKeys.METAMASK_BUSY) &&
message.type !== BeaconMessageType.PermissionRequest // Permission requests don't show UI, so we let them through
) {
console.log('BeaconService: MetaMask is busy handling another request');
return;
}
if (localStorage.getItem(`${StorageKeys.REQUEST_ID_PREFIX}${message.id}`)) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/metamask.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class MetamaskService {
console.log('snap installed', installedSnap);

if (localStorage.getItem(StorageKeys.METAMASK_BUSY)) {
console.log('MetaMask is busy handling another request');
console.log('MetaMaskService: MetaMask is busy handling another request');
throw new Error('MetaMask is busy handling another request');
}
localStorage.setItem(StorageKeys.METAMASK_BUSY, 'true');
Expand Down

0 comments on commit 324be0f

Please sign in to comment.