diff --git a/jslib b/jslib index 640c44820a..1f98a2ebcb 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 640c44820a2e26b6e34591b59bc168a6eb455e83 +Subproject commit 1f98a2ebcb1f08dca39047fe77d8dea4bb1a67dc diff --git a/src/popup/app.component.ts b/src/popup/app.component.ts index 2efe175723..d2578f181a 100644 --- a/src/popup/app.component.ts +++ b/src/popup/app.component.ts @@ -129,7 +129,7 @@ export class AppComponent implements OnInit { } } else if (msg.command === 'reloadPopup') { this.ngZone.run(() => { - this.router.navigate(['/']); + this.router.navigate(['/', { queryParams: { reload: true } }]); }); } else { msg.webExtSender = sender; diff --git a/src/popup/vault/current-tab.component.ts b/src/popup/vault/current-tab.component.ts index 1d7f19817e..c31284777e 100644 --- a/src/popup/vault/current-tab.component.ts +++ b/src/popup/vault/current-tab.component.ts @@ -5,7 +5,11 @@ import { OnDestroy, OnInit, } from '@angular/core'; -import { Router } from '@angular/router'; + +import { + ActivatedRoute, + Router, +} from '@angular/router'; import { ToasterService } from 'angular2-toaster'; import { Angulartics2 } from 'angulartics2'; @@ -15,6 +19,7 @@ import { BrowserApi } from '../../browser/browserApi'; import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; import { CipherType } from 'jslib/enums/cipherType'; +import { DeviceType } from 'jslib/enums/deviceType'; import { CipherView } from 'jslib/models/view/cipherView'; @@ -63,52 +68,20 @@ export class CurrentTabComponent implements OnInit, OnDestroy { private i18nService: I18nService, private router: Router, private ngZone: NgZone, private broadcasterService: BroadcasterService, 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() { - 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); + console.log('ngOnInit'); + this.init(); } ngOnDestroy() { @@ -184,6 +157,52 @@ export class CurrentTabComponent implements OnInit, OnDestroy { }, 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() { const tab = await BrowserApi.getTabFromCurrentWindow(); if (tab != null) {