Added a flag to suppress mark all as read warning alert
This commit is contained in:
parent
6f0c957731
commit
461c681a9d
@ -404,6 +404,7 @@
|
|||||||
FF3ABF13232599810074C542 /* ArticleSorterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF09232599450074C542 /* ArticleSorterTests.swift */; };
|
FF3ABF13232599810074C542 /* ArticleSorterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF09232599450074C542 /* ArticleSorterTests.swift */; };
|
||||||
FF3ABF1523259DDB0074C542 /* ArticleSorter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */; };
|
FF3ABF1523259DDB0074C542 /* ArticleSorter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */; };
|
||||||
FF3ABF162325AF5D0074C542 /* ArticleSorter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */; };
|
FF3ABF162325AF5D0074C542 /* ArticleSorter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */; };
|
||||||
|
FFD43E412340F488009E5CA3 /* MarkArticlesReadAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD43E372340F320009E5CA3 /* MarkArticlesReadAlertController.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -1034,6 +1035,7 @@
|
|||||||
DF999FF622B5AEFA0064B687 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = "<group>"; };
|
DF999FF622B5AEFA0064B687 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = "<group>"; };
|
||||||
FF3ABF09232599450074C542 /* ArticleSorterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorterTests.swift; sourceTree = "<group>"; };
|
FF3ABF09232599450074C542 /* ArticleSorterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorterTests.swift; sourceTree = "<group>"; };
|
||||||
FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorter.swift; sourceTree = "<group>"; };
|
FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorter.swift; sourceTree = "<group>"; };
|
||||||
|
FFD43E372340F320009E5CA3 /* MarkArticlesReadAlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkArticlesReadAlertController.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -1278,6 +1280,7 @@
|
|||||||
51C4525D226508F600C03939 /* MasterFeed */ = {
|
51C4525D226508F600C03939 /* MasterFeed */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
FFD43E372340F320009E5CA3 /* MarkArticlesReadAlertController.swift */,
|
||||||
51C45264226508F600C03939 /* MasterFeedViewController.swift */,
|
51C45264226508F600C03939 /* MasterFeedViewController.swift */,
|
||||||
51CC9B3D231720B2000E842F /* MasterFeedDataSource.swift */,
|
51CC9B3D231720B2000E842F /* MasterFeedDataSource.swift */,
|
||||||
51C45260226508F600C03939 /* Cell */,
|
51C45260226508F600C03939 /* Cell */,
|
||||||
@ -2810,6 +2813,7 @@
|
|||||||
51C4529F22650A1900C03939 /* AuthorAvatarDownloader.swift in Sources */,
|
51C4529F22650A1900C03939 /* AuthorAvatarDownloader.swift in Sources */,
|
||||||
519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */,
|
519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */,
|
||||||
51CC9B3E231720B2000E842F /* MasterFeedDataSource.swift in Sources */,
|
51CC9B3E231720B2000E842F /* MasterFeedDataSource.swift in Sources */,
|
||||||
|
FFD43E412340F488009E5CA3 /* MarkArticlesReadAlertController.swift in Sources */,
|
||||||
51C452A322650A1E00C03939 /* HTMLMetadataDownloader.swift in Sources */,
|
51C452A322650A1E00C03939 /* HTMLMetadataDownloader.swift in Sources */,
|
||||||
51C4528D2265095F00C03939 /* AddFolderViewController.swift in Sources */,
|
51C4528D2265095F00C03939 /* AddFolderViewController.swift in Sources */,
|
||||||
51C452782265091600C03939 /* MasterTimelineCellData.swift in Sources */,
|
51C452782265091600C03939 /* MasterTimelineCellData.swift in Sources */,
|
||||||
|
44
iOS/MasterFeed/MarkArticlesReadAlertController.swift
Normal file
44
iOS/MasterFeed/MarkArticlesReadAlertController.swift
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
//
|
||||||
|
// MarkArticlesReadAlertControllerr.swift
|
||||||
|
// NetNewsWire
|
||||||
|
//
|
||||||
|
// Created by Phil Viso on 9/29/19.
|
||||||
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
struct MarkArticlesReadAlertController {
|
||||||
|
|
||||||
|
static func allArticlesAlert(handler: @escaping (UIAlertAction) -> Void) -> UIAlertController {
|
||||||
|
let message = NSLocalizedString("Mark all articles in all accounts as read?",
|
||||||
|
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?",
|
||||||
|
comment: "Mark all articles")
|
||||||
|
return markAllReadAlert(message: message, handler: handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: -
|
||||||
|
|
||||||
|
private static func markAllReadAlert(message: String,
|
||||||
|
handler: @escaping (UIAlertAction) -> Void) -> UIAlertController {
|
||||||
|
let title = NSLocalizedString("Mark All Read", comment: "Mark All Read")
|
||||||
|
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
||||||
|
let markTitle = NSLocalizedString("Mark All Read", comment: "Mark All Read")
|
||||||
|
|
||||||
|
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||||
|
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
||||||
|
let markAction = UIAlertAction(title: markTitle, style: .default, handler: handler)
|
||||||
|
|
||||||
|
alertController.addAction(cancelAction)
|
||||||
|
alertController.addAction(markAction)
|
||||||
|
|
||||||
|
return alertController
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -344,24 +344,15 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func markAllAsRead(_ sender: Any) {
|
@IBAction func markAllAsRead(_ sender: Any) {
|
||||||
|
if coordinator.shouldDisplayMarkAllAsReadUndoTip {
|
||||||
|
let alertController = MarkArticlesReadAlertController.allArticlesAlert { [weak self] _ in
|
||||||
|
self?.coordinator.markAllAsRead()
|
||||||
|
}
|
||||||
|
|
||||||
let title = NSLocalizedString("Mark All Read", comment: "Mark All Read")
|
present(alertController, animated: true)
|
||||||
let message = NSLocalizedString("Mark all articles in all accounts as read?", comment: "Mark all articles")
|
} else {
|
||||||
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
coordinator.markAllAsRead()
|
||||||
|
|
||||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
|
||||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
|
||||||
alertController.addAction(cancelAction)
|
|
||||||
|
|
||||||
let markTitle = NSLocalizedString("Mark All Read", comment: "Mark All Read")
|
|
||||||
let markAction = UIAlertAction(title: markTitle, style: .default) { [weak self] (action) in
|
|
||||||
self?.coordinator.markAllAsRead()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alertController.addAction(markAction)
|
|
||||||
|
|
||||||
present(alertController, animated: true)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func add(_ sender: UIBarButtonItem) {
|
@IBAction func add(_ sender: UIBarButtonItem) {
|
||||||
|
@ -89,24 +89,15 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||||||
// MARK: Actions
|
// MARK: Actions
|
||||||
|
|
||||||
@IBAction func markAllAsRead(_ sender: Any) {
|
@IBAction func markAllAsRead(_ sender: Any) {
|
||||||
|
if coordinator.shouldDisplayMarkAllAsReadUndoTip {
|
||||||
|
let alertController = MarkArticlesReadAlertController.timelineArticlesAlert { [weak self] _ in
|
||||||
|
self?.coordinator.markAllAsReadInTimeline()
|
||||||
|
}
|
||||||
|
|
||||||
let title = NSLocalizedString("Mark All Read", comment: "Mark All Read")
|
present(alertController, animated: true)
|
||||||
let message = NSLocalizedString("Mark all articles in this timeline as read?", comment: "Mark all articles")
|
} else {
|
||||||
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
coordinator.markAllAsReadInTimeline()
|
||||||
|
|
||||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
|
||||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
|
||||||
alertController.addAction(cancelAction)
|
|
||||||
|
|
||||||
let markTitle = NSLocalizedString("Mark All Read", comment: "Mark All Read")
|
|
||||||
let markAction = UIAlertAction(title: markTitle, style: .default) { [weak self] (action) in
|
|
||||||
self?.coordinator.markAllAsReadInTimeline()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alertController.addAction(markAction)
|
|
||||||
|
|
||||||
present(alertController, animated: true)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func firstUnread(_ sender: Any) {
|
@IBAction func firstUnread(_ sender: Any) {
|
||||||
|
@ -83,6 +83,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private(set) var shouldDisplayMarkAllAsReadUndoTip = true
|
||||||
|
|
||||||
private let treeControllerDelegate = FeedTreeControllerDelegate()
|
private let treeControllerDelegate = FeedTreeControllerDelegate()
|
||||||
private lazy var treeController: TreeController = {
|
private lazy var treeController: TreeController = {
|
||||||
return TreeController(delegate: treeControllerDelegate)
|
return TreeController(delegate: treeControllerDelegate)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user