Add explicit init to native messaging service (#1262)

This commit is contained in:
Oscar Hinton 2022-01-24 16:10:32 +01:00 committed by GitHub
parent ca41cdf8b5
commit 7d46e5c145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -60,9 +60,11 @@ export function initFactory(
notificationsService: NotificationsServiceAbstraction, notificationsService: NotificationsServiceAbstraction,
platformUtilsService: PlatformUtilsServiceAbstraction, platformUtilsService: PlatformUtilsServiceAbstraction,
stateService: StateServiceAbstraction, stateService: StateServiceAbstraction,
cryptoService: CryptoServiceAbstraction cryptoService: CryptoServiceAbstraction,
nativeMessagingService: NativeMessagingService
): Function { ): Function {
return async () => { return async () => {
nativeMessagingService.init();
await stateService.init(); await stateService.init();
await environmentService.setUrlsFromStorage(); await environmentService.setUrlsFromStorage();
syncService.fullSync(true); syncService.fullSync(true);
@ -122,6 +124,7 @@ export function initFactory(
PlatformUtilsServiceAbstraction, PlatformUtilsServiceAbstraction,
StateServiceAbstraction, StateServiceAbstraction,
CryptoServiceAbstraction, CryptoServiceAbstraction,
NativeMessagingService,
], ],
multi: true, multi: true,
}, },

View File

@ -33,7 +33,9 @@ export class NativeMessagingService {
private messagingService: MessagingService, private messagingService: MessagingService,
private vaultTimeoutService: VaultTimeoutService, private vaultTimeoutService: VaultTimeoutService,
private stateService: StateService private stateService: StateService
) { ) {}
init() {
ipcRenderer.on("nativeMessaging", async (_event: any, message: any) => { ipcRenderer.on("nativeMessaging", async (_event: any, message: any) => {
this.messageHandler(message); this.messageHandler(message);
}); });