Rename DetailViewController to ArticleViewController to fix name collision

This commit is contained in:
Maurice Parker 2019-09-24 04:29:15 -05:00
parent 3a8ec93644
commit 394618a687
6 changed files with 50 additions and 50 deletions

View File

@ -79,7 +79,7 @@
5170743A232AABFC00A461A3 /* FlattenedAccountFolderPickerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452812265093600C03939 /* FlattenedAccountFolderPickerData.swift */; }; 5170743A232AABFC00A461A3 /* FlattenedAccountFolderPickerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452812265093600C03939 /* FlattenedAccountFolderPickerData.swift */; };
517630042336215100E15FFF /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 517630032336215100E15FFF /* main.js */; }; 517630042336215100E15FFF /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 517630032336215100E15FFF /* main.js */; };
517630052336215100E15FFF /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 517630032336215100E15FFF /* main.js */; }; 517630052336215100E15FFF /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 517630032336215100E15FFF /* main.js */; };
517630232336657E00E15FFF /* DetailViewControllerWebViewProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517630222336657E00E15FFF /* DetailViewControllerWebViewProvider.swift */; }; 517630232336657E00E15FFF /* ArticleViewControllerWebViewProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517630222336657E00E15FFF /* ArticleViewControllerWebViewProvider.swift */; };
5183CCD0226E1E880010922C /* NonIntrinsicLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */; }; 5183CCD0226E1E880010922C /* NonIntrinsicLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */; };
5183CCDA226E31A50010922C /* NonIntrinsicImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */; }; 5183CCDA226E31A50010922C /* NonIntrinsicImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */; };
5183CCDD226F1F5C0010922C /* NavigationProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCDC226F1F5C0010922C /* NavigationProgressView.swift */; }; 5183CCDD226F1F5C0010922C /* NavigationProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCDC226F1F5C0010922C /* NavigationProgressView.swift */; };
@ -142,7 +142,7 @@
51C452792265091600C03939 /* MasterTimelineTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452722265091600C03939 /* MasterTimelineTableViewCell.swift */; }; 51C452792265091600C03939 /* MasterTimelineTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452722265091600C03939 /* MasterTimelineTableViewCell.swift */; };
51C4527B2265091600C03939 /* MasterUnreadIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452742265091600C03939 /* MasterUnreadIndicatorView.swift */; }; 51C4527B2265091600C03939 /* MasterUnreadIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452742265091600C03939 /* MasterUnreadIndicatorView.swift */; };
51C4527C2265091600C03939 /* MasterTimelineDefaultCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452752265091600C03939 /* MasterTimelineDefaultCellLayout.swift */; }; 51C4527C2265091600C03939 /* MasterTimelineDefaultCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452752265091600C03939 /* MasterTimelineDefaultCellLayout.swift */; };
51C4527F2265092C00C03939 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C4527E2265092C00C03939 /* DetailViewController.swift */; }; 51C4527F2265092C00C03939 /* ArticleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C4527E2265092C00C03939 /* ArticleViewController.swift */; };
51C452852265093600C03939 /* FlattenedAccountFolderPickerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452812265093600C03939 /* FlattenedAccountFolderPickerData.swift */; }; 51C452852265093600C03939 /* FlattenedAccountFolderPickerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452812265093600C03939 /* FlattenedAccountFolderPickerData.swift */; };
51C452862265093600C03939 /* Add.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51C452822265093600C03939 /* Add.storyboard */; }; 51C452862265093600C03939 /* Add.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51C452822265093600C03939 /* Add.storyboard */; };
51C452882265093600C03939 /* AddFeedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452842265093600C03939 /* AddFeedViewController.swift */; }; 51C452882265093600C03939 /* AddFeedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C452842265093600C03939 /* AddFeedViewController.swift */; };
@ -816,7 +816,7 @@
515D4FCE2325B3D000EE1167 /* NetNewsWire_iOSshareextension_target.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = NetNewsWire_iOSshareextension_target.xcconfig; sourceTree = "<group>"; }; 515D4FCE2325B3D000EE1167 /* NetNewsWire_iOSshareextension_target.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = NetNewsWire_iOSshareextension_target.xcconfig; sourceTree = "<group>"; };
51707438232AA97100A461A3 /* ShareFolderPickerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareFolderPickerController.swift; sourceTree = "<group>"; }; 51707438232AA97100A461A3 /* ShareFolderPickerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareFolderPickerController.swift; sourceTree = "<group>"; };
517630032336215100E15FFF /* main.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; }; 517630032336215100E15FFF /* main.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; };
517630222336657E00E15FFF /* DetailViewControllerWebViewProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewControllerWebViewProvider.swift; sourceTree = "<group>"; }; 517630222336657E00E15FFF /* ArticleViewControllerWebViewProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleViewControllerWebViewProvider.swift; sourceTree = "<group>"; };
5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicLabel.swift; sourceTree = "<group>"; }; 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicLabel.swift; sourceTree = "<group>"; };
5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicImageView.swift; sourceTree = "<group>"; }; 5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicImageView.swift; sourceTree = "<group>"; };
5183CCDC226F1F5C0010922C /* NavigationProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationProgressView.swift; sourceTree = "<group>"; }; 5183CCDC226F1F5C0010922C /* NavigationProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationProgressView.swift; sourceTree = "<group>"; };
@ -850,7 +850,7 @@
51C452722265091600C03939 /* MasterTimelineTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterTimelineTableViewCell.swift; sourceTree = "<group>"; }; 51C452722265091600C03939 /* MasterTimelineTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterTimelineTableViewCell.swift; sourceTree = "<group>"; };
51C452742265091600C03939 /* MasterUnreadIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterUnreadIndicatorView.swift; sourceTree = "<group>"; }; 51C452742265091600C03939 /* MasterUnreadIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterUnreadIndicatorView.swift; sourceTree = "<group>"; };
51C452752265091600C03939 /* MasterTimelineDefaultCellLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterTimelineDefaultCellLayout.swift; sourceTree = "<group>"; }; 51C452752265091600C03939 /* MasterTimelineDefaultCellLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterTimelineDefaultCellLayout.swift; sourceTree = "<group>"; };
51C4527E2265092C00C03939 /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; }; 51C4527E2265092C00C03939 /* ArticleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArticleViewController.swift; sourceTree = "<group>"; };
51C452812265093600C03939 /* FlattenedAccountFolderPickerData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlattenedAccountFolderPickerData.swift; sourceTree = "<group>"; }; 51C452812265093600C03939 /* FlattenedAccountFolderPickerData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlattenedAccountFolderPickerData.swift; sourceTree = "<group>"; };
51C452822265093600C03939 /* Add.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Add.storyboard; sourceTree = "<group>"; }; 51C452822265093600C03939 /* Add.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Add.storyboard; sourceTree = "<group>"; };
51C452842265093600C03939 /* AddFeedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddFeedViewController.swift; sourceTree = "<group>"; }; 51C452842265093600C03939 /* AddFeedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddFeedViewController.swift; sourceTree = "<group>"; };
@ -1372,13 +1372,13 @@
path = Cell; path = Cell;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
51C4527D2265092C00C03939 /* Detail */ = { 51C4527D2265092C00C03939 /* Article */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
51C4527E2265092C00C03939 /* DetailViewController.swift */, 51C4527E2265092C00C03939 /* ArticleViewController.swift */,
517630222336657E00E15FFF /* DetailViewControllerWebViewProvider.swift */, 517630222336657E00E15FFF /* ArticleViewControllerWebViewProvider.swift */,
); );
path = Detail; path = Article;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
51C452802265093600C03939 /* Add */ = { 51C452802265093600C03939 /* Add */ = {
@ -1959,7 +1959,7 @@
51BB7C262335A8E5008E8144 /* ArticleActivityItemSource.swift */, 51BB7C262335A8E5008E8144 /* ArticleActivityItemSource.swift */,
51C4525D226508F600C03939 /* MasterFeed */, 51C4525D226508F600C03939 /* MasterFeed */,
51C4526D2265091600C03939 /* MasterTimeline */, 51C4526D2265091600C03939 /* MasterTimeline */,
51C4527D2265092C00C03939 /* Detail */, 51C4527D2265092C00C03939 /* Article */,
51C452802265093600C03939 /* Add */, 51C452802265093600C03939 /* Add */,
5183CCEB227117C70010922C /* Settings */, 5183CCEB227117C70010922C /* Settings */,
5183CCDB226F1EEB0010922C /* Progress */, 5183CCDB226F1EEB0010922C /* Progress */,
@ -2708,7 +2708,7 @@
51C452A722650A3D00C03939 /* RSImage-Extensions.swift in Sources */, 51C452A722650A3D00C03939 /* RSImage-Extensions.swift in Sources */,
51C45269226508F600C03939 /* MasterFeedTableViewCell.swift in Sources */, 51C45269226508F600C03939 /* MasterFeedTableViewCell.swift in Sources */,
51F85BFD2275DCA800C787DC /* SingleLineUILabelSizer.swift in Sources */, 51F85BFD2275DCA800C787DC /* SingleLineUILabelSizer.swift in Sources */,
517630232336657E00E15FFF /* DetailViewControllerWebViewProvider.swift in Sources */, 517630232336657E00E15FFF /* ArticleViewControllerWebViewProvider.swift in Sources */,
51C4528F226509BD00C03939 /* UnreadFeed.swift in Sources */, 51C4528F226509BD00C03939 /* UnreadFeed.swift in Sources */,
51AF460E232488C6001742EF /* Account-Extensions.swift in Sources */, 51AF460E232488C6001742EF /* Account-Extensions.swift in Sources */,
5183CCDD226F1F5C0010922C /* NavigationProgressView.swift in Sources */, 5183CCDD226F1F5C0010922C /* NavigationProgressView.swift in Sources */,
@ -2757,7 +2757,7 @@
51FA73A82332BE880090D516 /* ExtractedArticle.swift in Sources */, 51FA73A82332BE880090D516 /* ExtractedArticle.swift in Sources */,
51C4527C2265091600C03939 /* MasterTimelineDefaultCellLayout.swift in Sources */, 51C4527C2265091600C03939 /* MasterTimelineDefaultCellLayout.swift in Sources */,
51C4529A22650A0400C03939 /* ArticleStyle.swift in Sources */, 51C4529A22650A0400C03939 /* ArticleStyle.swift in Sources */,
51C4527F2265092C00C03939 /* DetailViewController.swift in Sources */, 51C4527F2265092C00C03939 /* ArticleViewController.swift in Sources */,
51C4526A226508F600C03939 /* MasterFeedTableViewCellLayout.swift in Sources */, 51C4526A226508F600C03939 /* MasterFeedTableViewCellLayout.swift in Sources */,
51C452AE2265104D00C03939 /* TimelineStringFormatter.swift in Sources */, 51C452AE2265104D00C03939 /* TimelineStringFormatter.swift in Sources */,
512E08E62268800D00BDCFDD /* FolderTreeControllerDelegate.swift in Sources */, 512E08E62268800D00BDCFDD /* FolderTreeControllerDelegate.swift in Sources */,

View File

@ -54,7 +54,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
appDelegate = self appDelegate = self
// Force lazy initialization of the web view provider so that it can warm up the queue of prepared web views // Force lazy initialization of the web view provider so that it can warm up the queue of prepared web views
let _ = DetailViewControllerWebViewProvider.shared let _ = ArticleViewControllerWebViewProvider.shared
AccountManager.shared = AccountManager() AccountManager.shared = AccountManager()
AppDefaults.shared = UserDefaults.init(suiteName: "group.\(Bundle.main.bundleIdentifier!)")! AppDefaults.shared = UserDefaults.init(suiteName: "group.\(Bundle.main.bundleIdentifier!)")!

View File

@ -1,5 +1,5 @@
// //
// DetailViewController.swift // ArticleViewController.swift
// NetNewsWire // NetNewsWire
// //
// Created by Maurice Parker on 4/8/19. // Created by Maurice Parker on 4/8/19.
@ -12,7 +12,7 @@ import Account
import Articles import Articles
import SafariServices import SafariServices
enum DetailViewState: Equatable { enum ArticleViewState: Equatable {
case noSelection case noSelection
case multipleSelection case multipleSelection
case loading case loading
@ -20,7 +20,7 @@ enum DetailViewState: Equatable {
case extracted(Article, ExtractedArticle) case extracted(Article, ExtractedArticle)
} }
class DetailViewController: UIViewController { class ArticleViewController: UIViewController {
@IBOutlet private weak var nextUnreadBarButtonItem: UIBarButtonItem! @IBOutlet private weak var nextUnreadBarButtonItem: UIBarButtonItem!
@IBOutlet private weak var prevArticleBarButtonItem: UIBarButtonItem! @IBOutlet private weak var prevArticleBarButtonItem: UIBarButtonItem!
@ -34,7 +34,7 @@ class DetailViewController: UIViewController {
weak var coordinator: SceneCoordinator! weak var coordinator: SceneCoordinator!
var state: DetailViewState = .noSelection { var state: ArticleViewState = .noSelection {
didSet { didSet {
if state != oldValue { if state != oldValue {
updateUI() updateUI()
@ -61,7 +61,7 @@ class DetailViewController: UIViewController {
deinit { deinit {
webView.removeFromSuperview() webView.removeFromSuperview()
DetailViewControllerWebViewProvider.shared.enqueueWebView(webView) ArticleViewControllerWebViewProvider.shared.enqueueWebView(webView)
webView = nil webView = nil
} }
@ -73,7 +73,7 @@ class DetailViewController: UIViewController {
NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil)
DetailViewControllerWebViewProvider.shared.dequeueWebView() { webView in ArticleViewControllerWebViewProvider.shared.dequeueWebView() { webView in
self.webView = webView self.webView = webView
self.webViewContainer.addChildAndPin(webView) self.webViewContainer.addChildAndPin(webView)
@ -248,7 +248,7 @@ class DetailViewController: UIViewController {
// MARK: WKNavigationDelegate // MARK: WKNavigationDelegate
extension DetailViewController: WKNavigationDelegate { extension ArticleViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if navigationAction.navigationType == .linkActivated { if navigationAction.navigationType == .linkActivated {
@ -284,7 +284,7 @@ extension DetailViewController: WKNavigationDelegate {
// MARK: Private // MARK: Private
private extension DetailViewController { private extension ArticleViewController {
func updateProgressIndicatorIfNeeded() { func updateProgressIndicatorIfNeeded() {
if !(UIDevice.current.userInterfaceIdiom == .pad) { if !(UIDevice.current.userInterfaceIdiom == .pad) {

View File

@ -1,5 +1,5 @@
// //
// DetailViewControllerWebViewProvider.swift // ArticleViewControllerWebViewProvider.swift
// NetNewsWire-iOS // NetNewsWire-iOS
// //
// Created by Maurice Parker on 9/21/19. // Created by Maurice Parker on 9/21/19.
@ -11,9 +11,9 @@ import WebKit
/// WKWebView has an awful behavior of a flash to white on first load when in dark mode. /// WKWebView has an awful behavior of a flash to white on first load when in dark mode.
/// Keep a queue of WebViews where we've already done a trivial load so that by the time we need them in the UI, they're past the flash-to-shite part of their lifecycle. /// Keep a queue of WebViews where we've already done a trivial load so that by the time we need them in the UI, they're past the flash-to-shite part of their lifecycle.
class DetailViewControllerWebViewProvider: NSObject, WKNavigationDelegate { class ArticleViewControllerWebViewProvider: NSObject, WKNavigationDelegate {
static let shared = DetailViewControllerWebViewProvider() static let shared = ArticleViewControllerWebViewProvider()
private let minimumQueueDepth = 3 private let minimumQueueDepth = 3
private let maximumQueueDepth = 6 private let maximumQueueDepth = 6

View File

@ -7,10 +7,10 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--Detail--> <!--Article-->
<scene sceneID="yUG-lL-AsK"> <scene sceneID="yUG-lL-AsK">
<objects> <objects>
<viewController storyboardIdentifier="DetailViewController" title="Detail" useStoryboardIdentifierAsRestorationIdentifier="YES" id="JEX-9P-axG" customClass="DetailViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController"> <viewController storyboardIdentifier="ArticleViewController" title="Detail" useStoryboardIdentifierAsRestorationIdentifier="YES" id="JEX-9P-axG" userLabel="Article" customClass="ArticleViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="svH-Pt-448"> <view key="view" contentMode="scaleToFill" id="svH-Pt-448">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

View File

@ -36,17 +36,17 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
return rootSplitViewController.children.last as? UISplitViewController return rootSplitViewController.children.last as? UISplitViewController
} }
private var detailViewController: DetailViewController? { private var articleViewController: ArticleViewController? {
if let detail = masterNavigationController.viewControllers.last as? DetailViewController { if let detail = masterNavigationController.viewControllers.last as? ArticleViewController {
return detail return detail
} }
if let subSplit = subSplitViewController { if let subSplit = subSplitViewController {
if let navController = subSplit.viewControllers.last as? UINavigationController { if let navController = subSplit.viewControllers.last as? UINavigationController {
return navController.topViewController as? DetailViewController return navController.topViewController as? ArticleViewController
} }
} else { } else {
if let navController = rootSplitViewController.viewControllers.last as? UINavigationController { if let navController = rootSplitViewController.viewControllers.last as? UINavigationController {
return navController.topViewController as? DetailViewController return navController.topViewController as? ArticleViewController
} }
} }
return nil return nil
@ -289,9 +289,9 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
masterFeedViewController.coordinator = self masterFeedViewController.coordinator = self
masterNavigationController.pushViewController(masterFeedViewController, animated: false) masterNavigationController.pushViewController(masterFeedViewController, animated: false)
let detailViewController = UIStoryboard.main.instantiateController(ofType: DetailViewController.self) let articleViewController = UIStoryboard.main.instantiateController(ofType: ArticleViewController.self)
detailViewController.coordinator = self articleViewController.coordinator = self
let detailNavigationController = addNavControllerIfNecessary(detailViewController, showButton: false) let detailNavigationController = addNavControllerIfNecessary(articleViewController, showButton: false)
rootSplitViewController.showDetailViewController(detailNavigationController, sender: self) rootSplitViewController.showDetailViewController(detailNavigationController, sender: self)
configureThreePanelMode(for: size) configureThreePanelMode(for: size)
@ -558,27 +558,27 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
if article == nil { if article == nil {
if rootSplitViewController.isCollapsed { if rootSplitViewController.isCollapsed {
if masterNavigationController.children.last is DetailViewController { if masterNavigationController.children.last is ArticleViewController {
masterNavigationController.popViewController(animated: !automated) masterNavigationController.popViewController(animated: !automated)
} }
} else { } else {
detailViewController?.state = .noSelection articleViewController?.state = .noSelection
} }
masterTimelineViewController?.updateArticleSelection(animate: !automated) masterTimelineViewController?.updateArticleSelection(animate: !automated)
return return
} }
if detailViewController == nil { if articleViewController == nil {
let detailViewController = UIStoryboard.main.instantiateController(ofType: DetailViewController.self) let articleViewController = UIStoryboard.main.instantiateController(ofType: ArticleViewController.self)
detailViewController.coordinator = self articleViewController.coordinator = self
installDetailController(detailViewController, automated: automated) installArticleController(articleViewController, automated: automated)
} }
if automated { if automated {
masterTimelineViewController?.updateArticleSelection(animate: false) masterTimelineViewController?.updateArticleSelection(animate: false)
} }
detailViewController?.state = .article(article!) articleViewController?.state = .article(article!)
if let article = currentArticle { if let article = currentArticle {
markArticles(Set([article]), statusKey: .read, flag: true) markArticles(Set([article]), statusKey: .read, flag: true)
@ -686,8 +686,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
} }
func scrollOrGoToNextUnread() { func scrollOrGoToNextUnread() {
if detailViewController?.canScrollDown() ?? false { if articleViewController?.canScrollDown() ?? false {
detailViewController?.scrollPageDown() articleViewController?.scrollPageDown()
} else { } else {
selectNextUnread() selectNextUnread()
} }
@ -844,7 +844,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
} }
func navigateToDetail() { func navigateToDetail() {
detailViewController?.focus() articleViewController?.focus()
} }
} }
@ -1340,16 +1340,16 @@ private extension SceneCoordinator {
} }
} }
func installDetailController(_ detailController: UIViewController, automated: Bool) { func installArticleController(_ articleController: UIViewController, automated: Bool) {
if let subSplit = subSplitViewController { if let subSplit = subSplitViewController {
let controller = addNavControllerIfNecessary(detailController, showButton: false) let controller = addNavControllerIfNecessary(articleController, showButton: false)
subSplit.showDetailViewController(controller, sender: self) subSplit.showDetailViewController(controller, sender: self)
} else if rootSplitViewController.isCollapsed { } else if rootSplitViewController.isCollapsed {
let controller = addNavControllerIfNecessary(detailController, showButton: false) let controller = addNavControllerIfNecessary(articleController, showButton: false)
masterNavigationController.pushViewController(controller, animated: !automated) masterNavigationController.pushViewController(controller, animated: !automated)
} else { } else {
let controller = addNavControllerIfNecessary(detailController, showButton: true) let controller = addNavControllerIfNecessary(articleController, showButton: true)
rootSplitViewController.showDetailViewController(controller, sender: self) rootSplitViewController.showDetailViewController(controller, sender: self)
} }
@ -1406,12 +1406,12 @@ private extension SceneCoordinator {
} }
let controller: UIViewController = { let controller: UIViewController = {
if let result = detailViewController { if let result = articleViewController {
return result return result
} else { } else {
let detailController = UIStoryboard.main.instantiateController(ofType: DetailViewController.self) let articleViewController = UIStoryboard.main.instantiateController(ofType: ArticleViewController.self)
detailController.coordinator = self articleViewController.coordinator = self
return detailController return articleViewController
} }
}() }()