mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-19 07:32:08 +00:00
im so dumb i swear
This commit is contained in:
parent
c28a47a2f4
commit
3ebf986424
1 changed files with 24 additions and 8 deletions
|
|
@ -32,7 +32,8 @@ struct MediaInfoView: View {
|
|||
|
||||
@AppStorage("externalPlayer") private var externalPlayer: String = "Default"
|
||||
|
||||
@ObservedObject var jsController = JSController()
|
||||
@StateObject private var jsController = JSController()
|
||||
@EnvironmentObject var moduleManager: ModuleManager
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
|
|
@ -140,14 +141,29 @@ struct MediaInfoView: View {
|
|||
}
|
||||
}
|
||||
.onAppear {
|
||||
jsController.fetchDetails(url: href) { items in
|
||||
if let item = items.first {
|
||||
print("Fetched item: \(item)")
|
||||
self.synopsis = item.description
|
||||
self.aliases = item.aliases
|
||||
self.airdate = item.airdate
|
||||
getDetails()
|
||||
}
|
||||
}
|
||||
|
||||
func getDetails() {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
Task {
|
||||
do {
|
||||
let jsContent = try moduleManager.getModuleContent(module)
|
||||
jsController.loadScript(jsContent)
|
||||
jsController.fetchDetails(url: href) { items in
|
||||
if let item = items.first {
|
||||
print("Fetched item: \(item)")
|
||||
self.synopsis = item.description
|
||||
self.aliases = item.aliases
|
||||
self.airdate = item.airdate
|
||||
}
|
||||
self.isLoading = false
|
||||
}
|
||||
} catch {
|
||||
print("Error loading module: \(error)")
|
||||
self.isLoading = false
|
||||
}
|
||||
self.isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue