1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +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

@@ -17,6 +17,7 @@ import FolderService from './folder.service';
import SettingsService from './settings.service';
import UserService from './user.service';
import { MessagingService } from './abstractions/messaging.service';
import { StorageService } from './abstractions/storage.service';
const Keys = {
@@ -30,7 +31,7 @@ export default class SyncService {
private settingsService: SettingsService, private folderService: FolderService,
private cipherService: CipherService, private cryptoService: CryptoService,
private collectionService: CollectionService, private storageService: StorageService,
private logoutCallback: Function) {
private messagingService: MessagingService, private logoutCallback: Function) {
}
async getLastSync() {
@@ -50,13 +51,12 @@ export default class SyncService {
syncStarted() {
this.syncInProgress = true;
chrome.runtime.sendMessage({ command: 'syncStarted' });
this.messagingService.send('syncStarted');
}
syncCompleted(successfully: boolean) {
this.syncInProgress = false;
// tslint:disable-next-line
chrome.runtime.sendMessage({ command: 'syncCompleted', successfully: successfully });
this.messagingService.send('syncCompleted', { successfully: successfully });
}
async fullSync(forceSync: boolean) {