From 5e7357cd9018a723438a551277cba02d8eb53396 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 26 Jan 2018 21:56:16 -0800 Subject: [PATCH] Switch to using TimelineViewController for the Feed Directory. --- Evergreen.xcodeproj/project.pbxproj | 8 +-- Evergreen/FeedList/FeedList.plist | 8 --- Evergreen/FeedList/FeedList.storyboard | 52 ++++++----------- .../FeedList/FeedListKeyboardDelegate.swift | 20 +++++++ .../FeedListTimelineViewController.swift | 56 ------------------- 5 files changed, 40 insertions(+), 104 deletions(-) create mode 100644 Evergreen/FeedList/FeedListKeyboardDelegate.swift delete mode 100644 Evergreen/FeedList/FeedListTimelineViewController.swift diff --git a/Evergreen.xcodeproj/project.pbxproj b/Evergreen.xcodeproj/project.pbxproj index bb2c7ad50..3ce78c269 100644 --- a/Evergreen.xcodeproj/project.pbxproj +++ b/Evergreen.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 8403E75B201C4A79007F7246 /* FeedListKeyboardDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8403E75A201C4A79007F7246 /* FeedListKeyboardDelegate.swift */; }; 8414AD251FCF5A1E00955102 /* TimelineHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8414AD241FCF5A1E00955102 /* TimelineHeaderView.swift */; }; 841ABA4E20145E7300980E11 /* NothingInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA4D20145E7300980E11 /* NothingInspectorViewController.swift */; }; 841ABA5E20145E9200980E11 /* FolderInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */; }; @@ -125,7 +126,6 @@ 84E95D241FB1087500552D99 /* ArticlePasteboardWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E95D231FB1087500552D99 /* ArticlePasteboardWriter.swift */; }; 84EB381F1FBA8B9F000D2111 /* KeyboardShortcuts.html in Resources */ = {isa = PBXBuildFile; fileRef = 84EB38101FBA8B9F000D2111 /* KeyboardShortcuts.html */; }; 84F204CE1FAACB660076E152 /* FeedListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204CD1FAACB660076E152 /* FeedListViewController.swift */; }; - 84F204DE1FAACB8B0076E152 /* FeedListTimelineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204DD1FAACB8B0076E152 /* FeedListTimelineViewController.swift */; }; 84F204E01FAACBB30076E152 /* ArticleArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204DF1FAACBB30076E152 /* ArticleArray.swift */; }; 84F2D5371FC22FCC00998D64 /* PseudoFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2D5351FC22FCB00998D64 /* PseudoFeed.swift */; }; 84F2D5381FC22FCC00998D64 /* TodayFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2D5361FC22FCB00998D64 /* TodayFeedDelegate.swift */; }; @@ -466,6 +466,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 8403E75A201C4A79007F7246 /* FeedListKeyboardDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListKeyboardDelegate.swift; sourceTree = ""; }; 8414AD241FCF5A1E00955102 /* TimelineHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineHeaderView.swift; sourceTree = ""; }; 841ABA4D20145E7300980E11 /* NothingInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NothingInspectorViewController.swift; sourceTree = ""; }; 841ABA5D20145E9200980E11 /* FolderInspectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderInspectorViewController.swift; sourceTree = ""; }; @@ -582,7 +583,6 @@ 84E95D231FB1087500552D99 /* ArticlePasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticlePasteboardWriter.swift; sourceTree = ""; }; 84EB38101FBA8B9F000D2111 /* KeyboardShortcuts.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = KeyboardShortcuts.html; sourceTree = ""; }; 84F204CD1FAACB660076E152 /* FeedListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListViewController.swift; sourceTree = ""; }; - 84F204DD1FAACB8B0076E152 /* FeedListTimelineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListTimelineViewController.swift; sourceTree = ""; }; 84F204DF1FAACBB30076E152 /* ArticleArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleArray.swift; sourceTree = ""; }; 84F2D5351FC22FCB00998D64 /* PseudoFeed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PseudoFeed.swift; sourceTree = ""; }; 84F2D5361FC22FCB00998D64 /* TodayFeedDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodayFeedDelegate.swift; sourceTree = ""; }; @@ -884,7 +884,7 @@ 849A978C1ED9EE4D007D329B /* FeedListWindowController.swift */, 84CC08051FF5D2E000C0C0ED /* FeedListSplitViewController.swift */, 84F204CD1FAACB660076E152 /* FeedListViewController.swift */, - 84F204DD1FAACB8B0076E152 /* FeedListTimelineViewController.swift */, + 8403E75A201C4A79007F7246 /* FeedListKeyboardDelegate.swift */, 84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */, 84B99C661FAE35E600ECDEDB /* FeedListTreeControllerDelegate.swift */, 84B99C681FAE36B800ECDEDB /* FeedListFolder.swift */, @@ -1605,6 +1605,7 @@ D5A2678C20130ECF00A8D3C0 /* Author+Scriptability.swift in Sources */, 84F2D5371FC22FCC00998D64 /* PseudoFeed.swift in Sources */, D553738B20186C20006D8857 /* Article+Scriptability.swift in Sources */, + 8403E75B201C4A79007F7246 /* FeedListKeyboardDelegate.swift in Sources */, 845EE7C11FC2488C00854A1F /* SmartFeed.swift in Sources */, 84702AA41FA27AC0006B8943 /* MarkReadOrUnreadCommand.swift in Sources */, D5907D7F2004AC00005947E5 /* NSApplication+Scriptability.swift in Sources */, @@ -1658,7 +1659,6 @@ 84D52E951FE588BB00D14F5B /* DetailStatusBarView.swift in Sources */, 84B99C671FAE35E600ECDEDB /* FeedListTreeControllerDelegate.swift in Sources */, 84B99C691FAE36B800ECDEDB /* FeedListFolder.swift in Sources */, - 84F204DE1FAACB8B0076E152 /* FeedListTimelineViewController.swift in Sources */, 84411E711FE5FBFA004B527F /* SmallIconProvider.swift in Sources */, 844B5B591FE9FE4F00C7C76A /* SidebarKeyboardDelegate.swift in Sources */, 849A97A31ED9F180007D329B /* FolderTreeControllerDelegate.swift in Sources */, diff --git a/Evergreen/FeedList/FeedList.plist b/Evergreen/FeedList/FeedList.plist index ad2d739b6..966f6b98d 100644 --- a/Evergreen/FeedList/FeedList.plist +++ b/Evergreen/FeedList/FeedList.plist @@ -234,14 +234,6 @@ url http://www.virginiaroberts.com/feed/ - - name - Feral Scrutiny - homePageURL - http://feralscrutiny.co/ - url - http://feralscrutiny.co/feed/ - News diff --git a/Evergreen/FeedList/FeedList.storyboard b/Evergreen/FeedList/FeedList.storyboard index d4c1f549b..cd4d4d39c 100644 --- a/Evergreen/FeedList/FeedList.storyboard +++ b/Evergreen/FeedList/FeedList.storyboard @@ -250,10 +250,10 @@ - + - + @@ -264,7 +264,7 @@ - + @@ -304,40 +304,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -358,8 +330,16 @@ + + + + + + + + diff --git a/Evergreen/FeedList/FeedListKeyboardDelegate.swift b/Evergreen/FeedList/FeedListKeyboardDelegate.swift new file mode 100644 index 000000000..7e58e8f20 --- /dev/null +++ b/Evergreen/FeedList/FeedListKeyboardDelegate.swift @@ -0,0 +1,20 @@ +// +// FeedListKeyboardDelegate.swift +// Evergreen +// +// Created by Brent Simmons on 1/26/18. +// Copyright © 2018 Ranchero Software. All rights reserved. +// + +import AppKit + +@objc final class FeedListTimelineKeyboardDelegate: NSObject, KeyboardDelegate { + + @IBOutlet weak var timelineViewController: TimelineViewController? + + func keydown(_ event: NSEvent, in view: NSView) -> Bool { + + // TODO + return false + } +} diff --git a/Evergreen/FeedList/FeedListTimelineViewController.swift b/Evergreen/FeedList/FeedListTimelineViewController.swift deleted file mode 100644 index 534a62410..000000000 --- a/Evergreen/FeedList/FeedListTimelineViewController.swift +++ /dev/null @@ -1,56 +0,0 @@ -// -// FeedListTimelineViewController.swift -// Evergreen -// -// Created by Brent Simmons on 11/1/17. -// Copyright © 2017 Ranchero Software. All rights reserved. -// - -import Cocoa - -final class FeedListTimelineViewController: NSViewController { - - var selectedFeed: FeedListFeed? = nil { - didSet { - if let selectedFeed = selectedFeed { - selectedFeed.downloadIfNeeded() - } - } - } - - override func viewDidLoad() { - - view.translatesAutoresizingMaskIntoConstraints = false - - NotificationCenter.default.addObserver(self, selector: #selector(sidebarSelectionDidChange(_:)), name: .FeedListSidebarSelectionDidChange, object: nil) - - NotificationCenter.default.addObserver(self, selector: #selector(feedDidBecomeAvailable(_:)), name: .FeedListFeedDidBecomeAvailable, object: nil) - } - - @objc func feedDidBecomeAvailable(_ note: Notification) { - - guard let feed = note.object as? FeedListFeed else { - return - } - - if feed == selectedFeed { - reloadTimeline() - } - } - - @objc func sidebarSelectionDidChange(_ note: Notification) { - - guard let feed = note.userInfo?[FeedListUserInfoKey.selectedObject] as? FeedListFeed else { - selectedFeed = nil - return - } - selectedFeed = feed - } -} - -private extension FeedListTimelineViewController { - - func reloadTimeline() { - // - } -}