Update epub last read time

This commit is contained in:
aditya.chandel
2025-01-17 19:27:58 -07:00
parent b8fb1d2f26
commit a8c3e346e3
2 changed files with 8 additions and 2 deletions
@@ -7,7 +7,7 @@
pInputText pInputText
[(ngModel)]="searchQuery" [(ngModel)]="searchQuery"
(input)="onSearchInputChange()" (input)="onSearchInputChange()"
placeholder="Search books..." placeholder="Search books by title or author..."
class="search-input" class="search-input"
/> />
<p-button *ngIf="searchQuery" icon="pi pi-times" (click)="clearSearch()" [text]="true" [rounded]="true" class="clear-btn" aria-label="Clear Search"></p-button> <p-button *ngIf="searchQuery" icon="pi pi-times" (click)="clearSearch()" [text]="true" [rounded]="true" class="clear-btn" aria-label="Clear Search"></p-button>
@@ -127,6 +127,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
this.setupKeyListener(); this.setupKeyListener();
this.trackProgress(); this.trackProgress();
this.updateLastReadTime();
}; };
fileReader.readAsArrayBuffer(epubData); fileReader.readAsArrayBuffer(epubData);
@@ -135,6 +136,10 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
}); });
} }
private updateLastReadTime(): void {
this.bookService.updateLastReadTime(this.epub.id).subscribe();
}
changeThemes(): void { changeThemes(): void {
if (this.rendition) { if (this.rendition) {
console.log(this.selectedTheme) console.log(this.selectedTheme)
@@ -237,6 +242,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
if (this.rendition) { if (this.rendition) {
this.rendition.off('keyup', this.keyListener); this.rendition.off('keyup', this.keyListener);
} }
this.updateLastReadTime();
document.removeEventListener('keyup', this.keyListener); document.removeEventListener('keyup', this.keyListener);
} }