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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user