From 1771b5843b2e8353621bd8c1bd1113dc037b5d77 Mon Sep 17 00:00:00 2001 From: cranci <100066266+cranci1@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:25:07 +0200 Subject: [PATCH 1/4] k (#200) * Update VideoPlayer.swift * can you work now please --- .../MediaUtils/NormalPlayer/VideoPlayer.swift | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/Sora/MediaUtils/NormalPlayer/VideoPlayer.swift b/Sora/MediaUtils/NormalPlayer/VideoPlayer.swift index 29ce149..fc56bba 100644 --- a/Sora/MediaUtils/NormalPlayer/VideoPlayer.swift +++ b/Sora/MediaUtils/NormalPlayer/VideoPlayer.swift @@ -179,33 +179,32 @@ class VideoPlayerViewController: UIViewController { player?.play() setInitialPlayerRate() - checkForFaceTimeAndPromptSharePlay() + Task { + await checkForFaceTimeAndPromptSharePlay() + } } @MainActor private func checkForFaceTimeAndPromptSharePlay() async { - do { - let activity = VideoWatchingActivity( - mediaTitle: mediaTitle, - episodeNumber: episodeNumber, - streamUrl: streamUrl ?? "", - subtitles: subtitles, - aniListID: aniListID, - fullUrl: fullUrl, - headers: headers, - episodeImageUrl: episodeImageUrl, - episodeImageData: nil, - totalEpisodes: totalEpisodes, - tmdbID: tmdbID, - isMovie: isMovie, - seasonNumber: seasonNumber - ) - - if try await activity.prepareForActivation() { - await showSharePlayPrompt() - } - } catch { - Logger.shared.log("SharePlay preparation failed: \(error)", type: "Error") + let activity = VideoWatchingActivity( + mediaTitle: mediaTitle, + episodeNumber: episodeNumber, + streamUrl: streamUrl ?? "", + subtitles: subtitles, + aniListID: aniListID, + fullUrl: fullUrl, + headers: headers, + episodeImageUrl: episodeImageUrl, + episodeImageData: nil, + totalEpisodes: totalEpisodes, + tmdbID: tmdbID, + isMovie: isMovie, + seasonNumber: seasonNumber + ) + + let result = await activity.prepareForActivation() + if result == .activationPreferred { + showSharePlayPrompt() } } From c75c57664150d03025387fe8b8b7fb42e7191098 Mon Sep 17 00:00:00 2001 From: cranci1 <100066266+cranci1@users.noreply.github.com> Date: Tue, 17 Jun 2025 10:54:43 +0200 Subject: [PATCH 2/4] maybe its fixed now --- Sora/Views/DownloadView.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sora/Views/DownloadView.swift b/Sora/Views/DownloadView.swift index 020603c..dd618d0 100644 --- a/Sora/Views/DownloadView.swift +++ b/Sora/Views/DownloadView.swift @@ -667,6 +667,7 @@ struct DownloadedSection: View { } } +@MainActor struct EnhancedActiveDownloadCard: View { let download: JSActiveDownload @State private var currentProgress: Double @@ -847,6 +848,7 @@ struct EnhancedActiveDownloadCard: View { } } +@MainActor struct EnhancedDownloadGroupCard: View { let group: SimpleDownloadGroup let onDelete: (DownloadedAsset) -> Void @@ -919,6 +921,7 @@ struct EnhancedDownloadGroupCard: View { } } +@MainActor struct EnhancedShowEpisodesView: View { let group: SimpleDownloadGroup let onDelete: (DownloadedAsset) -> Void @@ -1146,6 +1149,7 @@ struct EnhancedShowEpisodesView: View { } } +@MainActor struct EnhancedEpisodeRow: View { let asset: DownloadedAsset let showDivider: Bool From 0af317616612243a1721e1027b97294929f9b8df Mon Sep 17 00:00:00 2001 From: cranci1 <100066266+cranci1@users.noreply.github.com> Date: Tue, 17 Jun 2025 11:06:59 +0200 Subject: [PATCH 3/4] Revert "maybe its fixed now" This reverts commit c75c57664150d03025387fe8b8b7fb42e7191098. --- Sora/Views/DownloadView.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Sora/Views/DownloadView.swift b/Sora/Views/DownloadView.swift index dd618d0..020603c 100644 --- a/Sora/Views/DownloadView.swift +++ b/Sora/Views/DownloadView.swift @@ -667,7 +667,6 @@ struct DownloadedSection: View { } } -@MainActor struct EnhancedActiveDownloadCard: View { let download: JSActiveDownload @State private var currentProgress: Double @@ -848,7 +847,6 @@ struct EnhancedActiveDownloadCard: View { } } -@MainActor struct EnhancedDownloadGroupCard: View { let group: SimpleDownloadGroup let onDelete: (DownloadedAsset) -> Void @@ -921,7 +919,6 @@ struct EnhancedDownloadGroupCard: View { } } -@MainActor struct EnhancedShowEpisodesView: View { let group: SimpleDownloadGroup let onDelete: (DownloadedAsset) -> Void @@ -1149,7 +1146,6 @@ struct EnhancedShowEpisodesView: View { } } -@MainActor struct EnhancedEpisodeRow: View { let asset: DownloadedAsset let showDivider: Bool From 082a6b2b8313b1a2deb2cf99572c1aac881e892a Mon Sep 17 00:00:00 2001 From: cranci1 <100066266+cranci1@users.noreply.github.com> Date: Tue, 17 Jun 2025 16:22:33 +0200 Subject: [PATCH 4/4] fixed downlaods --- Sora/SoraApp.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sora/SoraApp.swift b/Sora/SoraApp.swift index 5b33256..95e8cd4 100644 --- a/Sora/SoraApp.swift +++ b/Sora/SoraApp.swift @@ -116,6 +116,17 @@ struct SoraApp: App { for url in tmpContents { try fileManager.removeItem(at: url) } + + let parentURL = tmpURL.deletingLastPathComponent() + let parentContents = try fileManager.contentsOfDirectory(at: parentURL, includingPropertiesForKeys: [.isDirectoryKey]) + for url in parentContents { + if url.lastPathComponent.hasPrefix("com.apple.UserManagedAssets") { + var isDir: ObjCBool = false + if fileManager.fileExists(atPath: url.path, isDirectory: &isDir), isDir.boolValue { + try fileManager.removeItem(at: url) + } + } + } } catch { Logger.shared.log("Failed to clear tmp folder: \(error.localizedDescription)", type: "Error") }