From fc1cff477b0d1382ff9983aa429e807f8575ea89 Mon Sep 17 00:00:00 2001 From: 50/50 <80717571+50n50@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:09:31 +0200 Subject: [PATCH] Build fix (will flush commits after this) (#210) * Quick Czech fix * Bookmark collection system + migration system (Video in discord)) * Check discord * Fix mediainfoview * Title always expanded * Reader header enhancements * Fix tab bar gradient * MORE/LESS below synopsis instead of next to it (less wasted space)) * Font + Weight + Size buttons for reader (with correct UI)) * Change icon * Theming and auto scroll * fucking cool shit * added new theme for reader * Fixed reader header * Added italian * made italian usable * changed credits * finally fucking italian works * Fix novel details * Fix loading issue * made chapter cells less tall * Fix current label * Create ios.yml * Delete .github/workflows/ios.yml * Hopefully fixed building error --- Sora/Views/MediaInfoView/MediaInfoView.swift | 37 +++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/Sora/Views/MediaInfoView/MediaInfoView.swift b/Sora/Views/MediaInfoView/MediaInfoView.swift index 471bece..59812a2 100644 --- a/Sora/Views/MediaInfoView/MediaInfoView.swift +++ b/Sora/Views/MediaInfoView/MediaInfoView.swift @@ -893,7 +893,7 @@ struct MediaInfoView: View { group.addTask { let fetchedChapters = try? await JSController.shared.extractChapters(moduleId: module.id.uuidString, href: href) - DispatchQueue.main.async { + await MainActor.run { if let fetchedChapters = fetchedChapters { Logger.shared.log("setupInitialData: fetchedChapters count = \(fetchedChapters.count)", type: "Debug") Logger.shared.log("setupInitialData: fetchedChapters = \(fetchedChapters)", type: "Debug") @@ -903,33 +903,38 @@ struct MediaInfoView: View { } } group.addTask { - await withCheckedContinuation { continuation in + await MainActor.run { self.fetchDetails() - var checkDetails: (() -> Void)? - checkDetails = { - 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?() + } + await withCheckedContinuation { (continuation: CheckedContinuation) in + func checkDetails() { + Task { @MainActor in + 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() + } } } } - checkDetails?() + checkDetails() } } group.addTask { try? await Task.sleep(nanoseconds: UInt64(timeout * 1_000_000_000)) - DispatchQueue.main.async { + await MainActor.run { chaptersLoaded = true detailsLoaded = true } } - while !(chaptersLoaded && detailsLoaded) { + while true { + let loaded = await MainActor.run { chaptersLoaded && detailsLoaded } + if loaded { break } try? await Task.sleep(nanoseconds: 100_000_000) } }