1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 14:53:33 +00:00

implement notifications service

This commit is contained in:
Kyle Spearrin
2018-08-20 17:40:39 -04:00
parent ce61e62cf0
commit 50c94f587d
12 changed files with 61 additions and 18 deletions

View File

@@ -22,6 +22,8 @@ import MainBackground from './main.background';
import { AutofillService } from '../services/abstractions/autofill.service';
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
import { NotificationsService } from 'jslib/abstractions/notifications.service';
import { Utils } from 'jslib/misc/utils';
export default class RuntimeBackground {
@@ -33,7 +35,8 @@ export default class RuntimeBackground {
constructor(private main: MainBackground, private autofillService: AutofillService,
private cipherService: CipherService, private platformUtilsService: BrowserPlatformUtilsService,
private storageService: StorageService, private i18nService: I18nService, private analytics: Analytics) {
private storageService: StorageService, private i18nService: I18nService,
private analytics: Analytics, private notificationsService: NotificationsService) {
this.isSafari = this.platformUtilsService.isSafari();
this.runtime = this.isSafari ? safari.application : chrome.runtime;
@@ -77,6 +80,10 @@ export default class RuntimeBackground {
async processMessage(msg: any, sender: any, sendResponse: any) {
switch (msg.command) {
case 'loggedIn':
await this.main.setIcon();
await this.main.refreshBadgeAndMenu(false);
this.notificationsService.updateConnection();
break;
case 'unlocked':
case 'locked':
await this.main.setIcon();