From 04cf2c00fa8481983434e9080b93d439e9a9ef14 Mon Sep 17 00:00:00 2001 From: cranci1 <100066266+cranci1@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:02:10 +0100 Subject: [PATCH] testfkught build --- Sora/ContentView.swift | 4 ---- .../EpisodeCell/EpisodeCell.swift | 21 ++++++++----------- Sora/Views/MediaInfoView/MediaInfoView.swift | 15 +++---------- .../SettingsViewGeneral.swift | 8 +++---- Sora/Views/SettingsView/SettingsView.swift | 2 +- 5 files changed, 17 insertions(+), 33 deletions(-) diff --git a/Sora/ContentView.swift b/Sora/ContentView.swift index df3d6e8..afbd4ea 100644 --- a/Sora/ContentView.swift +++ b/Sora/ContentView.swift @@ -15,10 +15,6 @@ struct ContentView: View { .tabItem { Label("Library", systemImage: "books.vertical") } - DownloadView() - .tabItem { - Label("Downloads", systemImage: "arrow.down.circle.fill") - } SearchView() .tabItem { Label("Search", systemImage: "magnifyingglass") diff --git a/Sora/Views/MediaInfoView/EpisodeCell/EpisodeCell.swift b/Sora/Views/MediaInfoView/EpisodeCell/EpisodeCell.swift index 5bbb2aa..b284a47 100644 --- a/Sora/Views/MediaInfoView/EpisodeCell/EpisodeCell.swift +++ b/Sora/Views/MediaInfoView/EpisodeCell/EpisodeCell.swift @@ -20,7 +20,7 @@ struct EpisodeCell: View { let episodeID: Int let progress: Double let itemID: Int - + let onTap: (String) -> Void let onMarkAllPrevious: () -> Void @@ -28,18 +28,16 @@ struct EpisodeCell: View { @State private var episodeImageUrl: String = "" @State private var isLoading: Bool = true @State private var currentProgress: Double = 0.0 - + var body: some View { HStack { ZStack { - KFImage(URL(string: episodeImageUrl.isEmpty - ? "https://raw.githubusercontent.com/cranci1/Sora/refs/heads/main/assets/banner2.png" - : episodeImageUrl)) - .resizable() - .aspectRatio(16/9, contentMode: .fill) - .frame(width: 100, height: 56) - .cornerRadius(8) - + KFImage(URL(string: episodeImageUrl.isEmpty ? "https://raw.githubusercontent.com/cranci1/Sora/refs/heads/main/assets/banner2.png" : episodeImageUrl)) + .resizable() + .aspectRatio(16/9, contentMode: .fill) + .frame(width: 100, height: 56) + .cornerRadius(8) + if isLoading { ProgressView() .progressViewStyle(CircularProgressViewStyle()) @@ -69,7 +67,6 @@ struct EpisodeCell: View { } } - // Only show reset if progress is nonzero if progress != 0 { Button(action: resetProgress) { Label("Reset Progress", systemImage: "arrow.counterclockwise") @@ -111,7 +108,7 @@ struct EpisodeCell: View { let totalTime = UserDefaults.standard.double(forKey: "totalTime_\(episode)") currentProgress = totalTime > 0 ? lastPlayedTime / totalTime : 0 } - + private func fetchEpisodeDetails() { guard let url = URL(string: "https://api.ani.zip/mappings?anilist_id=\(itemID)") else { isLoading = false diff --git a/Sora/Views/MediaInfoView/MediaInfoView.swift b/Sora/Views/MediaInfoView/MediaInfoView.swift index f8f5cd3..8b47f57 100644 --- a/Sora/Views/MediaInfoView/MediaInfoView.swift +++ b/Sora/Views/MediaInfoView/MediaInfoView.swift @@ -56,8 +56,6 @@ struct MediaInfoView: View { } else { ScrollView { VStack(alignment: .leading, spacing: 16) { - - // MARK: - Top media info HStack(alignment: .top, spacing: 10) { KFImage(URL(string: imageUrl)) .placeholder { @@ -125,7 +123,6 @@ struct MediaInfoView: View { } } - // MARK: - Synopsis section if !synopsis.isEmpty { VStack(alignment: .leading, spacing: 2) { HStack(alignment: .center) { @@ -149,7 +146,6 @@ struct MediaInfoView: View { } } - // MARK: - Action buttons HStack { Button(action: { playFirstUnwatchedEpisode() @@ -210,7 +206,6 @@ struct MediaInfoView: View { } } - //MARK: - Mark all prevoius logic ForEach(episodeLinks.indices.filter { selectedRange.contains($0) }, id: \.self) { i in let ep = episodeLinks[i] let lastPlayedTime = UserDefaults.standard.double(forKey: "lastPlayedTime_\(ep.href)") @@ -240,11 +235,11 @@ struct MediaInfoView: View { UserDefaults.standard.set(99999999.0, forKey: "lastPlayedTime_\(href)") UserDefaults.standard.set(99999999.0, forKey: "totalTime_\(href)") } - refreshTrigger.toggle() // Force the UI to refresh + refreshTrigger.toggle() Logger.shared.log("Marked \(ep.number) episodes watched within anime \"\(title)\".", type: "General") } ) - .id(refreshTrigger) // Attaches the refresh trigger so that changes re-create the cell + .id(refreshTrigger) .disabled(isFetchingEpisode) } } @@ -523,11 +518,7 @@ struct MediaInfoView: View { } let subtitleFileURL = subtitles != nil ? URL(string: subtitles!) : nil - DownloadManager.shared.downloadAndConvertHLS(from: streamURL, title: title, episode: selectedEpisodeNumber, subtitleURL: subtitleFileURL, module: module) { success, fileURL in - return - } - - let externalPlayer = UserDefaults.standard.string(forKey: "externalPlayer") ?? "Default" + let externalPlayer = UserDefaults.standard.string(forKey: "externalPlayer") ?? "Sora" var scheme: String? switch externalPlayer { diff --git a/Sora/Views/SettingsView/SettingsSubViews/SettingsViewGeneral.swift b/Sora/Views/SettingsView/SettingsSubViews/SettingsViewGeneral.swift index 1dd614f..c9bbfbd 100644 --- a/Sora/Views/SettingsView/SettingsSubViews/SettingsViewGeneral.swift +++ b/Sora/Views/SettingsView/SettingsSubViews/SettingsViewGeneral.swift @@ -71,10 +71,10 @@ struct SettingsViewGeneral: View { } } - Section(header: Text("Downloads"), footer: Text("Note that the modules will be replaced only if there is a different version string inside the JSON file.")) { - Toggle("Multi Threads conversion", isOn: $multiThreadsEnabled) - .tint(.accentColor) - } + //Section(header: Text("Downloads"), footer: Text("Note that the modules will be replaced only if there is a different version string inside the JSON file.")) { + // Toggle("Multi Threads conversion", isOn: $multiThreadsEnabled) + // .tint(.accentColor) + //} Section(header: Text("Modules"), footer: Text("Note that the modules will be replaced only if there is a different version string inside the JSON file.")) { Toggle("Refresh Modules on Launch", isOn: $refreshModulesOnLaunch) diff --git a/Sora/Views/SettingsView/SettingsView.swift b/Sora/Views/SettingsView/SettingsView.swift index ee43405..b98698e 100644 --- a/Sora/Views/SettingsView/SettingsView.swift +++ b/Sora/Views/SettingsView/SettingsView.swift @@ -86,7 +86,7 @@ struct SettingsView: View { } } } - Section(footer: Text("Running Sora 0.2.1 - cranci1")) {} + Section(footer: Text("Running Sora 0.2.0 - cranci1")) {} } .navigationTitle("Settings") }