Browse Source

update lastUsedDate in background script

PM-15943
jaasen-livefront 11 months ago
parent
commit
bce53fc540
No known key found for this signature in database
  1. 7
      apps/browser/src/autofill/services/autofill.service.ts
  2. 1
      apps/browser/src/background/main.background.ts
  3. 5
      apps/browser/src/background/runtime.background.ts

7
apps/browser/src/autofill/services/autofill.service.ts

@ -463,8 +463,13 @@ export default class AutofillService implements AutofillServiceInterface {
fillScript.properties.delay_between_operations = 20; fillScript.properties.delay_between_operations = 20;
didAutofill = true; didAutofill = true;
if (!options.skipLastUsed) { if (!options.skipLastUsed) {
await this.cipherService.updateLastUsedDate(options.cipher.id); // In order to prevent a UI update send message to background script to update last used date
await chrome.runtime.sendMessage({
command: "updateLastUsedDate",
cipherId: options.cipher.id,
});
} }
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.

1
apps/browser/src/background/main.background.ts

@ -1118,6 +1118,7 @@ export default class MainBackground {
this.accountService, this.accountService,
lockService, lockService,
this.billingAccountProfileStateService, this.billingAccountProfileStateService,
this.cipherService,
); );
this.nativeMessagingBackground = new NativeMessagingBackground( this.nativeMessagingBackground = new NativeMessagingBackground(
this.keyService, this.keyService,

5
apps/browser/src/background/runtime.background.ts

@ -16,6 +16,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag
import { MessageListener, isExternalMessage } from "@bitwarden/common/platform/messaging"; import { MessageListener, isExternalMessage } from "@bitwarden/common/platform/messaging";
import { devFlagEnabled } from "@bitwarden/common/platform/misc/flags"; import { devFlagEnabled } from "@bitwarden/common/platform/misc/flags";
import { Utils } from "@bitwarden/common/platform/misc/utils"; import { Utils } from "@bitwarden/common/platform/misc/utils";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherType } from "@bitwarden/common/vault/enums";
import { BiometricsCommands } from "@bitwarden/key-management"; import { BiometricsCommands } from "@bitwarden/key-management";
@ -53,6 +54,7 @@ export default class RuntimeBackground {
private accountService: AccountService, private accountService: AccountService,
private readonly lockService: LockService, private readonly lockService: LockService,
private billingAccountProfileStateService: BillingAccountProfileStateService, private billingAccountProfileStateService: BillingAccountProfileStateService,
private cipherService: CipherService,
) { ) {
// onInstalled listener must be wired up before anything else, so we do it in the ctor // onInstalled listener must be wired up before anything else, so we do it in the ctor
chrome.runtime.onInstalled.addListener((details: any) => { chrome.runtime.onInstalled.addListener((details: any) => {
@ -200,6 +202,9 @@ export default class RuntimeBackground {
case BiometricsCommands.GetBiometricsStatusForUser: { case BiometricsCommands.GetBiometricsStatusForUser: {
return await this.main.biometricsService.getBiometricsStatusForUser(msg.userId); return await this.main.biometricsService.getBiometricsStatusForUser(msg.userId);
} }
case "updateLastUsedDate": {
return await this.cipherService.updateLastUsedDate(msg.cipherId);
}
case "getUseTreeWalkerApiForPageDetailsCollectionFeatureFlag": { case "getUseTreeWalkerApiForPageDetailsCollectionFeatureFlag": {
return await this.configService.getFeatureFlag( return await this.configService.getFeatureFlag(
FeatureFlag.UseTreeWalkerApiForPageDetailsCollection, FeatureFlag.UseTreeWalkerApiForPageDetailsCollection,

Loading…
Cancel
Save