Misc Bugfixes (#2832)

This commit is contained in:
Joe Milazzo 2024-04-07 12:29:29 -05:00 committed by GitHub
parent 57fb2d01b9
commit 0277f8f4c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 172 additions and 179 deletions

View file

@ -120,7 +120,7 @@ export class ManageEmailSettingsComponent implements OnInit {
if (res.successful) {
this.toastr.success(translate('toasts.email-sent', {email: res.emailAddress}));
} else {
this.toastr.error(translate('toasts.email-not-sent-test'))
this.toastr.error(res.errorMessage);
}
});
}

View file

@ -13,7 +13,7 @@ import {
RendererStyleFlags2,
ViewChild
} from '@angular/core';
import { DOCUMENT, Location, NgTemplateOutlet, NgIf, NgStyle, NgClass } from '@angular/common';
import { DOCUMENT, NgTemplateOutlet, NgIf, NgStyle, NgClass } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
import { forkJoin, fromEvent, of } from 'rxjs';
@ -268,7 +268,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
* Used for showing/hiding bottom action bar. Calculates if there is enough scroll to show it.
* Will hide if all content in book is absolute positioned
*/
horizontalScrollbarNeeded = false;
scrollbarNeeded = false;
readingDirection: ReadingDirection = ReadingDirection.LeftToRight;
@ -513,7 +512,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
tap((e) => {
const selection = window.getSelection();
this.hidePagination = selection !== null && selection.toString().trim() !== '';
console.log('hide pagination: ', this.hidePagination);
this.cdRef.markForCheck();
})
)
@ -525,7 +523,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
distinctUntilChanged(),
tap((e) => {
this.hidePagination = false;
console.log('hide pagination: ', this.hidePagination);
this.cdRef.markForCheck();
})
)

View file

@ -77,9 +77,7 @@
</button>
</div>
@if (utilityService.getActiveBreakpoint() > Breakpoint.Tablet) {
<pdf-zoom-toolbar ></pdf-zoom-toolbar>
}
<pdf-zoom-toolbar ></pdf-zoom-toolbar>
<div id="toolbarViewerRight">

View file

@ -1,23 +1,19 @@
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Component, DestroyRef,
ElementRef,
HostListener, inject, Inject,
HostListener,
inject,
Inject,
OnDestroy,
OnInit,
ViewChild
} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {
NgxExtendedPdfViewerModule,
NgxExtendedPdfViewerService,
PageViewModeType,
ProgressBarEvent,
ScrollModeType
} from 'ngx-extended-pdf-viewer';
import {NgxExtendedPdfViewerModule, PageViewModeType, ProgressBarEvent, ScrollModeType} from 'ngx-extended-pdf-viewer';
import {ToastrService} from 'ngx-toastr';
import {take} from 'rxjs';
import {Observable, take} from 'rxjs';
import {BookService} from 'src/app/book-reader/_services/book.service';
import {Breakpoint, KEY_CODES, UtilityService} from 'src/app/shared/_services/utility.service';
import {Chapter} from 'src/app/_models/chapter';
@ -61,6 +57,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
public readonly accountService = inject(AccountService);
public readonly readerService = inject(ReaderService);
public readonly utilityService = inject(UtilityService);
public readonly destroyRef = inject(DestroyRef);
protected readonly ScrollModeType = ScrollModeType;
protected readonly Breakpoint = Breakpoint;
@ -182,6 +179,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
});
}
calcScrollbarNeeded() {
const viewContainer = this.document.querySelector('#viewerContainer');
if (viewContainer == null) return;
@ -267,7 +265,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
}
this.cdRef.markForCheck();
});
setTimeout(() => this.readerService.enableWakeLock(this.container.nativeElement), 1000); // TODO: This needs to be in afterviewinit i think
setTimeout(() => this.readerService.enableWakeLock(this.container.nativeElement), 1000);
}
/**
@ -300,8 +298,13 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
this.scrollMode = options[index];
this.calcScrollbarNeeded();
const currPage = this.currentPage;
this.cdRef.markForCheck();
setTimeout(() => {
this.currentPage = currPage;
this.cdRef.markForCheck();
}, 100);
}
toggleSpreadMode() {
@ -318,6 +321,10 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
if (this.pageLayoutMode === 'book') {
this.pageLayoutMode = 'multiple';
} else {
if (this.utilityService.getActiveBreakpoint() < Breakpoint.Tablet) {
this.toastr.info(translate('toasts.pdf-book-mode-screen-size'));
return;
}
this.pageLayoutMode = 'book';
// If the fit is automatic, let's adjust to 100% to ensure it renders correctly (can't do this, but it doesn't always happen)
}

View file

@ -68,7 +68,6 @@ export class ChangeEmailComponent implements OnInit {
const model = this.form.value;
this.errors = [];
this.accountService.updateEmail(model.email, model.password).subscribe(updateEmailResponse => {
if (updateEmailResponse.invalidEmail) {
this.toastr.success(translate('toasts.email-sent-to-no-existing', {email: model.email}));
}

View file

@ -2127,7 +2127,6 @@
"file-send-to": "File(s) emailed to {{name}}",
"theme-missing": "The active theme no longer exists. Please refresh the page.",
"email-sent": "Email sent to {{email}}",
"email-not-sent-test": "There was an exception when sending the email. Check logs for details. This indicates improper settings.",
"email-not-sent": "Email on file is not a valid email and can not be sent. A link has been dumped in logs. The admin can provide this link to complete flow.",
"k+-license-saved": "License Key saved, but it is not valid. Click check to revalidate the subscription. First time registration may take a min to propagate.",
"k+-unlocked": "Kavita+ unlocked!",
@ -2177,7 +2176,8 @@
"collections-promoted": "Collections promoted",
"collections-unpromoted": "Collections un-promoted",
"confirm-delete-collections": "Are you sure you want to delete multiple collections?",
"collections-deleted": "Collections deleted"
"collections-deleted": "Collections deleted",
"pdf-book-mode-screen-size": "Screen too small for Book mode"
},