Release Testing Time (#1785)

* Fixed a bug with getting continue point where there was a single volume unread and a later volume with chapters inside it, the chapters were being picked.

* Fixed a bug where resuming from jump key wasn't working (develop)

* Cleaned up the spacing
This commit is contained in:
Joe Milazzo 2023-02-12 13:14:13 -08:00 committed by GitHub
parent 0de927dee4
commit bdd2a0a26a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 136 additions and 34 deletions

View file

@ -9,6 +9,8 @@ const keySize = 25; // Height of the JumpBar button
export class JumpbarService {
resumeKeys: {[key: string]: string} = {};
// Used for custom filtered urls
resumeScroll: {[key: string]: number} = {};
constructor() { }
@ -18,10 +20,19 @@ export class JumpbarService {
return '';
}
getResumePosition(key: string) {
if (this.resumeScroll.hasOwnProperty(key)) return this.resumeScroll[key];
return 0;
}
saveResumeKey(key: string, value: string) {
this.resumeKeys[key] = value;
}
saveScrollOffset(key: string, value: number) {
this.resumeScroll[key] = value;
}
generateJumpBar(jumpBarKeys: Array<JumpKey>, currentSize: number) {
const fullSize = (jumpBarKeys.length * keySize);
if (currentSize >= fullSize) {

View file

@ -14,6 +14,7 @@ import { Pagination } from 'src/app/_models/pagination';
import { FilterEvent, FilterItem, SeriesFilter } from 'src/app/_models/metadata/series-filter';
import { ActionItem } from 'src/app/_services/action-factory.service';
import { JumpbarService } from 'src/app/_services/jumpbar.service';
import { ScrollService } from 'src/app/_services/scroll.service';
@Component({
selector: 'app-card-detail-layout',
@ -74,7 +75,7 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges {
constructor(private filterUtilitySerivce: FilterUtilitiesService, public utilityService: UtilityService,
@Inject(DOCUMENT) private document: Document, private changeDetectionRef: ChangeDetectorRef,
private jumpbarService: JumpbarService, private router: Router) {
private jumpbarService: JumpbarService, private router: Router, private scrollService: ScrollService) {
this.filter = this.filterUtilitySerivce.createSeriesFilter();
this.changeDetectionRef.markForCheck();
@ -117,7 +118,7 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges {
this.resizeJumpBar();
// Don't resume jump key when there is a custom sort order, as it won't work
if (this.hasCustomSort()) {
if (!this.hasCustomSort()) {
if (!this.hasResumedJumpKey && this.jumpBarKeysToRender.length > 0) {
const resumeKey = this.jumpbarService.getResumeKey(this.router.url);
if (resumeKey === '') return;
@ -127,6 +128,13 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges {
this.hasResumedJumpKey = true;
setTimeout(() => this.scrollTo(keys[0]), 100);
}
} else {
// I will come back and refactor this to work
// const scrollPosition = this.jumpbarService.getResumePosition(this.router.url);
// console.log('scroll position: ', scrollPosition);
// if (scrollPosition > 0) {
// setTimeout(() => this.virtualScroller.scrollToIndex(scrollPosition, true, 0, 1000), 100);
// }
}
}
@ -164,6 +172,8 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy, OnChanges {
this.virtualScroller.scrollToIndex(targetIndex, true, 0, 1000);
this.jumpbarService.saveResumeKey(this.router.url, jumpKey.key);
// TODO: This doesn't work, we need the offset from virtual scroller
this.jumpbarService.saveScrollOffset(this.router.url, this.scrollService.scrollPosition);
this.changeDetectionRef.markForCheck();
}