Bookmark and Reader bugs (#1632)
* Updated swiper and some packages for reported security issues * Fixed reading lists promotion not working * Refactor RenameFileForCopy to use iterative recursion, rather than functional. * Ensured that bookmarks are fetched and ordered by Created date. * Fixed a bug where bookmarks were coming back in the correct order, but due to filenames, would not sort correctly. * Default installs to Debug log level given errors users have and Debug not being too noisy * Added jumpbar to bookmarks page * Now added jumpbar to bookmarks * Refactored some code into pipes and added some debug messaging for prefetcher * Try loading next and prev chapter's first/last page to cache so it renders faster * Updated GetImage to do a bound check on max page. Fixed a critical bug in how manga reader updates image elements src to prefetch/load pages. I was not creating a new reference which broke Angular's ability to update DOM on changes. * Refactored the image setting code to use a single method which tries to use a cached image always. * Refactored code to use getPage which favors cache and simplifies image creation code
This commit is contained in:
parent
dab42041d5
commit
38a169818b
25 changed files with 317 additions and 166 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -101,7 +102,7 @@ public class CacheService : ICacheService
|
|||
var extractPath = GetCachePath(chapterId);
|
||||
|
||||
if (_directoryService.Exists(extractPath)) return chapter;
|
||||
var files = chapter.Files.ToList();
|
||||
var files = chapter?.Files.ToList();
|
||||
ExtractChapterFiles(extractPath, files);
|
||||
|
||||
return chapter;
|
||||
|
|
@ -223,6 +224,8 @@ public class CacheService : ICacheService
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
if (page > files.Length) page = files.Length;
|
||||
|
||||
// Since array is 0 based, we need to keep that in account (only affects last image)
|
||||
return page == files.Length ? files.ElementAt(page - 1) : files.ElementAt(page);
|
||||
}
|
||||
|
|
@ -234,8 +237,8 @@ public class CacheService : ICacheService
|
|||
|
||||
var bookmarkDtos = await _unitOfWork.UserRepository.GetBookmarkDtosForSeries(userId, seriesId);
|
||||
var files = (await _bookmarkService.GetBookmarkFilesById(bookmarkDtos.Select(b => b.Id))).ToList();
|
||||
_directoryService.CopyFilesToDirectory(files, destDirectory);
|
||||
_directoryService.Flatten(destDirectory);
|
||||
_directoryService.CopyFilesToDirectory(files, destDirectory,
|
||||
Enumerable.Range(1, files.Count).Select(i => i + string.Empty).ToList());
|
||||
return files.Count;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue