fixed toggles + no episode data fetch

This commit is contained in:
cranci1 2025-02-20 16:27:53 +01:00
parent 63cd8e0b5a
commit eec9b380dd
3 changed files with 11 additions and 2 deletions

View file

@ -74,6 +74,7 @@ struct EpisodeCell: View {
CircularProgressBar(progress: currentProgress) CircularProgressBar(progress: currentProgress)
.frame(width: 40, height: 40) .frame(width: 40, height: 40)
} }
.contentShape(Rectangle())
.contextMenu { .contextMenu {
if currentProgress <= 0.9 { if currentProgress <= 0.9 {
Button(action: markAsWatched) { Button(action: markAsWatched) {
@ -88,7 +89,10 @@ struct EpisodeCell: View {
} }
} }
.onAppear { .onAppear {
fetchEpisodeDetails() if UserDefaults.standard.object(forKey: "fetchEpisodeMetadata") == nil ||
UserDefaults.standard.bool(forKey: "fetchEpisodeMetadata") {
fetchEpisodeDetails()
}
updateProgress() updateProgress()
} }
.onTapGesture { .onTapGesture {

View file

@ -10,6 +10,7 @@ import SwiftUI
struct SettingsViewGeneral: View { struct SettingsViewGeneral: View {
@AppStorage("episodeChunkSize") private var episodeChunkSize: Int = 100 @AppStorage("episodeChunkSize") private var episodeChunkSize: Int = 100
@AppStorage("refreshModulesOnLaunch") private var refreshModulesOnLaunch: Bool = false @AppStorage("refreshModulesOnLaunch") private var refreshModulesOnLaunch: Bool = false
@AppStorage("fetchEpisodeMetadata") private var fetchEpisodeMetadata: Bool = true
@EnvironmentObject var settings: Settings @EnvironmentObject var settings: Settings
var body: some View { var body: some View {
@ -27,7 +28,7 @@ struct SettingsViewGeneral: View {
} }
} }
Section(header: Text("Media View"), footer: Text("The episode range controls how many episodes appear on each page. Episodes are grouped into sets (like 1-25, 26-50, and so on), allowing you to navigate through them more easily.")) { Section(header: Text("Media View"), footer: Text("The episode range controls how many episodes appear on each page. Episodes are grouped into sets (like 1-25, 26-50, and so on), allowing you to navigate through them more easily.\n\nFor episode metadata it is refering to the episode thumbnail and title, since sometimes it can contain spoilers.")) {
HStack { HStack {
Text("Episodes Range") Text("Episodes Range")
Spacer() Spacer()
@ -48,10 +49,13 @@ struct SettingsViewGeneral: View {
Text("\(episodeChunkSize)") Text("\(episodeChunkSize)")
} }
} }
Toggle("Fetch Episode metadata", isOn: $fetchEpisodeMetadata)
.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.")) { 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) Toggle("Refresh Modules on Launch", isOn: $refreshModulesOnLaunch)
.tint(.accentColor)
} }
} }
.navigationTitle("General") .navigationTitle("General")

View file

@ -78,6 +78,7 @@ struct SettingsViewLoggerFilter: View {
ForEach($viewModel.filters) { $filter in ForEach($viewModel.filters) { $filter in
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 0) {
Toggle(filter.type, isOn: $filter.isEnabled) Toggle(filter.type, isOn: $filter.isEnabled)
.tint(.accentColor)
} }
} }
} }