From 3f5c87c711960f819da9f8069f8f00b969997e0b Mon Sep 17 00:00:00 2001 From: Yonn Date: Thu, 25 Dec 2025 18:23:07 +0100 Subject: [PATCH 1/2] Add feature flag to disable downloads functionality - Introduced `FeatureFlags` enum with a static variable `disableDownloads` to control the visibility of downloads-related UI elements. - Updated `PersonalView` to conditionally display the downloads tab and its content based on the `disableDownloads` flag. - Modified `SettingsView` to conditionally show the download settings toggle and delete downloads button only when downloads are enabled. --- Zapp/Settings/disableDownloads.swift | 5 +++++ Zapp/Views/PersonalView.swift | 16 +++++++++++---- Zapp/Views/SettingsView.swift | 30 +++++++++++++++------------- 3 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 Zapp/Settings/disableDownloads.swift diff --git a/Zapp/Settings/disableDownloads.swift b/Zapp/Settings/disableDownloads.swift new file mode 100644 index 00000000..9e7f52ad --- /dev/null +++ b/Zapp/Settings/disableDownloads.swift @@ -0,0 +1,5 @@ +import Foundation + +enum FeatureFlags { + static var disableDownloads: Bool = true +} diff --git a/Zapp/Views/PersonalView.swift b/Zapp/Views/PersonalView.swift index dc6741c0..188c56d2 100644 --- a/Zapp/Views/PersonalView.swift +++ b/Zapp/Views/PersonalView.swift @@ -12,7 +12,9 @@ struct PersonalView: View { Picker("", selection: $selectedTab) { Text("personal_continue_watching").tag(0) Text("personal_bookmarks").tag(1) - Text("personal_downloads").tag(2) + if !FeatureFlags.disableDownloads { + Text("personal_downloads").tag(2) + } } .pickerStyle(SegmentedPickerStyle()) .padding(.horizontal, usesCenteredLayout ? 24 : 8) @@ -27,8 +29,10 @@ struct PersonalView: View { BookmarksListView() .tag(1) - DownloadsListView() - .tag(2) + if !FeatureFlags.disableDownloads { + DownloadsListView() + .tag(2) + } } .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) .padding(.horizontal, usesCenteredLayout ? 12 : 0) @@ -36,7 +40,11 @@ struct PersonalView: View { .frame(maxWidth: usesCenteredLayout ? 900 : .infinity) .frame(maxWidth: .infinity) .onReceive(NotificationCenter.default.publisher(for: .navigateToDownloadsTab)) { _ in - selectedTab = 2 + if !FeatureFlags.disableDownloads { + selectedTab = 2 + } else { + selectedTab = 1 + } } .navigationTitle(Text("tab_personal")) } diff --git a/Zapp/Views/SettingsView.swift b/Zapp/Views/SettingsView.swift index 1913c2e8..fdd793a0 100644 --- a/Zapp/Views/SettingsView.swift +++ b/Zapp/Views/SettingsView.swift @@ -116,22 +116,24 @@ struct SettingsView: View { private var storageSection: some View { Section(String(localized: "settings_storage_section")) { - Toggle(isOn: $settings.downloadOverWifiOnly) { - SettingsRowLabel( - title: String(localized: "settings_download_wifi_only_title"), - description: String(localized: "settings_download_wifi_only_description") - ) - } + if !FeatureFlags.disableDownloads { + Toggle(isOn: $settings.downloadOverWifiOnly) { + SettingsRowLabel( + title: String(localized: "settings_download_wifi_only_title"), + description: String(localized: "settings_download_wifi_only_description") + ) + } - Button(role: .destructive) { - pendingDestructiveAction = .deleteDownloads(count: repo.downloads.count) - } label: { - SettingsRowLabel( - title: String(localized: "settings_delete_downloads_title"), - description: downloadDeletionDescription - ) + Button(role: .destructive) { + pendingDestructiveAction = .deleteDownloads(count: repo.downloads.count) + } label: { + SettingsRowLabel( + title: String(localized: "settings_delete_downloads_title"), + description: downloadDeletionDescription + ) + } + .disabled(repo.downloads.isEmpty) } - .disabled(repo.downloads.isEmpty) Button(role: .destructive) { pendingDestructiveAction = .clearCache From fac8591c8a70c59d4f5d35c0d0175057a983e5d0 Mon Sep 17 00:00:00 2001 From: Yonn Date: Thu, 25 Dec 2025 18:27:14 +0100 Subject: [PATCH 2/2] Implement feature flag to conditionally enable downloads in MediathekDetailView --- Zapp/Views/MediathekDetailView.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Zapp/Views/MediathekDetailView.swift b/Zapp/Views/MediathekDetailView.swift index 42dd30e6..c3061bc3 100644 --- a/Zapp/Views/MediathekDetailView.swift +++ b/Zapp/Views/MediathekDetailView.swift @@ -76,17 +76,19 @@ struct MediathekDetailView: View { } .buttonStyle(.bordered) - Menu { - ForEach(show.supportedQualities, id: \.self) { quality in - Button(action: { startDownload(quality: quality) }) { - Label(quality.localizedName, systemImage: "arrow.down.circle") + if !FeatureFlags.disableDownloads { + Menu { + ForEach(show.supportedQualities, id: \.self) { quality in + Button(action: { startDownload(quality: quality) }) { + Label(quality.localizedName, systemImage: "arrow.down.circle") + } } + } label: { + Label("show_download", systemImage: "arrow.down.circle") + .frame(maxWidth: .infinity) } - } label: { - Label("show_download", systemImage: "arrow.down.circle") - .frame(maxWidth: .infinity) + .buttonStyle(.bordered) } - .buttonStyle(.bordered) } if let websiteUrl = show.websiteUrl {