Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #353

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions EhPanda/Network/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,9 @@ struct GalleryMPVImageURLRequest: Request {
let index: Int
let mpvKey: String
let mpvImageKey: String
let skipServerIdentifier: Int?
let skipServerIdentifier: String?

var publisher: AnyPublisher<(URL, URL?, Int), AppError> {
var publisher: AnyPublisher<(URL, URL?, String), AppError> {
var params: [String: Any] = [
"method": "imagedispatch",
"gid": gid,
Expand All @@ -637,10 +637,19 @@ struct GalleryMPVImageURLRequest: Request {
guard let dict = try JSONSerialization
.jsonObject(with: data) as? [String: Any],
let imageURLString = dict["i"] as? String,
let imageURL = URL(string: imageURLString),
let skipServerIdentifier = dict["s"] as? Int
let imageURL = URL(string: imageURLString)
else { throw AppError.parseFailed }

var skipServerIdentifier: String?

if let integerIdentifier = dict["s"] as? Int {
skipServerIdentifier = integerIdentifier.description
} else if let stringIdentifier = dict["s"] as? String {
skipServerIdentifier = stringIdentifier
}

guard let skipServerIdentifier else { throw AppError.parseFailed }

if let originalImageURLStringSlice = dict["lf"] as? String {
let originalImageURL = Defaults.URL.host.appendingPathComponent(originalImageURLStringSlice)
return (imageURL, originalImageURL, skipServerIdentifier)
Expand Down
4 changes: 2 additions & 2 deletions EhPanda/View/Reading/ReadingReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct ReadingReducer: ReducerProtocol {

var mpvKey: String?
var mpvImageKeys = [Int: String]()
var mpvSkipServerIdentifiers = [Int: Int]()
var mpvSkipServerIdentifiers = [Int: String]()

@BindingState var showsPanel = false
@BindingState var showsSliderPreview = false
Expand Down Expand Up @@ -172,7 +172,7 @@ struct ReadingReducer: ReducerProtocol {
case fetchMPVKeys(Int, URL)
case fetchMPVKeysDone(Int, Result<(String, [Int: String]), AppError>)
case fetchMPVImageURL(Int, Bool)
case fetchMPVImageURLDone(Int, Result<(URL, URL?, Int), AppError>)
case fetchMPVImageURLDone(Int, Result<(URL, URL?, String), AppError>)
}

@Dependency(\.appDelegateClient) private var appDelegateClient
Expand Down
Loading