mirror of
https://github.com/bitwarden/browser
synced 2025-12-26 21:23:34 +00:00
settings and lock options
This commit is contained in:
14
src/services/desktopMainMessaging.service.ts
Normal file
14
src/services/desktopMainMessaging.service.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { MessagingService } from 'jslib/abstractions';
|
||||
|
||||
import { MessagingMain } from '../main/messaging.main';
|
||||
import { WindowMain } from '../main/window.main';
|
||||
|
||||
export class DesktopMainMessagingService implements MessagingService {
|
||||
constructor(private windowMain: WindowMain, private messagingMain: MessagingMain) { }
|
||||
|
||||
send(subscriber: string, arg: any = {}) {
|
||||
const message = Object.assign({}, { command: subscriber }, arg);
|
||||
this.windowMain.win.webContents.send('messagingService', message);
|
||||
this.messagingMain.onMessage(message);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { MessagingService } from 'jslib/abstractions';
|
||||
|
||||
import { BroadcasterService } from '../app/services/broadcaster.service';
|
||||
|
||||
export class DesktopMessagingService implements MessagingService {
|
||||
export class DesktopRendererMessagingService implements MessagingService {
|
||||
constructor(private broadcasterService: BroadcasterService) {
|
||||
ipcRenderer.on('messagingService', async (event: any, message: any) => {
|
||||
if (message.command) {
|
||||
@@ -7,7 +7,7 @@ export class DesktopSecureStorageService implements StorageService {
|
||||
action: 'getPassword',
|
||||
key: key,
|
||||
});
|
||||
return Promise.resolve(val ? JSON.parse(val) as T : null);
|
||||
return Promise.resolve(val != null ? JSON.parse(val) as T : null);
|
||||
}
|
||||
|
||||
async save(key: string, obj: any): Promise<any> {
|
||||
|
||||
@@ -7,7 +7,7 @@ const store = new Store();
|
||||
export class DesktopStorageService implements StorageService {
|
||||
get<T>(key: string): Promise<T> {
|
||||
const val = store.get(key) as T;
|
||||
return Promise.resolve(val ? val : null);
|
||||
return Promise.resolve(val != null ? val : null);
|
||||
}
|
||||
|
||||
save(key: string, obj: any): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user