mirror of
https://github.com/cranci1/Sora.git
synced 2026-01-11 20:10:24 +00:00
Fixed chapters not loading (#216)
* hey
* mediainfoview fixed chapters not loading
* added back that
* ts annoying 🥀
This commit is contained in:
parent
508dcd4a42
commit
5d0c3fd977
1 changed files with 6 additions and 18 deletions
|
|
@ -973,8 +973,6 @@ struct MediaInfoView: View {
|
|||
await withTaskGroup(of: Void.self) { group in
|
||||
var chaptersLoaded = false
|
||||
var detailsLoaded = false
|
||||
let timeout: TimeInterval = 8.0
|
||||
let start = Date()
|
||||
|
||||
group.addTask {
|
||||
let fetchedChapters = try? await JSController.shared.extractChapters(moduleId: module.id.uuidString, href: href)
|
||||
|
|
@ -997,9 +995,6 @@ struct MediaInfoView: View {
|
|||
if !(self.synopsis.isEmpty && self.aliases.isEmpty && self.airdate.isEmpty) {
|
||||
detailsLoaded = true
|
||||
continuation.resume()
|
||||
} else if Date().timeIntervalSince(start) > timeout {
|
||||
detailsLoaded = true
|
||||
continuation.resume()
|
||||
} else {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
checkDetails()
|
||||
|
|
@ -1010,13 +1005,6 @@ struct MediaInfoView: View {
|
|||
checkDetails()
|
||||
}
|
||||
}
|
||||
group.addTask {
|
||||
try? await Task.sleep(nanoseconds: UInt64(timeout * 1_000_000_000))
|
||||
await MainActor.run {
|
||||
chaptersLoaded = true
|
||||
detailsLoaded = true
|
||||
}
|
||||
}
|
||||
while true {
|
||||
let loaded = await MainActor.run { chaptersLoaded && detailsLoaded }
|
||||
if loaded { break }
|
||||
|
|
|
|||
Loading…
Reference in a new issue