mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
reload view on sync complete
This commit is contained in:
parent
7cae08a55b
commit
bba52192dc
@ -1,7 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
|
ChangeDetectorRef,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Input,
|
Input,
|
||||||
|
NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
@ -23,8 +26,11 @@ import { AttachmentView } from '../../models/view/attachmentView';
|
|||||||
import { CipherView } from '../../models/view/cipherView';
|
import { CipherView } from '../../models/view/cipherView';
|
||||||
import { FieldView } from '../../models/view/fieldView';
|
import { FieldView } from '../../models/view/fieldView';
|
||||||
import { LoginUriView } from '../../models/view/loginUriView';
|
import { LoginUriView } from '../../models/view/loginUriView';
|
||||||
|
import { BroadcasterService } from '../services/broadcaster.service';
|
||||||
|
|
||||||
export class ViewComponent implements OnDestroy {
|
const BroadcasterSubscriptionId = 'ViewComponent';
|
||||||
|
|
||||||
|
export class ViewComponent implements OnDestroy, OnInit {
|
||||||
@Input() cipherId: string;
|
@Input() cipherId: string;
|
||||||
@Output() onEditCipher = new EventEmitter<CipherView>();
|
@Output() onEditCipher = new EventEmitter<CipherView>();
|
||||||
|
|
||||||
@ -46,9 +52,27 @@ export class ViewComponent implements OnDestroy {
|
|||||||
protected tokenService: TokenService, protected toasterService: ToasterService,
|
protected tokenService: TokenService, protected toasterService: ToasterService,
|
||||||
protected cryptoService: CryptoService, protected platformUtilsService: PlatformUtilsService,
|
protected cryptoService: CryptoService, protected platformUtilsService: PlatformUtilsService,
|
||||||
protected i18nService: I18nService, protected analytics: Angulartics2,
|
protected i18nService: I18nService, protected analytics: Angulartics2,
|
||||||
protected auditService: AuditService, protected win: Window) { }
|
protected auditService: AuditService, protected win: Window,
|
||||||
|
protected broadcasterService: BroadcasterService, protected ngZone: NgZone,
|
||||||
|
protected changeDetectorRef: ChangeDetectorRef) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
|
||||||
|
this.ngZone.run(async () => {
|
||||||
|
switch (message.command) {
|
||||||
|
case 'syncCompleted':
|
||||||
|
if (message.successfully) {
|
||||||
|
await this.load();
|
||||||
|
this.changeDetectorRef.detectChanges();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user