1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

abstract MessagingService

This commit is contained in:
Kyle Spearrin
2018-01-04 16:06:00 -05:00
parent 0fbbc4a0b9
commit d39c5b37dc
10 changed files with 51 additions and 23 deletions

View File

@@ -3,6 +3,7 @@ import * as template from './lock.component.html';
import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service';
import { CryptoService } from '../../../services/abstractions/crypto.service';
import { MessagingService } from '../../../services/abstractions/messaging.service';
export class LockController {
i18n: any;
@@ -10,7 +11,7 @@ export class LockController {
constructor(public $state: any, public i18nService: any, private $timeout: any,
private browserUtilsService: BrowserUtilsService, public cryptoService: CryptoService, public toastr: any,
public userService: any, public SweetAlert: any) {
public userService: any, public messagingService: MessagingService, public SweetAlert: any) {
this.i18n = i18nService;
}
@@ -30,7 +31,7 @@ export class LockController {
cancelButtonText: this.i18nService.cancel,
}, (confirmed: boolean) => {
if (confirmed) {
chrome.runtime.sendMessage({ command: 'logout' });
this.messagingService.send('logout');
}
});
}
@@ -48,7 +49,7 @@ export class LockController {
if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) {
await this.cryptoService.setKey(key);
chrome.runtime.sendMessage({ command: 'unlocked' });
this.messagingService.send('unlocked');
this.$state.go('tabs.current');
} else {
this.toastr.error(this.i18nService.invalidMasterPassword, this.i18nService.errorsOccurred);