diff --git a/Model/SponsorBlock/SponsorBlockAPI.swift b/Model/SponsorBlock/SponsorBlockAPI.swift index 53adace9..aafe1e15 100644 --- a/Model/SponsorBlock/SponsorBlockAPI.swift +++ b/Model/SponsorBlock/SponsorBlockAPI.swift @@ -20,13 +20,47 @@ final class SponsorBlockAPI: ObservableObject { switch name { case "selfpromo": return "Self-promotion" + case "music_offtopic": return "Offtopic in Music Videos" + default: return name.capitalized } } + static func categoryDetails(_ name: String) -> String? { + guard SponsorBlockAPI.categories.contains(name) else { + return nil + } + + switch name { + case "sponsor": + return "Part of a video promoting a product or service not directly related to the creator. " + + "The creator will receive payment or compensation in the form of money or free products." + + case "selfpromo": + return "Promoting a product or service that is directly related to the creator themselves. " + + "This usually includes merchandise or promotion of monetized platforms." + + case "intro": + return "Segments typically found at the start of a video that include an animation, " + + "still frame or clip which are also seen in other videos by the same creator." + + case "outro": + return "Typically near or at the end of the video when the credits pop up and/or endcards are shown." + + case "interaction": + return "Explicit reminders to like, subscribe or interact with them on any paid or free platform(s) (e.g. click on a video)." + + case "music_offtopic": + return "For videos which feature music as the primary content." + + default: + return nil + } + } + func loadSegments(videoID: String, categories: Set, completionHandler: @escaping () -> Void = {}) { guard !skipSegmentsURL.isNil, self.videoID != videoID else { completionHandler() diff --git a/Shared/Settings/SettingsView.swift b/Shared/Settings/SettingsView.swift index b353b9fb..5a792192 100644 --- a/Shared/Settings/SettingsView.swift +++ b/Shared/Settings/SettingsView.swift @@ -183,7 +183,7 @@ struct SettingsView: View { case .history: return 480 case .sponsorBlock: - return 290 + return 660 case .updates: return 200 case .help: diff --git a/Shared/Settings/SponsorBlockSettings.swift b/Shared/Settings/SponsorBlockSettings.swift index c9b559fc..bff9e665 100644 --- a/Shared/Settings/SponsorBlockSettings.swift +++ b/Shared/Settings/SponsorBlockSettings.swift @@ -39,7 +39,7 @@ struct SponsorBlockSettings: View { #endif } - Section(header: SettingsHeader(text: "Categories to Skip")) { + Section(header: SettingsHeader(text: "Categories to Skip"), footer: categoriesDetails) { #if os(macOS) let list = ForEach(SponsorBlockAPI.categories, id: \.self) { category in SponsorBlockCategorySelectionRow( @@ -74,6 +74,24 @@ struct SponsorBlockSettings: View { } } + private var categoriesDetails: some View { + VStack(alignment: .leading) { + ForEach(SponsorBlockAPI.categories, id: \.self) { category in + Text(SponsorBlockAPI.categoryDescription(category) ?? "Category") + .fontWeight(.bold) + #if os(tvOS) + .focusable() + #endif + + Text(SponsorBlockAPI.categoryDetails(category) ?? "Details") + .padding(.bottom, 3) + .fixedSize(horizontal: false, vertical: true) + } + } + .foregroundColor(.secondary) + .padding(.top, 3) + } + func toggleCategory(_ category: String, value: Bool) { if let index = sponsorBlockCategories.firstIndex(where: { $0 == category }), !value { sponsorBlockCategories.remove(at: index) @@ -123,7 +141,7 @@ struct SponsorBlockSettings: View { } } -struct ServicesSettings_Previews: PreviewProvider { +struct SponsorBlockSettings_Previews: PreviewProvider { static var previews: some View { VStack { SponsorBlockSettings()