main messaging service to jslib

This commit is contained in:
Kyle Spearrin 2018-04-26 15:44:07 -04:00
parent 0244a2432c
commit 1f706802f6
4 changed files with 8 additions and 20 deletions

2
jslib

@ -1 +1 @@
Subproject commit 983a7b474c344475edc3290d0ce1894a92794752
Subproject commit 35039fdae2038f6bdfbdef6616b2bfae0053d47b

View File

@ -796,7 +796,7 @@
"message": "Restart To Update"
},
"restartToUpdateDesc": {
"message": "Version $VERSION_NUM$ is ready to install. You must restart Bitwarden to complete the installation. Do you want to restart and update now?",
"message": "Version $VERSION_NUM$ is ready to install. You must restart the application to complete the installation. Do you want to restart and update now?",
"placeholders": {
"version_num": {
"content": "$1",

View File

@ -1,7 +1,6 @@
import { app, BrowserWindow } from 'electron';
import * as path from 'path';
import { DesktopMainMessagingService } from './services/desktopMainMessaging.service';
import { I18nService } from './services/i18n.service';
import { MenuMain } from './main/menu.main';
@ -13,6 +12,7 @@ import { ConstantsService } from 'jslib/services/constants.service';
import { KeytarStorageListener } from 'jslib/electron/keytarStorageListener';
import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
import { ElectronMainMessagingService } from 'jslib/electron/services/electronMainMessaging.service';
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
import { WindowMain } from 'jslib/electron/window.main';
@ -20,7 +20,7 @@ export class Main {
logService: ElectronLogService;
i18nService: I18nService;
storageService: ElectronStorageService;
messagingService: DesktopMainMessagingService;
messagingService: ElectronMainMessagingService;
keytarStorageListener: KeytarStorageListener;
windowMain: WindowMain;
@ -56,7 +56,6 @@ export class Main {
this.logService = new ElectronLogService(null, app.getPath('userData'));
this.i18nService = new I18nService('en', './locales/');
this.storageService = new ElectronStorageService();
this.messagingService = new DesktopMainMessagingService(this);
this.windowMain = new WindowMain(this.storageService);
this.messagingMain = new MessagingMain(this);
@ -64,6 +63,10 @@ export class Main {
this.menuMain = new MenuMain(this);
this.powerMonitorMain = new PowerMonitorMain(this);
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
this.messagingMain.onMessage(message);
});
this.keytarStorageListener = new KeytarStorageListener('Bitwarden');
}

View File

@ -1,15 +0,0 @@
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { Main } from '../main';
export class DesktopMainMessagingService implements MessagingService {
constructor(private main: Main) { }
send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
this.main.messagingMain.onMessage(message);
if (this.main.windowMain.win != null) {
this.main.windowMain.win.webContents.send('messagingService', message);
}
}
}