[PM-7353] Autofill item selection not working from within current tab view in vault (#8670)

* [PM-7353] Fix autofill not working from current tab component

* [PM-7353] Fix autofill not working from current tab component

* [PM-7353] Fix autofill not working from current tab component
This commit is contained in:
Cesar Gonzalez 2024-04-10 17:06:34 -05:00 committed by GitHub
parent 4607ae73c0
commit e4720de62a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 6 deletions

View File

@ -56,6 +56,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
private totpTimeout: number;
private loadedTimeout: number;
private searchTimeout: number;
private initPageDetailsTimeout: number;
protected unassignedItemsBannerEnabled$ = this.configService.getFeatureFlag$(
FeatureFlag.UnassignedItemsBanner,
@ -316,18 +317,13 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
});
if (this.loginCiphers.length) {
void BrowserApi.tabSendMessage(this.tab, {
command: "collectPageDetails",
tab: this.tab,
sender: BroadcasterSubscriptionId,
});
this.loginCiphers = this.loginCiphers.sort((a, b) =>
this.cipherService.sortCiphersByLastUsedThenName(a, b),
);
}
this.isLoading = this.loaded = true;
this.collectTabPageDetails();
}
async goToSettings() {
@ -365,4 +361,19 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
this.autofillCalloutText = this.i18nService.t("autofillSelectInfoWithoutCommand");
}
}
private collectTabPageDetails() {
void BrowserApi.tabSendMessage(this.tab, {
command: "collectPageDetails",
tab: this.tab,
sender: BroadcasterSubscriptionId,
});
window.clearTimeout(this.initPageDetailsTimeout);
this.initPageDetailsTimeout = window.setTimeout(() => {
if (this.pageDetails.length === 0) {
this.collectTabPageDetails();
}
}, 250);
}
}