mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-20 10:13:23 +00:00
main messaging service to jslib
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 983a7b474c...35039fdae2
10
src/main.ts
10
src/main.ts
@@ -1,14 +1,13 @@
|
|||||||
import { app, BrowserWindow } from 'electron';
|
import { app, BrowserWindow } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
// import { ElectronMainMessagingService } from 'jslib/electron/services/desktopMainMessaging.service';
|
|
||||||
|
|
||||||
import { MenuMain } from './main/menu.main';
|
import { MenuMain } from './main/menu.main';
|
||||||
import { MessagingMain } from './main/messaging.main';
|
import { MessagingMain } from './main/messaging.main';
|
||||||
import { I18nService } from './services/i18n.service';
|
import { I18nService } from './services/i18n.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';
|
||||||
|
|
||||||
@@ -16,6 +15,7 @@ export class Main {
|
|||||||
logService: ElectronLogService;
|
logService: ElectronLogService;
|
||||||
i18nService: I18nService;
|
i18nService: I18nService;
|
||||||
storageService: ElectronStorageService;
|
storageService: ElectronStorageService;
|
||||||
|
messagingService: ElectronMainMessagingService;
|
||||||
keytarStorageListener: KeytarStorageListener;
|
keytarStorageListener: KeytarStorageListener;
|
||||||
|
|
||||||
windowMain: WindowMain;
|
windowMain: WindowMain;
|
||||||
@@ -49,11 +49,13 @@ 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.menuMain = new MenuMain(this);
|
|
||||||
this.messagingMain = new MessagingMain(this.windowMain);
|
this.messagingMain = new MessagingMain(this.windowMain);
|
||||||
|
this.menuMain = new MenuMain(this);
|
||||||
|
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
|
||||||
|
this.messagingMain.onMessage(message);
|
||||||
|
});
|
||||||
|
|
||||||
this.keytarStorageListener = new KeytarStorageListener('Bitwarden Directory Connector');
|
this.keytarStorageListener = new KeytarStorageListener('Bitwarden Directory Connector');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class MenuMain extends BaseMenu {
|
|||||||
|
|
||||||
constructor(private main: Main) {
|
constructor(private main: Main) {
|
||||||
super(main.i18nService, main.windowMain, main.i18nService.t('bitwardenDirectoryConnector'),
|
super(main.i18nService, main.windowMain, main.i18nService.t('bitwardenDirectoryConnector'),
|
||||||
() => { /* TODO: Log Out Message */ });
|
() => this.main.messagingService.send('logout'));
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@@ -39,14 +39,10 @@ export class MenuMain extends BaseMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private initApplicationMenu() {
|
private initApplicationMenu() {
|
||||||
const accountSubmenu: MenuItemConstructorOptions[] = [
|
|
||||||
this.logOutMenuItemOptions,
|
|
||||||
];
|
|
||||||
|
|
||||||
const template: MenuItemConstructorOptions[] = [
|
const template: MenuItemConstructorOptions[] = [
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('file'),
|
label: this.i18nService.t('file'),
|
||||||
submenu: [ this.logOutMenuItemOptions ],
|
submenu: [this.logOutMenuItemOptions],
|
||||||
},
|
},
|
||||||
this.editMenuItemOptions,
|
this.editMenuItemOptions,
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user