1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

Move routing of actions after unlock into main.background

As we are unable to send a message from one background script to another, I moved the routing of the retryAction into main.background and call processMessages on the notificationBackground in unlockCompleted
This commit is contained in:
Daniel James Smith
2021-10-15 15:28:10 +02:00
parent 9c0bfd28db
commit ca0fe76172
3 changed files with 30 additions and 9 deletions

View File

@@ -127,6 +127,7 @@ export default class MainBackground {
onUpdatedRan: boolean;
onReplacedRan: boolean;
loginToAutoFill: any = null;
lockedVaultPendingNotifications: { commandToRetry: any, from: string }[] = [];
private commandsBackground: CommandsBackground;
private contextMenusBackground: ContextMenusBackground;
@@ -341,6 +342,21 @@ export default class MainBackground {
}
}
async unlockCompleted() {
if (this.lockedVaultPendingNotifications.length === 0) {
return;
}
const lockedVaultPendingNotificationsItem = this.lockedVaultPendingNotifications.pop();
switch (lockedVaultPendingNotificationsItem.from) {
case 'notificationBar':
await this.notificationBackground.processMessage(lockedVaultPendingNotificationsItem.commandToRetry, lockedVaultPendingNotificationsItem.commandToRetry.sender, null);
break;
default:
break;
}
}
async logout(expired: boolean) {
await this.eventService.uploadEvents();
const userId = await this.userService.getUserId();