main messaging service to jslib
This commit is contained in:
parent
0244a2432c
commit
1f706802f6
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 983a7b474c344475edc3290d0ce1894a92794752
|
Subproject commit 35039fdae2038f6bdfbdef6616b2bfae0053d47b
|
|
@ -796,7 +796,7 @@
|
||||||
"message": "Restart To Update"
|
"message": "Restart To Update"
|
||||||
},
|
},
|
||||||
"restartToUpdateDesc": {
|
"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": {
|
"placeholders": {
|
||||||
"version_num": {
|
"version_num": {
|
||||||
"content": "$1",
|
"content": "$1",
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { app, BrowserWindow } from 'electron';
|
import { app, BrowserWindow } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { DesktopMainMessagingService } from './services/desktopMainMessaging.service';
|
|
||||||
import { I18nService } from './services/i18n.service';
|
import { I18nService } from './services/i18n.service';
|
||||||
|
|
||||||
import { MenuMain } from './main/menu.main';
|
import { MenuMain } from './main/menu.main';
|
||||||
|
@ -13,6 +12,7 @@ import { ConstantsService } from 'jslib/services/constants.service';
|
||||||
|
|
||||||
import { KeytarStorageListener } from 'jslib/electron/keytarStorageListener';
|
import { KeytarStorageListener } from 'jslib/electron/keytarStorageListener';
|
||||||
import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
|
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 { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
|
||||||
import { WindowMain } from 'jslib/electron/window.main';
|
import { WindowMain } from 'jslib/electron/window.main';
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export class Main {
|
||||||
logService: ElectronLogService;
|
logService: ElectronLogService;
|
||||||
i18nService: I18nService;
|
i18nService: I18nService;
|
||||||
storageService: ElectronStorageService;
|
storageService: ElectronStorageService;
|
||||||
messagingService: DesktopMainMessagingService;
|
messagingService: ElectronMainMessagingService;
|
||||||
keytarStorageListener: KeytarStorageListener;
|
keytarStorageListener: KeytarStorageListener;
|
||||||
|
|
||||||
windowMain: WindowMain;
|
windowMain: WindowMain;
|
||||||
|
@ -56,7 +56,6 @@ export class Main {
|
||||||
this.logService = new ElectronLogService(null, app.getPath('userData'));
|
this.logService = new ElectronLogService(null, app.getPath('userData'));
|
||||||
this.i18nService = new I18nService('en', './locales/');
|
this.i18nService = new I18nService('en', './locales/');
|
||||||
this.storageService = new ElectronStorageService();
|
this.storageService = new ElectronStorageService();
|
||||||
this.messagingService = new DesktopMainMessagingService(this);
|
|
||||||
|
|
||||||
this.windowMain = new WindowMain(this.storageService);
|
this.windowMain = new WindowMain(this.storageService);
|
||||||
this.messagingMain = new MessagingMain(this);
|
this.messagingMain = new MessagingMain(this);
|
||||||
|
@ -64,6 +63,10 @@ export class Main {
|
||||||
this.menuMain = new MenuMain(this);
|
this.menuMain = new MenuMain(this);
|
||||||
this.powerMonitorMain = new PowerMonitorMain(this);
|
this.powerMonitorMain = new PowerMonitorMain(this);
|
||||||
|
|
||||||
|
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
|
||||||
|
this.messagingMain.onMessage(message);
|
||||||
|
});
|
||||||
|
|
||||||
this.keytarStorageListener = new KeytarStorageListener('Bitwarden');
|
this.keytarStorageListener = new KeytarStorageListener('Bitwarden');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue