[PM-2044] Fix hotkeys and context menu not resetting the vault timeout timer (#5313)
* Reset timeout timer for hotkeys and context menu * Fix imports --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
65e698b322
commit
7a32837bc7
|
@ -4,6 +4,7 @@ import { EventCollectionService } from "@bitwarden/common/abstractions/event/eve
|
||||||
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
||||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||||
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
||||||
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
|
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
|
||||||
import { CipherType } from "@bitwarden/common/vault/enums/cipher-type";
|
import { CipherType } from "@bitwarden/common/vault/enums/cipher-type";
|
||||||
|
@ -65,6 +66,7 @@ describe("ContextMenuClickedHandler", () => {
|
||||||
let autofill: AutofillAction;
|
let autofill: AutofillAction;
|
||||||
let authService: MockProxy<AuthService>;
|
let authService: MockProxy<AuthService>;
|
||||||
let cipherService: MockProxy<CipherService>;
|
let cipherService: MockProxy<CipherService>;
|
||||||
|
let stateService: MockProxy<StateService>;
|
||||||
let totpService: MockProxy<TotpService>;
|
let totpService: MockProxy<TotpService>;
|
||||||
let eventCollectionService: MockProxy<EventCollectionService>;
|
let eventCollectionService: MockProxy<EventCollectionService>;
|
||||||
let userVerificationService: MockProxy<UserVerificationService>;
|
let userVerificationService: MockProxy<UserVerificationService>;
|
||||||
|
@ -77,6 +79,7 @@ describe("ContextMenuClickedHandler", () => {
|
||||||
autofill = jest.fn<Promise<void>, [tab: chrome.tabs.Tab, cipher: CipherView]>();
|
autofill = jest.fn<Promise<void>, [tab: chrome.tabs.Tab, cipher: CipherView]>();
|
||||||
authService = mock();
|
authService = mock();
|
||||||
cipherService = mock();
|
cipherService = mock();
|
||||||
|
stateService = mock();
|
||||||
totpService = mock();
|
totpService = mock();
|
||||||
eventCollectionService = mock();
|
eventCollectionService = mock();
|
||||||
|
|
||||||
|
@ -86,6 +89,7 @@ describe("ContextMenuClickedHandler", () => {
|
||||||
autofill,
|
autofill,
|
||||||
authService,
|
authService,
|
||||||
cipherService,
|
cipherService,
|
||||||
|
stateService,
|
||||||
totpService,
|
totpService,
|
||||||
eventCollectionService,
|
eventCollectionService,
|
||||||
userVerificationService
|
userVerificationService
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||||
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
||||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||||
import { EventType } from "@bitwarden/common/enums";
|
import { EventType } from "@bitwarden/common/enums";
|
||||||
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
|
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
|
||||||
import { GlobalState } from "@bitwarden/common/platform/models/domain/global-state";
|
import { GlobalState } from "@bitwarden/common/platform/models/domain/global-state";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
|
@ -63,6 +64,7 @@ export class ContextMenuClickedHandler {
|
||||||
private autofillAction: AutofillAction,
|
private autofillAction: AutofillAction,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private cipherService: CipherService,
|
private cipherService: CipherService,
|
||||||
|
private stateService: StateService,
|
||||||
private totpService: TotpService,
|
private totpService: TotpService,
|
||||||
private eventCollectionService: EventCollectionService,
|
private eventCollectionService: EventCollectionService,
|
||||||
private userVerificationService: UserVerificationService
|
private userVerificationService: UserVerificationService
|
||||||
|
@ -114,6 +116,7 @@ export class ContextMenuClickedHandler {
|
||||||
(tab, cipher) => autofillCommand.doAutofillTabWithCipherCommand(tab, cipher),
|
(tab, cipher) => autofillCommand.doAutofillTabWithCipherCommand(tab, cipher),
|
||||||
await authServiceFactory(cachedServices, serviceOptions),
|
await authServiceFactory(cachedServices, serviceOptions),
|
||||||
await cipherServiceFactory(cachedServices, serviceOptions),
|
await cipherServiceFactory(cachedServices, serviceOptions),
|
||||||
|
await stateServiceFactory(cachedServices, serviceOptions),
|
||||||
await totpServiceFactory(cachedServices, serviceOptions),
|
await totpServiceFactory(cachedServices, serviceOptions),
|
||||||
await eventCollectionServiceFactory(cachedServices, serviceOptions),
|
await eventCollectionServiceFactory(cachedServices, serviceOptions),
|
||||||
await userVerificationServiceFactory(cachedServices, serviceOptions)
|
await userVerificationServiceFactory(cachedServices, serviceOptions)
|
||||||
|
@ -224,6 +227,7 @@ export class ContextMenuClickedHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.stateService.setLastActive(new Date().getTime());
|
||||||
switch (info.parentMenuItemId) {
|
switch (info.parentMenuItemId) {
|
||||||
case AUTOFILL_ID:
|
case AUTOFILL_ID:
|
||||||
case AUTOFILL_IDENTITY_ID:
|
case AUTOFILL_IDENTITY_ID:
|
||||||
|
|
|
@ -595,6 +595,7 @@ export default class MainBackground {
|
||||||
this.platformUtilsService as BrowserPlatformUtilsService,
|
this.platformUtilsService as BrowserPlatformUtilsService,
|
||||||
this.i18nService,
|
this.i18nService,
|
||||||
this.notificationsService,
|
this.notificationsService,
|
||||||
|
this.stateService,
|
||||||
this.systemService,
|
this.systemService,
|
||||||
this.environmentService,
|
this.environmentService,
|
||||||
this.messagingService,
|
this.messagingService,
|
||||||
|
@ -655,6 +656,7 @@ export default class MainBackground {
|
||||||
},
|
},
|
||||||
this.authService,
|
this.authService,
|
||||||
this.cipherService,
|
this.cipherService,
|
||||||
|
this.stateService,
|
||||||
this.totpService,
|
this.totpService,
|
||||||
this.eventCollectionService,
|
this.eventCollectionService,
|
||||||
this.userVerificationService
|
this.userVerificationService
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { CipherType } from "@bitwarden/common/vault/enums/cipher-type";
|
||||||
import { AutofillService } from "../autofill/services/abstractions/autofill.service";
|
import { AutofillService } from "../autofill/services/abstractions/autofill.service";
|
||||||
import { BrowserApi } from "../platform/browser/browser-api";
|
import { BrowserApi } from "../platform/browser/browser-api";
|
||||||
import { BrowserPopoutWindowService } from "../platform/popup/abstractions/browser-popout-window.service";
|
import { BrowserPopoutWindowService } from "../platform/popup/abstractions/browser-popout-window.service";
|
||||||
|
import { BrowserStateService } from "../platform/services/abstractions/browser-state.service";
|
||||||
import { BrowserEnvironmentService } from "../platform/services/browser-environment.service";
|
import { BrowserEnvironmentService } from "../platform/services/browser-environment.service";
|
||||||
import BrowserPlatformUtilsService from "../platform/services/browser-platform-utils.service";
|
import BrowserPlatformUtilsService from "../platform/services/browser-platform-utils.service";
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ export default class RuntimeBackground {
|
||||||
private platformUtilsService: BrowserPlatformUtilsService,
|
private platformUtilsService: BrowserPlatformUtilsService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
|
private stateService: BrowserStateService,
|
||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
private environmentService: BrowserEnvironmentService,
|
private environmentService: BrowserEnvironmentService,
|
||||||
private messagingService: MessagingService,
|
private messagingService: MessagingService,
|
||||||
|
@ -176,6 +178,7 @@ export default class RuntimeBackground {
|
||||||
switch (msg.sender) {
|
switch (msg.sender) {
|
||||||
case "autofiller":
|
case "autofiller":
|
||||||
case "autofill_cmd": {
|
case "autofill_cmd": {
|
||||||
|
this.stateService.setLastActive(new Date().getTime());
|
||||||
const totpCode = await this.autofillService.doAutoFillActiveTab(
|
const totpCode = await this.autofillService.doAutoFillActiveTab(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue