mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +01:00
[PM-13715] Launching a website from the extension does not trigger an update to reference the correct autofill value (#11587)
* [PM-13715] Launching page from cipher does not set correct autofill action * [PM-13715] Fix autofill not triggering for correct cipher after page has been launched from browser extension
This commit is contained in:
parent
d5643f42b3
commit
9b471e6633
@ -472,7 +472,7 @@
|
||||
attr.aria-label="{{ 'launch' | i18n }} {{ u.uri }}"
|
||||
appA11yTitle="{{ 'launch' | i18n }}"
|
||||
*ngIf="u.canLaunch"
|
||||
(click)="launch(u)"
|
||||
(click)="launch(u, cipher.id)"
|
||||
>
|
||||
<i class="bwi bwi-lg bwi-share-square" aria-hidden="true"></i>
|
||||
</button>
|
||||
|
@ -348,15 +348,13 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
launch(uri: Launchable, cipherId?: string) {
|
||||
async launch(uri: Launchable, cipherId?: string) {
|
||||
if (!uri.canLaunch) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cipherId) {
|
||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.cipherService.updateLastLaunchedDate(cipherId);
|
||||
await this.cipherService.updateLastLaunchedDate(cipherId);
|
||||
}
|
||||
|
||||
this.platformUtilsService.launchUri(uri.launchUri);
|
||||
|
@ -650,14 +650,11 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
ciphersLocalData = {};
|
||||
}
|
||||
|
||||
const cipherId = id as CipherId;
|
||||
if (ciphersLocalData[cipherId]) {
|
||||
ciphersLocalData[cipherId].lastLaunched = new Date().getTime();
|
||||
} else {
|
||||
ciphersLocalData[cipherId] = {
|
||||
lastUsedDate: new Date().getTime(),
|
||||
};
|
||||
}
|
||||
const currentTime = new Date().getTime();
|
||||
ciphersLocalData[id as CipherId] = {
|
||||
lastLaunched: currentTime,
|
||||
lastUsedDate: currentTime,
|
||||
};
|
||||
|
||||
await this.localDataState.update(() => ciphersLocalData);
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { Component, Input } from "@angular/core";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view";
|
||||
import {
|
||||
CardComponent,
|
||||
@ -30,10 +31,15 @@ import {
|
||||
})
|
||||
export class AutofillOptionsViewComponent {
|
||||
@Input() loginUris: LoginUriView[];
|
||||
@Input() cipherId: string;
|
||||
|
||||
constructor(private platformUtilsService: PlatformUtilsService) {}
|
||||
constructor(
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private cipherService: CipherService,
|
||||
) {}
|
||||
|
||||
openWebsite(selectedUri: string) {
|
||||
async openWebsite(selectedUri: string) {
|
||||
await this.cipherService.updateLastLaunchedDate(this.cipherId);
|
||||
this.platformUtilsService.launchUri(selectedUri);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,11 @@
|
||||
<app-login-credentials-view *ngIf="hasLogin" [cipher]="cipher"></app-login-credentials-view>
|
||||
|
||||
<!-- AUTOFILL OPTIONS -->
|
||||
<app-autofill-options-view *ngIf="hasAutofill" [loginUris]="cipher.login.uris">
|
||||
<app-autofill-options-view
|
||||
*ngIf="hasAutofill"
|
||||
[loginUris]="cipher.login.uris"
|
||||
[cipherId]="cipher.id"
|
||||
>
|
||||
</app-autofill-options-view>
|
||||
|
||||
<!-- CARD DETAILS -->
|
||||
|
Loading…
Reference in New Issue
Block a user