1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

Hide hidden fields on hide/minimize

This commit is contained in:
Chad Scharf
2020-11-04 12:09:21 -05:00
parent 4a18a4eb93
commit c001a00f82
9 changed files with 204 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
import {
Component,
ComponentFactoryResolver,
NgZone,
ViewChild,
ViewContainerRef,
} from '@angular/core';
@@ -19,9 +20,13 @@ import { StateService } from 'jslib/abstractions/state.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component';
import { ModalComponent } from 'jslib/angular/components/modal.component';
const BroadcasterSubscriptionId = 'LoginComponent';
@Component({
selector: 'app-login',
templateUrl: 'login.component.html',
@@ -35,7 +40,8 @@ export class LoginComponent extends BaseLoginComponent {
syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver,
platformUtilsService: PlatformUtilsService, stateService: StateService,
environmentService: EnvironmentService, passwordGenerationService: PasswordGenerationService,
cryptoFunctionService: CryptoFunctionService, storageService: StorageService) {
cryptoFunctionService: CryptoFunctionService, storageService: StorageService,
private broadcasterService: BroadcasterService, private ngZone: NgZone) {
super(authService, router, platformUtilsService, i18nService, stateService, environmentService,
passwordGenerationService, cryptoFunctionService, storageService);
super.onSuccessfulLogin = () => {
@@ -43,6 +49,21 @@ export class LoginComponent extends BaseLoginComponent {
};
}
async ngOnInit() {
await super.ngOnInit();
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
this.ngZone.run(() => {
switch (message.command) {
case 'windowHidden':
this.onWindowHidden();
break;
default:
}
});
});
}
settings() {
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
const modal = this.environmentModal.createComponent(factory).instance;
@@ -61,4 +82,8 @@ export class LoginComponent extends BaseLoginComponent {
modal.close();
});
}
onWindowHidden() {
this.showPassword = false;
}
}