1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00

Handle main window hide

This commit is contained in:
Chad Scharf 2020-10-29 16:35:09 -04:00
parent be95ee9328
commit d8d1ee3022
8 changed files with 33 additions and 13 deletions

2
jslib

@ -1 +1 @@
Subproject commit d84d6da7f77ec89ba69299b1ff982f083fd77203 Subproject commit 4258077179afa09f57712d2c9d05a9dff0b2f583

View File

@ -17,6 +17,8 @@ import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component'; import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
@Component({ @Component({
selector: 'app-lock', selector: 'app-lock',
templateUrl: 'lock.component.html', templateUrl: 'lock.component.html',
@ -27,9 +29,10 @@ export class LockComponent extends BaseLockComponent {
userService: UserService, cryptoService: CryptoService, userService: UserService, cryptoService: CryptoService,
storageService: StorageService, vaultTimeoutService: VaultTimeoutService, storageService: StorageService, vaultTimeoutService: VaultTimeoutService,
environmentService: EnvironmentService, stateService: StateService, environmentService: EnvironmentService, stateService: StateService,
apiService: ApiService, private route: ActivatedRoute) { apiService: ApiService, broadcasterService: BroadcasterService,
private route: ActivatedRoute) {
super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService, super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService,
storageService, vaultTimeoutService, environmentService, stateService, apiService); storageService, vaultTimeoutService, environmentService, stateService, apiService, broadcasterService);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -22,6 +22,8 @@ import { SyncService } from 'jslib/abstractions/sync.service';
import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component'; import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component';
import { ModalComponent } from 'jslib/angular/components/modal.component'; import { ModalComponent } from 'jslib/angular/components/modal.component';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
@Component({ @Component({
selector: 'app-login', selector: 'app-login',
templateUrl: 'login.component.html', templateUrl: 'login.component.html',
@ -35,9 +37,10 @@ export class LoginComponent extends BaseLoginComponent {
syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver, syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver,
platformUtilsService: PlatformUtilsService, stateService: StateService, platformUtilsService: PlatformUtilsService, stateService: StateService,
environmentService: EnvironmentService, passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService, passwordGenerationService: PasswordGenerationService,
cryptoFunctionService: CryptoFunctionService, storageService: StorageService) { cryptoFunctionService: CryptoFunctionService, storageService: StorageService,
broadcasterService: BroadcasterService) {
super(authService, router, platformUtilsService, i18nService, stateService, environmentService, super(authService, router, platformUtilsService, i18nService, stateService, environmentService,
passwordGenerationService, cryptoFunctionService, storageService); passwordGenerationService, cryptoFunctionService, broadcasterService, storageService);
super.onSuccessfulLogin = () => { super.onSuccessfulLogin = () => {
return syncService.fullSync(true); return syncService.fullSync(true);
}; };

View File

@ -9,6 +9,8 @@ import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StateService } from 'jslib/abstractions/state.service'; import { StateService } from 'jslib/abstractions/state.service';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/components/register.component'; import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/components/register.component';
@Component({ @Component({
@ -19,8 +21,9 @@ export class RegisterComponent extends BaseRegisterComponent {
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
i18nService: I18nService, cryptoService: CryptoService, i18nService: I18nService, cryptoService: CryptoService,
apiService: ApiService, stateService: StateService, apiService: ApiService, stateService: StateService,
platformUtilsService: PlatformUtilsService, passwordGenerationService: PasswordGenerationService) { platformUtilsService: PlatformUtilsService, passwordGenerationService: PasswordGenerationService,
broadcasterService: BroadcasterService) {
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService, super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService,
passwordGenerationService); passwordGenerationService, broadcasterService);
} }
} }

View File

@ -15,6 +15,8 @@ import { PolicyService } from 'jslib/abstractions/policy.service';
import { SyncService } from 'jslib/abstractions/sync.service'; import { SyncService } from 'jslib/abstractions/sync.service';
import { UserService } from 'jslib/abstractions/user.service'; import { UserService } from 'jslib/abstractions/user.service';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
import { import {
SetPasswordComponent as BaseSetPasswordComponent, SetPasswordComponent as BaseSetPasswordComponent,
} from 'jslib/angular/components/set-password.component'; } from 'jslib/angular/components/set-password.component';
@ -28,9 +30,9 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
cryptoService: CryptoService, messagingService: MessagingService, cryptoService: CryptoService, messagingService: MessagingService,
userService: UserService, passwordGenerationService: PasswordGenerationService, userService: UserService, passwordGenerationService: PasswordGenerationService,
platformUtilsService: PlatformUtilsService, policyService: PolicyService, router: Router, platformUtilsService: PlatformUtilsService, policyService: PolicyService, router: Router,
syncService: SyncService, route: ActivatedRoute) { syncService: SyncService, route: ActivatedRoute, broadcasterService: BroadcasterService) {
super(i18nService, cryptoService, messagingService, userService, passwordGenerationService, super(i18nService, cryptoService, messagingService, userService, passwordGenerationService,
platformUtilsService, policyService, router, apiService, syncService, route); platformUtilsService, policyService, router, apiService, syncService, route, broadcasterService);
} }
get masterPasswordScoreWidth() { get masterPasswordScoreWidth() {

View File

@ -16,6 +16,8 @@ import { UserService } from 'jslib/abstractions/user.service';
import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component'; import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
@Component({ @Component({
selector: 'app-vault-add-edit', selector: 'app-vault-add-edit',
templateUrl: 'add-edit.component.html', templateUrl: 'add-edit.component.html',
@ -25,9 +27,10 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges
i18nService: I18nService, platformUtilsService: PlatformUtilsService, i18nService: I18nService, platformUtilsService: PlatformUtilsService,
auditService: AuditService, stateService: StateService, auditService: AuditService, stateService: StateService,
userService: UserService, collectionService: CollectionService, userService: UserService, collectionService: CollectionService,
messagingService: MessagingService, eventService: EventService) { messagingService: MessagingService, eventService: EventService,
broadcasterService: BroadcasterService) {
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService, super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
userService, collectionService, messagingService, eventService); userService, collectionService, messagingService, eventService, broadcasterService);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -8,6 +8,8 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { ExportComponent as BaseExportComponent } from 'jslib/angular/components/export.component'; import { ExportComponent as BaseExportComponent } from 'jslib/angular/components/export.component';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
@Component({ @Component({
selector: 'app-export', selector: 'app-export',
templateUrl: 'export.component.html', templateUrl: 'export.component.html',
@ -15,7 +17,8 @@ import { ExportComponent as BaseExportComponent } from 'jslib/angular/components
export class ExportComponent extends BaseExportComponent { export class ExportComponent extends BaseExportComponent {
constructor(cryptoService: CryptoService, i18nService: I18nService, constructor(cryptoService: CryptoService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, exportService: ExportService, platformUtilsService: PlatformUtilsService, exportService: ExportService,
eventService: EventService) { eventService: EventService, broadcasterService: BroadcasterService) {
super(cryptoService, i18nService, platformUtilsService, exportService, eventService, window); super(cryptoService, i18nService, platformUtilsService, exportService, eventService, window,
broadcasterService);
} }
} }

View File

@ -149,6 +149,9 @@ export class Main {
event.preventDefault(); event.preventDefault();
this.processDeepLink([url]); this.processDeepLink([url]);
}); });
// Handle visibility event(s)
this.windowMain.win.on('hide', () => this.messagingService.send('hideMain'));
}, (e: any) => { }, (e: any) => {
// tslint:disable-next-line // tslint:disable-next-line
console.error(e); console.error(e);