1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-05 09:10:53 +01:00

Restore focus when displaying sync confirm

This commit is contained in:
Hinton 2020-11-30 14:58:52 +01:00
parent 7da03dc91c
commit ed0acdead2
4 changed files with 20 additions and 6 deletions

View File

@ -133,7 +133,8 @@ const environmentService = new EnvironmentService(apiService, storageService, no
const eventService = new EventService(storageService, apiService, userService, cipherService);
const systemService = new SystemService(storageService, vaultTimeoutService, messagingService, platformUtilsService,
null);
const nativeMessagingService = new NativeMessagingService(cryptoFunctionService, cryptoService, platformUtilsService, logService, i18nService, userService);
const nativeMessagingService = new NativeMessagingService(cryptoFunctionService, cryptoService, platformUtilsService,
logService, i18nService, userService, messagingService);
const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService);
containerService.attachToGlobal(window);

View File

@ -44,6 +44,9 @@ export class MessagingMain {
case 'hideToTray':
this.main.trayMain.hideToTray();
break;
case 'setFocus':
this.setFocus();
break;
case 'enableBrowserIntegration':
this.main.nativeMessagingMain.generateManifests();
this.main.nativeMessagingMain.listen();
@ -82,4 +85,9 @@ export class MessagingMain {
lockNowTrayMenuItem.enabled = isAuthenticated && !isLocked;
}
}
private setFocus() {
this.main.trayMain.restoreFromTray();
this.main.windowMain.win.focusOnWebView();
}
}

View File

@ -25,7 +25,7 @@ export class NativeMessagingMain {
if (msg != null) {
this.send(msg, socket);
}
})
});
});
ipc.server.on('connect', () => {

View File

@ -3,12 +3,14 @@ import Swal from 'sweetalert2';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { LogService } from 'jslib/abstractions/log.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { UserService } from 'jslib/abstractions/user.service';
import { Utils } from 'jslib/misc/utils';
import { SymmetricCryptoKey } from 'jslib/models/domain/symmetricCryptoKey';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { UserService } from 'jslib/abstractions/user.service';
const MessageValidTimeout = 10 * 1000;
const EncryptionAlgorithm = 'sha1';
@ -17,7 +19,8 @@ export class NativeMessagingService {
private sharedSecret: any;
constructor(private cryptoFunctionService: CryptoFunctionService, private cryptoService: CryptoService,
private platformUtilService: PlatformUtilsService, private logService: LogService, private i18nService: I18nService, private userService: UserService) {
private platformUtilService: PlatformUtilsService, private logService: LogService, private i18nService: I18nService,
private userService: UserService, private messagingService: MessagingService) {
ipcRenderer.on('nativeMessaging', async (event: any, message: any) => {
this.messageHandler(message);
});
@ -30,6 +33,8 @@ export class NativeMessagingService {
const remotePublicKey = Utils.fromB64ToArray(rawMessage.publicKey).buffer;
const fingerprint = (await this.cryptoService.getFingerprint(await this.userService.getUserId(), remotePublicKey)).join(' ');
this.messagingService.send('setFocus');
// Await confirmation that fingerprint is correct
const submitted = await Swal.fire({
title: this.i18nService.t('verifyBrowserTitle'),