From 4f954b7c9cac2570df53525b900198733198cd73 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 12 Feb 2026 07:55:56 +0100 Subject: [PATCH] Add Enable All / Disable All menu to channel notifications settings --- Yattee/Localizable.xcstrings | 22 ++++++++++++++ .../Settings/NotificationSettingsView.swift | 30 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/Yattee/Localizable.xcstrings b/Yattee/Localizable.xcstrings index ad752fcc..b842b63e 100644 --- a/Yattee/Localizable.xcstrings +++ b/Yattee/Localizable.xcstrings @@ -11354,6 +11354,28 @@ } } }, + "settings.notifications.disableAll" : { + "comment" : "Button to disable notifications for all channels", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Disable All" + } + } + } + }, + "settings.notifications.enableAll" : { + "comment" : "Button to enable notifications for all channels", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Enable All" + } + } + } + }, "settings.notifications.noSubscriptions.description" : { "comment" : "Description when no subscriptions exist", "localizations" : { diff --git a/Yattee/Views/Settings/NotificationSettingsView.swift b/Yattee/Views/Settings/NotificationSettingsView.swift index cf3aa9b9..f0d98094 100644 --- a/Yattee/Views/Settings/NotificationSettingsView.swift +++ b/Yattee/Views/Settings/NotificationSettingsView.swift @@ -160,6 +160,7 @@ struct ManageChannelNotificationsView: View { @State private var subscriptions: [Subscription] = [] @State private var isLoading = false @State private var errorMessage: String? + @State private var refreshID = UUID() private var subscriptionService: SubscriptionService? { appEnvironment?.subscriptionService } @@ -194,17 +195,46 @@ struct ManageChannelNotificationsView: View { ForEach(subscriptions, id: \.channelID) { subscription in ChannelNotificationToggle(subscription: subscription) } + .id(refreshID) } } .navigationTitle(String(localized: "settings.notifications.manageChannels.title")) #if os(iOS) .navigationBarTitleDisplayMode(.inline) #endif + .toolbar { + if !subscriptions.isEmpty { + ToolbarItem(placement: .primaryAction) { + Menu { + Button { + setAllNotifications(enabled: true) + } label: { + Label(String(localized: "settings.notifications.enableAll"), systemImage: "bell.fill") + } + Button { + setAllNotifications(enabled: false) + } label: { + Label(String(localized: "settings.notifications.disableAll"), systemImage: "bell.slash") + } + } label: { + Image(systemName: "ellipsis.circle") + } + } + } + } .task { await loadSubscriptionsAsync() } } + private func setAllNotifications(enabled: Bool) { + guard let dataManager = appEnvironment?.dataManager else { return } + for subscription in subscriptions { + dataManager.setNotificationsEnabled(enabled, for: subscription.channelID) + } + refreshID = UUID() + } + /// Loads subscriptions from the current subscription account provider. /// For local accounts, loads from DataManager. /// For Invidious/Piped accounts, fetches from the respective API.