1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01: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

@ -1 +1 @@
Subproject commit 38c26d9649f613e4f8987e4e4727a0e90a21233b
Subproject commit 852b4571b34d60845f37956e9468f845d9dd627e

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;
}
});
});
});
}