1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-21 11:35:34 +01:00

[PM-1144] Fix last active (auto logout issue) (#4835)

* replicate the recordActivity function everytime a successful login occurs

* rejig the exisiting recordActivity function to use state service for lastActive value

* revert change and just use onblur instead

* Update apps/browser/src/background/main.background.ts

* insted of bluring, pipe up unlocked message to update lastActive

* remove pingpong, use subscribe to update last active

* Update apps/browser/src/popup/app.component.ts

Co-authored-by: Matt Gibson <fungibl@gmail.com>

* add missing imports

---------

Co-authored-by: Matt Gibson <fungibl@gmail.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
This commit is contained in:
Jack 2023-05-04 03:28:14 +08:00 committed by GitHub
parent 16462e4e9e
commit 94da14fb10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ import {
import { DomSanitizer } from "@angular/platform-browser";
import { NavigationEnd, Router, RouterOutlet } from "@angular/router";
import { IndividualConfig, ToastrService } from "ngx-toastr";
import { Subject, takeUntil } from "rxjs";
import { filter, concatMap, Subject, takeUntil } from "rxjs";
import Swal from "sweetalert2";
import { DialogServiceAbstraction, SimpleDialogOptions } from "@bitwarden/angular/services/dialog";
@ -62,6 +62,16 @@ export class AppComponent implements OnInit, OnDestroy {
this.activeUserId = userId;
});
this.stateService.activeAccountUnlocked$
.pipe(
filter((unlocked) => unlocked),
concatMap(async () => {
await this.recordActivity();
}),
takeUntil(this.destroy$)
)
.subscribe();
this.ngZone.runOutsideAngular(() => {
window.onmousedown = () => this.recordActivity();
window.ontouchstart = () => this.recordActivity();