mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
reload when on same page too
This commit is contained in:
parent
206530a940
commit
a3f76cfd3a
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit 640c44820a2e26b6e34591b59bc168a6eb455e83
|
Subproject commit 1f98a2ebcb1f08dca39047fe77d8dea4bb1a67dc
|
@ -129,7 +129,7 @@ export class AppComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
} else if (msg.command === 'reloadPopup') {
|
} else if (msg.command === 'reloadPopup') {
|
||||||
this.ngZone.run(() => {
|
this.ngZone.run(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/', { queryParams: { reload: true } }]);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
msg.webExtSender = sender;
|
msg.webExtSender = sender;
|
||||||
|
@ -5,7 +5,11 @@ import {
|
|||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
|
||||||
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
|
|
||||||
import { ToasterService } from 'angular2-toaster';
|
import { ToasterService } from 'angular2-toaster';
|
||||||
import { Angulartics2 } from 'angulartics2';
|
import { Angulartics2 } from 'angulartics2';
|
||||||
@ -15,6 +19,7 @@ import { BrowserApi } from '../../browser/browserApi';
|
|||||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||||
|
|
||||||
import { CipherType } from 'jslib/enums/cipherType';
|
import { CipherType } from 'jslib/enums/cipherType';
|
||||||
|
import { DeviceType } from 'jslib/enums/deviceType';
|
||||||
|
|
||||||
import { CipherView } from 'jslib/models/view/cipherView';
|
import { CipherView } from 'jslib/models/view/cipherView';
|
||||||
|
|
||||||
@ -63,52 +68,20 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
|||||||
private i18nService: I18nService, private router: Router,
|
private i18nService: I18nService, private router: Router,
|
||||||
private ngZone: NgZone, private broadcasterService: BroadcasterService,
|
private ngZone: NgZone, private broadcasterService: BroadcasterService,
|
||||||
private changeDetectorRef: ChangeDetectorRef, private syncService: SyncService,
|
private changeDetectorRef: ChangeDetectorRef, private syncService: SyncService,
|
||||||
private searchService: SearchService, private storageService: StorageService) { }
|
private searchService: SearchService, private storageService: StorageService,
|
||||||
|
route: ActivatedRoute) {
|
||||||
|
route.params.subscribe((val) => {
|
||||||
|
console.log('route.params.subscribe');
|
||||||
|
if (platformUtilsService.getDevice() === DeviceType.SafariExtension) {
|
||||||
|
console.log(val);
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.showLeftHeader = this.searchTypeSearch = !this.platformUtilsService.isSafari();
|
console.log('ngOnInit');
|
||||||
this.inSidebar = this.popupUtilsService.inSidebar(window);
|
this.init();
|
||||||
|
|
||||||
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
|
|
||||||
this.ngZone.run(async () => {
|
|
||||||
switch (message.command) {
|
|
||||||
case 'syncCompleted':
|
|
||||||
if (this.loaded) {
|
|
||||||
window.setTimeout(() => {
|
|
||||||
this.load();
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'collectPageDetailsResponse':
|
|
||||||
if (message.sender === BroadcasterSubscriptionId) {
|
|
||||||
this.pageDetails.push({
|
|
||||||
frameId: message.webExtSender.frameId,
|
|
||||||
tab: message.tab,
|
|
||||||
details: message.details,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.changeDetectorRef.detectChanges();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!this.syncService.syncInProgress) {
|
|
||||||
await this.load();
|
|
||||||
} else {
|
|
||||||
this.loadedTimeout = window.setTimeout(async () => {
|
|
||||||
if (!this.loaded) {
|
|
||||||
await this.load();
|
|
||||||
}
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
window.setTimeout(() => {
|
|
||||||
document.getElementById('search').focus();
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
@ -184,6 +157,52 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
|
|||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private init() {
|
||||||
|
this.showLeftHeader = this.searchTypeSearch = !this.platformUtilsService.isSafari();
|
||||||
|
this.inSidebar = this.popupUtilsService.inSidebar(window);
|
||||||
|
|
||||||
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
|
||||||
|
this.ngZone.run(async () => {
|
||||||
|
switch (message.command) {
|
||||||
|
case 'syncCompleted':
|
||||||
|
if (this.loaded) {
|
||||||
|
window.setTimeout(() => {
|
||||||
|
this.load();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'collectPageDetailsResponse':
|
||||||
|
if (message.sender === BroadcasterSubscriptionId) {
|
||||||
|
this.pageDetails.push({
|
||||||
|
frameId: message.webExtSender.frameId,
|
||||||
|
tab: message.tab,
|
||||||
|
details: message.details,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.changeDetectorRef.detectChanges();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!this.syncService.syncInProgress) {
|
||||||
|
await this.load();
|
||||||
|
} else {
|
||||||
|
this.loadedTimeout = window.setTimeout(async () => {
|
||||||
|
if (!this.loaded) {
|
||||||
|
await this.load();
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.setTimeout(() => {
|
||||||
|
document.getElementById('search').focus();
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
private async load() {
|
private async load() {
|
||||||
const tab = await BrowserApi.getTabFromCurrentWindow();
|
const tab = await BrowserApi.getTabFromCurrentWindow();
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user