1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

check key and premium after sync

This commit is contained in:
Kyle Spearrin
2018-08-31 17:23:36 -04:00
parent aa3d69cb94
commit e5226d7ffc
2 changed files with 23 additions and 23 deletions

2
jslib

Submodule jslib updated: 38c26d9649...852b4571b3

View File

@@ -88,37 +88,20 @@ export class VaultComponent implements OnInit, OnDestroy {
async ngOnInit() {
this.showVerifyEmail = !(await this.tokenService.getEmailVerified());
this.showBrowserOutdated = window.navigator.userAgent.indexOf('MSIE') !== -1;
const hasEncKey = await this.cryptoService.hasEncKey();
this.showUpdateKey = !hasEncKey;
const canAccessPremium = await this.userService.canAccessPremium();
this.route.queryParams.subscribe(async (params) => {
await this.syncService.fullSync(false);
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
this.ngZone.run(async () => {
switch (message.command) {
case 'syncCompleted':
if (message.successfully) {
await Promise.all([
this.groupingsComponent.load(),
this.organizationsComponent.load(),
this.ciphersComponent.load(this.ciphersComponent.filter),
]);
this.changeDetectorRef.detectChanges();
}
break;
}
});
});
this.showUpdateKey = !(await this.cryptoService.hasEncKey());
const canAccessPremium = await this.userService.canAccessPremium();
this.showPremiumCallout = !this.showVerifyEmail && !canAccessPremium &&
!this.platformUtilsService.isSelfHost();
await Promise.all([
this.groupingsComponent.load(),
this.organizationsComponent.load(),
]);
this.showPremiumCallout = !this.showVerifyEmail && !canAccessPremium &&
!this.platformUtilsService.isSelfHost();
if (params == null) {
this.groupingsComponent.selectedAll = true;
await this.ciphersComponent.load();
@@ -143,6 +126,23 @@ export class VaultComponent implements OnInit, OnDestroy {
this.groupingsComponent.selectedAll = true;
await this.ciphersComponent.load();
}
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
this.ngZone.run(async () => {
switch (message.command) {
case 'syncCompleted':
if (message.successfully) {
await Promise.all([
this.groupingsComponent.load(),
this.organizationsComponent.load(),
this.ciphersComponent.load(this.ciphersComponent.filter),
]);
this.changeDetectorRef.detectChanges();
}
break;
}
});
});
});
}