Incognito Reader (#560)

* Hooked in incognito mode into the manga reader
This commit is contained in:
Joseph Milazzo 2021-09-07 05:45:17 -07:00 committed by GitHub
parent c728b79616
commit 2eaddbdfac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 103 additions and 13 deletions

View file

@ -175,6 +175,11 @@ export class SeriesDetailComponent implements OnInit {
case(Action.Edit):
this.openViewInfo(volume);
break;
case(Action.IncognitoRead):
if (volume.chapters != undefined && volume.chapters?.length >= 1) {
this.openChapter(volume.chapters[0], true);
}
break;
default:
break;
}
@ -191,6 +196,9 @@ export class SeriesDetailComponent implements OnInit {
case(Action.Edit):
this.openViewInfo(chapter);
break;
case(Action.IncognitoRead):
this.openChapter(chapter, true);
break;
default:
break;
}
@ -348,16 +356,16 @@ export class SeriesDetailComponent implements OnInit {
});
}
openChapter(chapter: Chapter) {
openChapter(chapter: Chapter, incognitoMode = false) {
if (chapter.pages === 0) {
this.toastr.error('There are no pages. Kavita was not able to read this archive.');
return;
}
if (chapter.files.length > 0 && chapter.files[0].format === MangaFormat.EPUB) {
this.router.navigate(['library', this.libraryId, 'series', this.series?.id, 'book', chapter.id]);
this.router.navigate(['library', this.libraryId, 'series', this.series?.id, 'book', chapter.id], {queryParams: {incognitoMode}});
} else {
this.router.navigate(['library', this.libraryId, 'series', this.series?.id, 'manga', chapter.id]);
this.router.navigate(['library', this.libraryId, 'series', this.series?.id, 'manga', chapter.id], {queryParams: {incognitoMode}});
}
}