window reload if there is a sidebar, resolves #900

This commit is contained in:
Kyle Spearrin 2019-04-04 11:50:49 -04:00
parent 109d800a36
commit 8cc268cd6c
4 changed files with 15 additions and 8 deletions

2
jslib

@ -1 +1 @@
Subproject commit 2ef1b7d65c02f7f204a0bb5a46c28aa093be274d
Subproject commit 0b0245b90fbb99fe677a94a2f97b8245cd255c1f

View File

@ -179,7 +179,9 @@ export default class MainBackground {
this.storageService, this.appIdService);
this.systemService = new SystemService(this.storageService, this.lockService,
this.messagingService, this.platformUtilsService, () => {
BrowserApi.reloadExtension(window, false);
const forceWindowReload = this.platformUtilsService.isSafari() ||
this.platformUtilsService.isFirefox() || this.platformUtilsService.isOpera();
BrowserApi.reloadExtension(forceWindowReload ? window : null);
return Promise.resolve();
});

View File

@ -288,10 +288,10 @@ export class BrowserApi {
}
}
static reloadExtension(win: Window, popupWindow: boolean) {
if (BrowserApi.isSafariApi) {
static reloadExtension(win: Window) {
if (win != null) {
return win.location.reload(true);
} else if (!popupWindow) {
} else if (!BrowserApi.isSafariApi) {
return chrome.runtime.reload();
}
}

View File

@ -31,6 +31,7 @@ import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
import { AuthService } from 'jslib/abstractions/auth.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StateService } from 'jslib/abstractions/state.service';
import { StorageService } from 'jslib/abstractions/storage.service';
@ -66,7 +67,7 @@ export class AppComponent implements OnInit {
private i18nService: I18nService, private router: Router,
private stateService: StateService, private messagingService: MessagingService,
private changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone,
private sanitizer: DomSanitizer) { }
private sanitizer: DomSanitizer, private platformUtilsService: PlatformUtilsService) { }
ngOnInit() {
if (BrowserApi.getBackgroundPage() == null) {
@ -116,8 +117,12 @@ export class AppComponent implements OnInit {
properties: { label: msg.label },
});
} else if (msg.command === 'reloadProcess') {
// Wait to make sure background has reloaded first.
window.setTimeout(() => BrowserApi.reloadExtension(window, true), 2000);
const windowReload = this.platformUtilsService.isSafari() ||
this.platformUtilsService.isFirefox() || this.platformUtilsService.isOpera();
if (windowReload) {
// Wait to make sure background has reloaded first.
window.setTimeout(() => BrowserApi.reloadExtension(window), 2000);
}
} else {
msg.webExtSender = sender;
this.broadcasterService.send(msg);