A ton of random bugs and polish (#3668)

This commit is contained in:
Joe Milazzo 2025-03-23 17:06:20 -05:00 committed by GitHub
parent b45d92ea5c
commit de651215f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
144 changed files with 852 additions and 848 deletions

View file

@ -23,6 +23,7 @@ import {Volume} from "../_models/volume";
import {UtilityService} from "../shared/_services/utility.service";
import {translate} from "@jsverse/transloco";
import {ToastrService} from "ngx-toastr";
import {getIosVersion, isSafari, Version} from "../_helpers/browser";
export const CHAPTER_ID_DOESNT_EXIST = -1;
@ -46,7 +47,8 @@ export class ReaderService {
// Override background color for reader and restore it onDestroy
private originalBodyColor!: string;
private noSleep = new NoSleep();
private noSleep: NoSleep = new NoSleep();
constructor(private httpClient: HttpClient, @Inject(DOCUMENT) private document: Document) {
this.accountService.currentUser$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(user => {
@ -56,17 +58,18 @@ export class ReaderService {
});
}
enableWakeLock(element?: Element | Document) {
// Enable wake lock.
// (must be wrapped in a user input event handler e.g. a mouse or touch handler)
if (!element) element = this.document;
const enableNoSleepHandler = () => {
const enableNoSleepHandler = async () => {
element!.removeEventListener('click', enableNoSleepHandler, false);
element!.removeEventListener('touchmove', enableNoSleepHandler, false);
element!.removeEventListener('mousemove', enableNoSleepHandler, false);
this.noSleep!.enable();
await this.noSleep.enable();
};
// Enable wake lock.