reload process on lock

This commit is contained in:
Kyle Spearrin 2019-02-25 16:19:19 -05:00
parent 1be90ce6bd
commit 9792a7ade5
4 changed files with 15 additions and 6 deletions

2
jslib

@ -1 +1 @@
Subproject commit d0a0da8ee9ec4869001be96bc362e537ae15f961 Subproject commit 79c15a18414190ffce39a126ccc9078405287693

View File

@ -149,6 +149,10 @@ export default class MainBackground {
} }
await this.setIcon(); await this.setIcon();
await this.refreshBadgeAndMenu(true); await this.refreshBadgeAndMenu(true);
this.lockService.startLockReload();
}, () => {
window.location.reload(true);
return Promise.resolve();
}); });
this.syncService = new SyncService(this.userService, this.apiService, this.settingsService, this.syncService = new SyncService(this.userService, this.apiService, this.settingsService,
this.folderService, this.cipherService, this.cryptoService, this.collectionService, this.folderService, this.cipherService, this.cryptoService, this.collectionService,
@ -174,7 +178,7 @@ export default class MainBackground {
// Background // Background
this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.cipherService, this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.cipherService,
this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService, this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService,
this.analytics, this.notificationsService); this.analytics, this.notificationsService, this.lockService);
this.tabsBackground = new TabsBackground(this, this.platformUtilsService); this.tabsBackground = new TabsBackground(this, this.platformUtilsService);
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService, this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService,
this.platformUtilsService, this.analytics); this.platformUtilsService, this.analytics);
@ -284,6 +288,7 @@ export default class MainBackground {
await this.refreshBadgeAndMenu(); await this.refreshBadgeAndMenu();
await this.reseedStorage(); await this.reseedStorage();
this.notificationsService.updateConnection(false); this.notificationsService.updateConnection(false);
this.lockService.startLockReload();
} }
collectPageDetailsForContentScript(tab: any, sender: string, frameId: number = null) { collectPageDetailsForContentScript(tab: any, sender: string, frameId: number = null) {

View File

@ -12,6 +12,7 @@ import { Analytics } from 'jslib/misc';
import { import {
CipherService, CipherService,
LockService,
StorageService, StorageService,
} from 'jslib/abstractions'; } from 'jslib/abstractions';
@ -36,7 +37,8 @@ export default class RuntimeBackground {
constructor(private main: MainBackground, private autofillService: AutofillService, constructor(private main: MainBackground, private autofillService: AutofillService,
private cipherService: CipherService, private platformUtilsService: BrowserPlatformUtilsService, private cipherService: CipherService, private platformUtilsService: BrowserPlatformUtilsService,
private storageService: StorageService, private i18nService: I18nService, private storageService: StorageService, private i18nService: I18nService,
private analytics: Analytics, private notificationsService: NotificationsService) { private analytics: Analytics, private notificationsService: NotificationsService,
private lockService: LockService) {
this.isSafari = this.platformUtilsService.isSafari(); this.isSafari = this.platformUtilsService.isSafari();
this.runtime = this.isSafari ? safari.application : chrome.runtime; this.runtime = this.isSafari ? safari.application : chrome.runtime;
@ -81,10 +83,10 @@ export default class RuntimeBackground {
switch (msg.command) { switch (msg.command) {
case 'loggedIn': case 'loggedIn':
case 'unlocked': case 'unlocked':
case 'locked':
await this.main.setIcon(); await this.main.setIcon();
await this.main.refreshBadgeAndMenu(msg.command === 'locked'); await this.main.refreshBadgeAndMenu(false);
this.notificationsService.updateConnection(msg.command === 'unlocked'); this.notificationsService.updateConnection(msg.command === 'unlocked');
this.lockService.cancelLockReload();
break; break;
case 'logout': case 'logout':
await this.main.logout(msg.expired); await this.main.logout(msg.expired);

View File

@ -112,6 +112,8 @@ export class AppComponent implements OnInit {
action: msg.action, action: msg.action,
properties: { label: msg.label }, properties: { label: msg.label },
}); });
} else if (msg.command === 'reloadProcess') {
window.location.reload(true);
} else { } else {
msg.webExtSender = sender; msg.webExtSender = sender;
this.broadcasterService.send(msg); this.broadcasterService.send(msg);