mirror of
https://github.com/cranci1/Sora.git
synced 2026-01-11 20:10:24 +00:00
Update
This commit is contained in:
parent
7ce58a2d14
commit
513743ca04
1 changed files with 13 additions and 4 deletions
|
|
@ -9,7 +9,7 @@ import SwiftUI
|
|||
|
||||
struct AnilistMatchPopupView: View {
|
||||
let seriesTitle: String
|
||||
let onSelect: (Int, String) -> Void
|
||||
let onSelect: (Int, String, Int?) -> Void // id, title, malId
|
||||
|
||||
@State private var results: [[String: Any]] = []
|
||||
@State private var isLoading = true
|
||||
|
|
@ -54,7 +54,9 @@ struct AnilistMatchPopupView: View {
|
|||
Button(action: {
|
||||
if let id = result["id"] as? Int {
|
||||
let title = result["title"] as? String ?? seriesTitle
|
||||
onSelect(id, title)
|
||||
let malId = result["mal_id"] as? Int
|
||||
Logger.shared.log("Selected AniList ID: \(id), MAL ID: \(malId?.description ?? "nil")", type: "AnilistMatch")
|
||||
onSelect(id, title, malId)
|
||||
dismiss()
|
||||
}
|
||||
}) {
|
||||
|
|
@ -86,6 +88,11 @@ struct AnilistMatchPopupView: View {
|
|||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
if let malId = result["mal_id"] as? Int {
|
||||
Text("MAL ID: \(malId)")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
|
@ -153,7 +160,8 @@ struct AnilistMatchPopupView: View {
|
|||
Button("Cancel", role: .cancel) { }
|
||||
Button("Save") {
|
||||
if let idInt = Int(manualIDText.trimmingCharacters(in: .whitespaces)) {
|
||||
onSelect(idInt, seriesTitle)
|
||||
Logger.shared.log("Manual AniList ID: \(idInt), MAL ID: nil", type: "AnilistMatch")
|
||||
onSelect(idInt, seriesTitle, nil)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
|
@ -205,6 +213,7 @@ struct AnilistMatchPopupView: View {
|
|||
let cover = (media["coverImage"] as? [String: Any])?["large"] as? String
|
||||
return [
|
||||
"id": media["id"] ?? 0,
|
||||
"mal_id": media["idMal"] as? Int ?? 0,
|
||||
"title": titleInfo?["romaji"] ?? "Unknown",
|
||||
"title_english": titleInfo?["english"] as Any,
|
||||
"cover": cover as Any
|
||||
|
|
@ -213,4 +222,4 @@ struct AnilistMatchPopupView: View {
|
|||
}
|
||||
}.resume()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue