mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +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:
parent
16462e4e9e
commit
94da14fb10
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user