mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Implemented Mark All as Read for the master list.
This commit is contained in:
@@ -93,6 +93,7 @@
|
||||
51C452B1226510E600C03939 /* InitialFeedDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97A01ED9F180007D329B /* InitialFeedDownloader.swift */; };
|
||||
51C452B42265141B00C03939 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51C452B32265141B00C03939 /* WebKit.framework */; };
|
||||
51C452B82265178500C03939 /* styleSheet.css in Resources */ = {isa = PBXBuildFile; fileRef = 51C452B72265178500C03939 /* styleSheet.css */; };
|
||||
51D5948722668EFA00DFC836 /* MarkStatusCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84702AA31FA27AC0006B8943 /* MarkStatusCommand.swift */; };
|
||||
51EC114C2149FE3300B296E3 /* FolderTreeMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51EC114B2149FE3300B296E3 /* FolderTreeMenu.swift */; };
|
||||
6581C73820CED60100F4AD34 /* SafariExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6581C73720CED60100F4AD34 /* SafariExtensionHandler.swift */; };
|
||||
6581C73A20CED60100F4AD34 /* SafariExtensionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6581C73920CED60100F4AD34 /* SafariExtensionViewController.swift */; };
|
||||
@@ -2135,6 +2136,7 @@
|
||||
51C452772265091600C03939 /* MultilineUILabelSizer.swift in Sources */,
|
||||
51C452A522650A2D00C03939 /* SmallIconProvider.swift in Sources */,
|
||||
51C452A122650A1900C03939 /* FeaturedImageDownloader.swift in Sources */,
|
||||
51D5948722668EFA00DFC836 /* MarkStatusCommand.swift in Sources */,
|
||||
51C4525C226508DF00C03939 /* String-Extensions.swift in Sources */,
|
||||
51C452792265091600C03939 /* MasterTimelineTableViewCell.swift in Sources */,
|
||||
51C452852265093600C03939 /* AddFeedFolderPickerData.swift in Sources */,
|
||||
|
||||
@@ -13,11 +13,15 @@
|
||||
<!--Master-->
|
||||
<scene sceneID="pY4-Hu-kfo">
|
||||
<objects>
|
||||
<navigationController storyboardIdentifier="MasterPrimaryNavigationViewController" title="Master" useStoryboardIdentifierAsRestorationIdentifier="YES" id="RMx-3f-FxP" sceneMemberID="viewController">
|
||||
<navigationController storyboardIdentifier="MasterPrimaryNavigationViewController" title="Master" useStoryboardIdentifierAsRestorationIdentifier="YES" toolbarHidden="NO" id="RMx-3f-FxP" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" largeTitles="YES" id="Pmd-2v-anx">
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="96"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<toolbar key="toolbar" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="cwK-Lq-cXA">
|
||||
<rect key="frame" x="0.0" y="813" width="414" height="49"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</toolbar>
|
||||
<connections>
|
||||
<segue destination="7bK-jq-Zjz" kind="relationship" relationship="rootViewController" id="tsl-Nk-0bq"/>
|
||||
</connections>
|
||||
@@ -115,13 +119,15 @@
|
||||
<outlet property="delegate" destination="Kyk-vK-QRX" id="rH3-5N-a6z"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Timeline" id="wcC-1L-ug4">
|
||||
<barButtonItem key="rightBarButtonItem" image="threeCirclesImage" id="qD2-64-fyX">
|
||||
<toolbarItems>
|
||||
<barButtonItem title="Mark All as Read" id="fTv-eX-72r">
|
||||
<connections>
|
||||
<action selector="markAllAsRead:" destination="Kyk-vK-QRX" id="Irh-YU-8GS"/>
|
||||
<action selector="markAllAsRead:" destination="Kyk-vK-QRX" id="4nd-Gg-APm"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</toolbarItems>
|
||||
<navigationItem key="navigationItem" title="Timeline" id="wcC-1L-ug4"/>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="nzm-Gf-Xce" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
@@ -130,11 +136,15 @@
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="uQv-y4-hI4">
|
||||
<objects>
|
||||
<navigationController storyboardIdentifier="MasterTimelineNavigationViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="vHh-eJ-Wug" sceneMemberID="viewController">
|
||||
<navigationController storyboardIdentifier="MasterTimelineNavigationViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" toolbarHidden="NO" id="vHh-eJ-Wug" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="Df0-za-Olh">
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="96"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<toolbar key="toolbar" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Tqe-Na-Jew">
|
||||
<rect key="frame" x="0.0" y="813" width="414" height="49"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</toolbar>
|
||||
<connections>
|
||||
<segue destination="Kyk-vK-QRX" kind="relationship" relationship="rootViewController" id="g8t-I4-iBe"/>
|
||||
</connections>
|
||||
@@ -181,18 +191,27 @@
|
||||
<outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Home" id="Zdf-7t-Un8">
|
||||
<toolbarItems>
|
||||
<barButtonItem title="Mark All as Read" id="ddj-Ya-Wol">
|
||||
<connections>
|
||||
<action selector="markAllAsRead:" destination="7bK-jq-Zjz" id="jmv-SM-7XE"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<barButtonItem style="plain" systemItem="flexibleSpace" id="ePD-cM-h2y"/>
|
||||
<barButtonItem systemItem="add" id="yo6-w4-SfI">
|
||||
<connections>
|
||||
<action selector="add:" destination="7bK-jq-Zjz" id="k61-ub-SdZ"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</toolbarItems>
|
||||
<navigationItem key="navigationItem" title="Feeds" id="Zdf-7t-Un8">
|
||||
<barButtonItem key="leftBarButtonItem" title="Tools" image="toolsImage" id="2lM-3y-hKs">
|
||||
<connections>
|
||||
<action selector="showOPMLImportExport:" destination="7bK-jq-Zjz" id="qIa-yP-E6a"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="add" id="yo6-w4-SfI">
|
||||
<connections>
|
||||
<action selector="add:" destination="7bK-jq-Zjz" id="k61-ub-SdZ"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
@@ -264,10 +283,9 @@
|
||||
<image name="browserImage" width="20" height="20"/>
|
||||
<image name="circleOpenImage" width="20" height="20"/>
|
||||
<image name="starOpenImage" width="18" height="18"/>
|
||||
<image name="threeCirclesImage" width="20" height="20"/>
|
||||
<image name="toolsImage" width="20" height="18"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="FRG-EO-hQw"/>
|
||||
<segue reference="RT3-gH-cyN"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
|
||||
import UIKit
|
||||
import Account
|
||||
import Articles
|
||||
import RSCore
|
||||
import RSTree
|
||||
|
||||
class MasterViewController: UITableViewController {
|
||||
class MasterViewController: UITableViewController, UndoableCommandRunner {
|
||||
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
var animatingChanges = false
|
||||
|
||||
let treeControllerDelegate = MasterTreeControllerDelegate()
|
||||
@@ -20,6 +22,10 @@ class MasterViewController: UITableViewController {
|
||||
return TreeController(delegate: treeControllerDelegate)
|
||||
}()
|
||||
|
||||
override var canBecomeFirstResponder: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
super.viewDidLoad()
|
||||
@@ -42,7 +48,17 @@ class MasterViewController: UITableViewController {
|
||||
clearsSelectionOnViewWillAppear = splitViewController!.isCollapsed
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
becomeFirstResponder()
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
resignFirstResponder()
|
||||
}
|
||||
|
||||
@objc private func refreshAccounts(_ sender: Any) {
|
||||
AccountManager.shared.refreshAll()
|
||||
}
|
||||
@@ -175,6 +191,40 @@ class MasterViewController: UITableViewController {
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
@IBAction func markAllAsRead(_ sender: Any) {
|
||||
|
||||
let title = NSLocalizedString("Mark All Read", comment: "Mark All Read")
|
||||
let message = NSLocalizedString("Mark all articles in all accounts as read?", comment: "Mark all articles")
|
||||
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||
|
||||
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
|
||||
|
||||
let accounts = AccountManager.shared.accounts
|
||||
var articles = Set<Article>()
|
||||
accounts.forEach { account in
|
||||
articles.formUnion(account.fetchUnreadArticles())
|
||||
}
|
||||
|
||||
guard let undoManager = self?.undoManager,
|
||||
let markReadCommand = MarkStatusCommand(initialArticles: Array(articles), markingRead: true, undoManager: undoManager) else {
|
||||
return
|
||||
}
|
||||
|
||||
self?.runCommand(markReadCommand)
|
||||
|
||||
}
|
||||
|
||||
alertController.addAction(markAction)
|
||||
|
||||
present(alertController, animated: true)
|
||||
|
||||
}
|
||||
|
||||
@IBAction func add(_ sender: UIBarButtonItem) {
|
||||
let feedViewController = UIStoryboard.add.instantiateInitialViewController()!
|
||||
feedViewController.modalPresentationStyle = .popover
|
||||
|
||||
Reference in New Issue
Block a user