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>
@@ -120,13 +120,14 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
this.selectedFontType = individualSetting?.font || globalSetting?.font || FALLBACK_EPUB_SETTINGS.fontType; this.selectedFontType = individualSetting?.font || globalSetting?.font || FALLBACK_EPUB_SETTINGS.fontType;
this.fontSize = individualSetting?.fontSize || globalSetting?.fontSize || FALLBACK_EPUB_SETTINGS.fontSize; this.fontSize = individualSetting?.fontSize || globalSetting?.fontSize || FALLBACK_EPUB_SETTINGS.fontSize;
} }
this.rendition.themes.select(this.selectedTheme); this.rendition.themes.select(this.selectedTheme);
this.rendition.themes.fontSize(`${this.fontSize}%`); this.rendition.themes.fontSize(`${this.fontSize}%`);
this.rendition.themes.font(this.selectedFontType); this.rendition.themes.font(this.selectedFontType);
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);
} }