diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index dce1fdc19..dcf2439a5 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -18,6 +18,7 @@ struct AppDefaults { static let timelineGroupByFeed = "timelineGroupByFeed" static let timelineNumberOfLines = "timelineNumberOfLines" static let timelineSortDirection = "timelineSortDirection" + static let displayMarkAllAsReadUndoTip = "displayMarkAllAsReadUndoTip" static let refreshInterval = "refreshInterval" static let lastRefresh = "lastRefresh" } @@ -67,6 +68,15 @@ struct AppDefaults { } } + static var displayMarkAllAsReadUndoTip: Bool { + get { + return bool(for: Key.displayMarkAllAsReadUndoTip) + } + set { + setBool(for: Key.displayMarkAllAsReadUndoTip, newValue) + } + } + static var lastRefresh: Date? { get { return date(for: Key.lastRefresh) @@ -90,7 +100,8 @@ struct AppDefaults { Key.refreshInterval: RefreshInterval.everyHour.rawValue, Key.timelineGroupByFeed: false, Key.timelineNumberOfLines: 3, - Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue] + Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue, + Key.displayMarkAllAsReadUndoTip: true] AppDefaults.shared.register(defaults: defaults) } diff --git a/iOS/MasterFeed/MarkArticlesReadAlertController.swift b/iOS/MasterFeed/MarkArticlesReadAlertController.swift index 6e4f4a8a3..82d2b328b 100644 --- a/iOS/MasterFeed/MarkArticlesReadAlertController.swift +++ b/iOS/MasterFeed/MarkArticlesReadAlertController.swift @@ -12,13 +12,13 @@ import UIKit struct MarkArticlesReadAlertController { static func allArticlesAlert(handler: @escaping (UIAlertAction) -> Void) -> UIAlertController { - let message = NSLocalizedString("Mark all articles in all accounts as read?", + let message = NSLocalizedString("Mark all articles in all accounts as read? You can undo this action with a three finger swipe to the right.", comment: "Mark all articles") return markAllReadAlert(message: message, handler: handler) } static func timelineArticlesAlert(handler: @escaping (UIAlertAction) -> Void) -> UIAlertController { - let message = NSLocalizedString("Mark all articles in this timeline as read?", + let message = NSLocalizedString("Mark all articles in this timeline as read? You can undo this action with a three finger swipe to the right.", comment: "Mark all articles") return markAllReadAlert(message: message, handler: handler) } diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index ef4f48736..6fbf9c830 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -344,8 +344,9 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { } @IBAction func markAllAsRead(_ sender: Any) { - if coordinator.shouldDisplayMarkAllAsReadUndoTip { + if coordinator.displayMarkAllAsReadUndoTip { let alertController = MarkArticlesReadAlertController.allArticlesAlert { [weak self] _ in + self?.coordinator.displayMarkAllAsReadUndoTip = false self?.coordinator.markAllAsRead() } diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 52d80e7f1..862e8da18 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -89,8 +89,9 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner // MARK: Actions @IBAction func markAllAsRead(_ sender: Any) { - if coordinator.shouldDisplayMarkAllAsReadUndoTip { + if coordinator.displayMarkAllAsReadUndoTip { let alertController = MarkArticlesReadAlertController.timelineArticlesAlert { [weak self] _ in + self?.coordinator.displayMarkAllAsReadUndoTip = false self?.coordinator.markAllAsReadInTimeline() } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 3d1468d85..50d8c6bd7 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -83,7 +83,10 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { } } - private(set) var shouldDisplayMarkAllAsReadUndoTip = true + var displayMarkAllAsReadUndoTip: Bool { + get { AppDefaults.displayMarkAllAsReadUndoTip } + set { AppDefaults.displayMarkAllAsReadUndoTip = newValue } + } private let treeControllerDelegate = FeedTreeControllerDelegate() private lazy var treeController: TreeController = {