fix: change image correctly, do not set metadata in loadComics
This commit is contained in:
@@ -124,7 +124,7 @@ final class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
||||
if let alert = pendingAlert {
|
||||
present(alert, animated: false, completion: nil)
|
||||
}
|
||||
if !hasSetContentOffset && scrollingCollectionView != nil {
|
||||
if !hasSetContentOffset, scrollingCollectionView != nil {
|
||||
guard let path = currentPath else { return }
|
||||
guard let state = state[path.lastPathComponent] else { return }
|
||||
let screenSize = UIScreen.main.bounds.size
|
||||
@@ -289,8 +289,7 @@ final class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
||||
return
|
||||
}
|
||||
var byteBuffer = ByteBuffer(data: data)
|
||||
metadata = try? getCheckedRoot(byteBuffer: &byteBuffer)
|
||||
if metadata == nil {
|
||||
guard let metadata: Metadata = try? getCheckedRoot(byteBuffer: &byteBuffer) else {
|
||||
alert.message =
|
||||
String(format: "Failed to read contents of metadata flatbuffer file: \(metadataPath))")
|
||||
pendingAlert = alert
|
||||
@@ -299,7 +298,9 @@ final class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
||||
metadataList[dir] = metadata
|
||||
loadLocalState()
|
||||
let volCovP = ProgressIndices(v: state[currentPath.lastPathComponent]!.progress.v, c: 0, i: 0)
|
||||
let archivePath = getArchiveURL(volCovP.v)
|
||||
let archivePath = currentPath
|
||||
.appendingPathComponent("volumes")
|
||||
.appendingPathComponent(metadata.volumes[volCovP.v].archive)
|
||||
let archive: Archive!
|
||||
do {
|
||||
let a = try Archive(url: archivePath, accessMode: .read)
|
||||
@@ -1268,22 +1269,22 @@ final class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
||||
|
||||
func changeImage(turn: PageTurn) {
|
||||
let scaling = UIView.ContentMode.scaleAspectFit
|
||||
let progress = getProgress()
|
||||
var newProgress = progress
|
||||
let pProgress = getProgress()
|
||||
var newProgress = pProgress
|
||||
newProgress = getProgressIndicesFromTurn(turn: turn, progress: newProgress)
|
||||
if newProgress.v == progress.v, newProgress.c == progress.c, newProgress.i == progress.i {
|
||||
if newProgress.v == pProgress.v, newProgress.c == pProgress.c, newProgress.i == pProgress.i {
|
||||
return
|
||||
}
|
||||
aniListProgressUpdate(progress: progress, newProgress: newProgress)
|
||||
state[currentPath.lastPathComponent]!.progress = newProgress
|
||||
aniListProgressUpdate(progress: pProgress, newProgress: newProgress)
|
||||
updateInfo()
|
||||
let path = getImagePath(progress)
|
||||
let path = getImagePath(newProgress)
|
||||
|
||||
imageLoader.setActiveWindow([path])
|
||||
|
||||
imageLoader.loadImage(
|
||||
archiveURL: getArchiveURL(progress.v),
|
||||
filename: getImagePath(progress),
|
||||
archiveURL: getArchiveURL(newProgress.v),
|
||||
filename: getImagePath(newProgress),
|
||||
scaling: scaling,
|
||||
screenSize: UIScreen.main.bounds.size
|
||||
) { [weak self] image in
|
||||
|
||||
Reference in New Issue
Block a user