From 80075d1dc37fb3dffdbd53959a109ce6466adee9 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 22 Nov 2026 15:39:48 -0800 Subject: [PATCH] =?UTF-8?q?Simplify=20the=20confirmation=20for=20mark-all-?= =?UTF-8?q?as-read=20=E2=80=94=20drop=20the=20link=20to=20Settings.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shared/Localizable.xcstrings | 6 ------ .../MainFeedCollectionViewController.swift | 8 ++++---- .../MainTimelineViewController.swift | 16 +++++++-------- .../MarkAsReadAlertController.swift | 20 ++++--------------- iOS/RootSplitViewController.swift | 4 ++-- iOS/SceneCoordinator.swift | 4 ++-- iOS/Settings/SettingsView.swift | 9 --------- 7 files changed, 20 insertions(+), 47 deletions(-) diff --git a/Shared/Localizable.xcstrings b/Shared/Localizable.xcstrings index 711de5096..9b71755af 100644 --- a/Shared/Localizable.xcstrings +++ b/Shared/Localizable.xcstrings @@ -896,9 +896,6 @@ "Mark as Read" : { "comment" : "Command" }, - "Mark As Read" : { - "comment" : "Mark As Read" - }, "Mark as Starred" : { "comment" : "Command" }, @@ -1794,9 +1791,6 @@ "You can enable NetNewsWire notifications in System Preferences." : { "comment" : "Notifications are not enabled." }, - "You can turn this confirmation off in Settings." : { - "comment" : "You can turn this confirmation off in Settings." - }, "You must have at least one active account." : { "comment" : "Missing active account" }, diff --git a/iOS/MainFeed/MainFeedCollectionViewController.swift b/iOS/MainFeed/MainFeedCollectionViewController.swift index 3b6c993f5..732b14b26 100644 --- a/iOS/MainFeed/MainFeedCollectionViewController.swift +++ b/iOS/MainFeed/MainFeedCollectionViewController.swift @@ -629,7 +629,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab let title = NSLocalizedString("Mark All as Read", comment: "Command") let articlesToMark = coordinator.articles - MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView) { [weak self] in self?.coordinator.markAsReadAndShowSidebar(articlesToMark) } } @@ -1309,7 +1309,7 @@ extension MainFeedCollectionViewController { } let action = UIAlertAction(title: title, style: .default) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in self?.coordinator.markAllAsRead(Array(articles), in: feed) completion(true) } @@ -1393,7 +1393,7 @@ extension MainFeedCollectionViewController { let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command") let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, sidebarItem.nameForDisplay) as String let action = UIAction(title: title, image: Assets.Images.markAllAsRead) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView) { [weak self] in let articles = sidebarItem.fetchUnreadArticles() self?.coordinator.markAllAsRead(Array(articles), in: sidebarItem) } @@ -1410,7 +1410,7 @@ extension MainFeedCollectionViewController { let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command") let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, account.nameForDisplay) as String let action = UIAction(title: title, image: Assets.Images.markAllAsRead) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView) { [weak self] in // If you don’t have this delay the screen flashes when it executes this code DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { let articles = account.fetchArticles(.unread()) diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index 4870830ec..342f4a4c8 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -536,7 +536,7 @@ final class MainTimelineViewController: UIViewController, UndoableCommandRunner let articlesToMark = coordinator.articles if let source = sender as? UIBarButtonItem { - MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: source) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: source) { [weak self] in self?.coordinator?.markAsReadAndShowSidebar(articlesToMark) } } @@ -549,7 +549,7 @@ final class MainTimelineViewController: UIViewController, UndoableCommandRunner return } - MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView) { [weak self] in self?.coordinator?.markAsReadAndShowSidebar(articlesToMark) } } @@ -1405,7 +1405,7 @@ extension MainTimelineViewController { let title = NSLocalizedString("Mark Above as Read", comment: "Command") let image = Assets.Images.markAboveAsRead let action = UIAction(title: title, image: image) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView) { [weak self] in self?.markAboveAsRead(article) } } @@ -1430,7 +1430,7 @@ extension MainTimelineViewController { let title = NSLocalizedString("Mark Below as Read", comment: "Command") let image = Assets.Images.markBelowAsRead let action = UIAction(title: title, image: image) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView) { [weak self] in self?.markBelowAsRead(article) } } @@ -1448,7 +1448,7 @@ extension MainTimelineViewController { } let action = UIAlertAction(title: title, style: .default) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in self?.markAboveAsRead(article) completion(true) } @@ -1467,7 +1467,7 @@ extension MainTimelineViewController { } let action = UIAlertAction(title: title, style: .default) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in self?.markBelowAsRead(article) completion(true) } @@ -1528,7 +1528,7 @@ extension MainTimelineViewController { let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String let action = UIAction(title: title, image: Assets.Images.markAllAsRead) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView) { [weak self] in self?.markAllAsRead(articles) } } @@ -1553,7 +1553,7 @@ extension MainTimelineViewController { } let action = UIAlertAction(title: title, style: .default) { [weak self] _ in - MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in self?.markAllAsRead(articles) completion(true) } diff --git a/iOS/MainTimeline/MarkAsReadAlertController.swift b/iOS/MainTimeline/MarkAsReadAlertController.swift index a286762a6..7a791ce1e 100644 --- a/iOS/MainTimeline/MarkAsReadAlertController.swift +++ b/iOS/MainTimeline/MarkAsReadAlertController.swift @@ -17,19 +17,18 @@ extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {} @MainActor struct MarkAsReadAlertController { static func confirm(_ controller: UIViewController?, - coordinator: SceneCoordinator?, confirmTitle: String, sourceType: T, cancelCompletion: (() -> Void)? = nil, completion: @escaping () -> Void) where T: MarkAsReadAlertControllerSourceType { - guard let controller, let coordinator else { + guard let controller else { completion() return } if AppDefaults.confirmMarkAllAsRead { - let alertController = MarkAsReadAlertController.alert(coordinator: coordinator, confirmTitle: confirmTitle, cancelCompletion: cancelCompletion, sourceType: sourceType) { _ in + let alertController = MarkAsReadAlertController.alert(confirmTitle: confirmTitle, cancelCompletion: cancelCompletion, sourceType: sourceType) { _ in completion() } controller.present(alertController, animated: true) @@ -38,31 +37,20 @@ extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {} } } - private static func alert(coordinator: SceneCoordinator, - confirmTitle: String, + private static func alert(confirmTitle: String, cancelCompletion: (() -> Void)?, sourceType: T, completion: @escaping (UIAlertAction) -> Void) -> UIAlertController where T: MarkAsReadAlertControllerSourceType { - let title = NSLocalizedString("Mark As Read", comment: "Mark As Read") - let message = NSLocalizedString("You can turn this confirmation off in Settings.", - comment: "You can turn this confirmation off in Settings.") let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button") - let settingsTitle = NSLocalizedString("Open Settings", comment: "Open Settings button") - let alertController = UIAlertController(title: title, message: message, preferredStyle: .actionSheet) + let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel) { _ in cancelCompletion?() } - let settingsAction = UIAlertAction(title: settingsTitle, style: .default) { _ in - Task { @MainActor in - coordinator.showSettings(showTimelineSettings: true) - } - } let markAction = UIAlertAction(title: confirmTitle, style: .default, handler: completion) alertController.addAction(markAction) - alertController.addAction(settingsAction) alertController.addAction(cancelAction) if let barButtonItem = sourceType as? UIBarButtonItem { diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 08ec5ff1b..952e9b2a3 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -116,9 +116,9 @@ final class RootSplitViewController: UISplitViewController { // Anchor to the Mark All as Read button (keyboard shortcut has no source view). // if let markAllAsReadButton = (viewController(for: .supplementary) as? MainTimelineViewController)?.markAllAsReadButton { - MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: markAllAsReadButton, completion: completion) + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: markAllAsReadButton, completion: completion) } else { - MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: view as UIView, completion: completion) + MarkAsReadAlertController.confirm(self, confirmTitle: title, sourceType: view as UIView, completion: completion) } } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 574fab784..71f3df1da 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1610,8 +1610,8 @@ struct SidebarItemNode: Hashable, Sendable { } } - func showSettings(showTimelineSettings: Bool = false) { - let settingsView = SettingsView(showTimelineSettings: showTimelineSettings, presentingParentController: rootSplitViewController) + func showSettings() { + let settingsView = SettingsView(presentingParentController: rootSplitViewController) let hostingController = UIHostingController(rootView: settingsView) hostingController.modalPresentationStyle = .formSheet rootSplitViewController.present(hostingController, animated: true) diff --git a/iOS/Settings/SettingsView.swift b/iOS/Settings/SettingsView.swift index a2d40ca66..a001de13d 100644 --- a/iOS/Settings/SettingsView.swift +++ b/iOS/Settings/SettingsView.swift @@ -13,8 +13,6 @@ import Account struct SettingsView: View { - /// Pushes the Timeline screen on appearing, so a user can turn off the Mark All as Read confirmation. - let showTimelineSettings: Bool /// Presents Settings, and presents what Settings hands off to after dismissing itself. let presentingParentController: RootSplitViewController? @@ -22,7 +20,6 @@ struct SettingsView: View { @Environment(\.openURL) private var openURL @State private var model = SettingsModel() @State private var path = [SettingsDestination]() - @State private var didShowTimelineSettings = false @State private var opmlAccount: Account? @State private var isShowingOPMLImporter = false @State private var opmlExportURL: URL? @@ -105,12 +102,6 @@ struct SettingsView: View { destinationView(destination) } } - .onAppear { - if showTimelineSettings && !didShowTimelineSettings { - didShowTimelineSettings = true - path.append(.timeline) - } - } .fileImporter(isPresented: $isShowingOPMLImporter, allowedContentTypes: Self.opmlContentTypes) { result in if case .success(let url) = result, let opmlAccount { importOPML(url, into: opmlAccount)