mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
Hide hidden fields on hide/minimize
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
OnChanges,
|
||||
NgZone,
|
||||
} from '@angular/core';
|
||||
|
||||
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||
@@ -14,8 +15,12 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { StateService } from 'jslib/abstractions/state.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
|
||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
|
||||
import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component';
|
||||
|
||||
const BroadcasterSubscriptionId = 'AddEditComponent';
|
||||
|
||||
@Component({
|
||||
selector: 'app-vault-add-edit',
|
||||
templateUrl: 'add-edit.component.html',
|
||||
@@ -25,13 +30,25 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges
|
||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||
auditService: AuditService, stateService: StateService,
|
||||
userService: UserService, collectionService: CollectionService,
|
||||
messagingService: MessagingService, eventService: EventService) {
|
||||
messagingService: MessagingService, eventService: EventService,
|
||||
private broadcasterService: BroadcasterService, private ngZone: NgZone) {
|
||||
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
||||
userService, collectionService, messagingService, eventService);
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
// We use ngOnChanges instead.
|
||||
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
||||
this.ngZone.run(() => {
|
||||
switch (message.command) {
|
||||
case 'windowHidden':
|
||||
this.onWindowHidden();
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
});
|
||||
});
|
||||
// We use ngOnChanges for everything else instead.
|
||||
}
|
||||
|
||||
async ngOnChanges() {
|
||||
@@ -46,4 +63,14 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges
|
||||
}
|
||||
super.load();
|
||||
}
|
||||
|
||||
onWindowHidden() {
|
||||
this.showPassword = false;
|
||||
this.showCardCode = false;
|
||||
if (this.cipher !== null && this.cipher.hasFields) {
|
||||
this.cipher.fields.forEach(field => {
|
||||
field.showValue = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user