diff --git a/Evergreen/AppDelegate.swift b/Evergreen/AppDelegate.swift index 4720c59ef..37208c65a 100644 --- a/Evergreen/AppDelegate.swift +++ b/Evergreen/AppDelegate.swift @@ -145,7 +145,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations { rs_performSelectorCoalesced(#selector(updateBadge), with: nil, afterDelay: 0.01) } - dynamic func updateBadge() { + @objc dynamic func updateBadge() { let label = unreadCount > 0 ? "\(unreadCount)" : "" NSApplication.shared().dockTile.badgeLabel = label diff --git a/Evergreen/ArticleStyles/ArticleStylesManager.swift b/Evergreen/ArticleStyles/ArticleStylesManager.swift index f05c470d0..6014f4f34 100644 --- a/Evergreen/ArticleStyles/ArticleStylesManager.swift +++ b/Evergreen/ArticleStyles/ArticleStylesManager.swift @@ -66,12 +66,12 @@ public final class ArticleStylesManager { updateStyleNames() updateCurrentStyle() - NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name.NSApplicationDidBecomeActive, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name.NSApplication.didBecomeActiveNotification, object: nil) } // MARK: Notifications - dynamic func applicationDidBecomeActive(_ note: Notification) { + @objc dynamic func applicationDidBecomeActive(_ note: Notification) { updateStyleNames() updateCurrentStyle() diff --git a/Evergreen/Data/ArticleUtilities.swift b/Evergreen/Data/ArticleUtilities.swift index 5d7184b9c..a8b516b7b 100644 --- a/Evergreen/Data/ArticleUtilities.swift +++ b/Evergreen/Data/ArticleUtilities.swift @@ -8,6 +8,7 @@ import Foundation import Data +import Account // These handle multiple accounts. @@ -34,7 +35,7 @@ private func accountAndArticlesDictionary(_ articles: NSSet) -> [String: NSSet] guard let oneArticle = oneObject as? Article else { return } - guard let oneAccountIdentifier = oneArticle.account?.identifier else { + guard let oneAccountIdentifier = oneArticle.account?.accountID else { return } @@ -46,9 +47,9 @@ private func accountAndArticlesDictionary(_ articles: NSSet) -> [String: NSSet] return d } -private func accountWithIdentifier(_ identifier: String) -> Account? { +private func accountWithID(_ accountID: String) -> Account? { - return AccountManager.sharedInstance.existingAccountWithIdentifier(identifier) + return AccountManager.sharedInstance.existingAccountWithIdentifier(accountID) } func preferredLink(for article: Article) -> String? { diff --git a/Evergreen/Data/DefaultFeedsImporter.swift b/Evergreen/Data/DefaultFeedsImporter.swift index 8b6ee9b61..ec725b4cc 100644 --- a/Evergreen/Data/DefaultFeedsImporter.swift +++ b/Evergreen/Data/DefaultFeedsImporter.swift @@ -8,7 +8,7 @@ import Foundation import Data -import LocalAccount +import Account private func shouldImportDefaultFeeds(_ isFirstRun: Bool) -> Bool { diff --git a/Evergreen/MainWindow/AddFeed/AddFeedController.swift b/Evergreen/MainWindow/AddFeed/AddFeedController.swift index 843f729c6..30312f69d 100644 --- a/Evergreen/MainWindow/AddFeed/AddFeedController.swift +++ b/Evergreen/MainWindow/AddFeed/AddFeedController.swift @@ -11,6 +11,7 @@ import RSCore import RSTree import Data import RSFeedFinder +import Account // Run add-feed sheet. // If it returns with URL and optional name, diff --git a/Evergreen/MainWindow/AddFeed/AddFeedWindowController.swift b/Evergreen/MainWindow/AddFeed/AddFeedWindowController.swift index f4cc4a120..5c43aaf4e 100644 --- a/Evergreen/MainWindow/AddFeed/AddFeedWindowController.swift +++ b/Evergreen/MainWindow/AddFeed/AddFeedWindowController.swift @@ -10,6 +10,7 @@ import Cocoa import RSCore import RSTree import Data +import Account protocol AddFeedWindowControllerDelegate: class { @@ -46,7 +47,7 @@ class AddFeedWindowController : NSWindowController { convenience init(urlString: String?, name: String?, folderTreeController: TreeController, delegate: AddFeedWindowControllerDelegate?) { - self.init(windowNibName: "AddFeedSheet") + self.init(windowNibName: NSNib.Name(rawValue: "AddFeedSheet")) self.urlString = urlString self.initialName = name self.delegate = delegate @@ -56,7 +57,7 @@ class AddFeedWindowController : NSWindowController { func runSheetOnWindow(_ w: NSWindow) { hostWindow = w - hostWindow.beginSheet(window!) { (returnCode: NSModalResponse) -> Void in + hostWindow.beginSheet(window!) { (returnCode: NSApplication.ModalResponse) -> Void in } } @@ -110,7 +111,7 @@ class AddFeedWindowController : NSWindowController { @IBAction func localShowFeedList(_ sender: AnyObject) { - NSApplication.shared().sendAction(NSSelectorFromString("showFeedList:"), to: nil, from: sender) + NSApplication.shared.sendAction(NSSelectorFromString("showFeedList:"), to: nil, from: sender) hostWindow.endSheet(window!, returnCode: NSModalResponseContinue) } diff --git a/Evergreen/MainWindow/Sidebar/SidebarViewController.swift b/Evergreen/MainWindow/Sidebar/SidebarViewController.swift index bf49f3844..5841d26c6 100644 --- a/Evergreen/MainWindow/Sidebar/SidebarViewController.swift +++ b/Evergreen/MainWindow/Sidebar/SidebarViewController.swift @@ -9,6 +9,7 @@ import Cocoa import RSTree import Data +import Account @objc class SidebarViewController: NSViewController, NSOutlineViewDelegate, NSOutlineViewDataSource { @@ -32,7 +33,7 @@ import Data //MARK: Notifications - dynamic func unreadCountDidChange(_ note: Notification) { + @objc dynamic func unreadCountDidChange(_ note: Notification) { guard let representedObject = note.object else { return @@ -40,17 +41,17 @@ import Data let _ = configureCellsForRepresentedObject(representedObject as AnyObject) } - dynamic func folderChildrenDidChange(_ note: Notification) { + @objc dynamic func folderChildrenDidChange(_ note: Notification) { rebuildTreeAndReloadDataIfNeeded() } - dynamic func dataModelDidPerformBatchUpdates(_ notification: Notification) { + @objc dynamic func dataModelDidPerformBatchUpdates(_ notification: Notification) { rebuildTreeAndReloadDataIfNeeded() } - dynamic func userDidAddFeed(_ note: Notification) { + @objc dynamic func userDidAddFeed(_ note: Notification) { // Find the feed and select it. diff --git a/Evergreen/MainWindow/StatusBar/StatusBarView.swift b/Evergreen/MainWindow/StatusBar/StatusBarView.swift index 43b5e51af..363b90418 100644 --- a/Evergreen/MainWindow/StatusBar/StatusBarView.swift +++ b/Evergreen/MainWindow/StatusBar/StatusBarView.swift @@ -43,7 +43,7 @@ final class StatusBarView: NSView { // MARK: Notifications - dynamic func progressDidChange(_ notification: Notification) { + @objc dynamic func progressDidChange(_ notification: Notification) { guard let progress = notification.userInfo?[progressKey] as? DownloadProgress else { return @@ -54,7 +54,7 @@ final class StatusBarView: NSView { // MARK: Notifications - dynamic func timelineSelectionDidChange(_ note: Notification) { + @objc dynamic func timelineSelectionDidChange(_ note: Notification) { let timelineView = note.userInfo?[viewKey] as! NSView diff --git a/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift b/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift index 552a6b06f..d0045ef92 100644 --- a/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift +++ b/Evergreen/MainWindow/Timeline/Cell/TimelineCellAppearance.swift @@ -11,7 +11,7 @@ import DB5 struct TimelineCellAppearance { - let cellPadding: EdgeInsets + let cellPadding: NSEdgeInsets let feedNameColor: NSColor let feedNameFont: NSFont diff --git a/Evergreen/MainWindow/Timeline/TimelineViewController.swift b/Evergreen/MainWindow/Timeline/TimelineViewController.swift index e7c5389fb..de6300e87 100644 --- a/Evergreen/MainWindow/Timeline/TimelineViewController.swift +++ b/Evergreen/MainWindow/Timeline/TimelineViewController.swift @@ -11,7 +11,7 @@ import RSCore import RSTextDrawing import RSTree import Data -import LocalAccount +import Account let timelineFontSizeKVOKey = "values." + TimelineFontSizeKey diff --git a/Evergreen/ProgressWindow/IndeterminateProgressWindowController.swift b/Evergreen/ProgressWindow/IndeterminateProgressWindowController.swift index 8c4ff009c..1b62da467 100644 --- a/Evergreen/ProgressWindow/IndeterminateProgressWindowController.swift +++ b/Evergreen/ProgressWindow/IndeterminateProgressWindowController.swift @@ -12,7 +12,7 @@ class IndeterminateProgressWindowController: NSWindowController { @IBOutlet var messageLabel: NSTextField! @IBOutlet var progressIndicator: NSProgressIndicator! - dynamic var message = "" + @objc dynamic var message = "" convenience init(message: String) { diff --git a/Frameworks/Account/Account.xcodeproj/project.pbxproj b/Frameworks/Account/Account.xcodeproj/project.pbxproj index 01b437474..3bb101735 100644 --- a/Frameworks/Account/Account.xcodeproj/project.pbxproj +++ b/Frameworks/Account/Account.xcodeproj/project.pbxproj @@ -19,8 +19,9 @@ 846E77451F6EF9B900A165E2 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419740D1F6DD25F006346C4 /* Container.swift */; }; 846E774F1F6EF9C000A165E2 /* LocalAccountDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419742C1F6DDE84006346C4 /* LocalAccountDelegate.swift */; }; 846E77501F6EF9C400A165E2 /* LocalAccountRefresher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419742D1F6DDE96006346C4 /* LocalAccountRefresher.swift */; }; - 846E77521F6EFDFB00A165E2 /* Feed+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846E77511F6EFDFB00A165E2 /* Feed+Account.swift */; }; 846E77541F6F00E300A165E2 /* AccountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846E77531F6F00E300A165E2 /* AccountManager.swift */; }; + 846E77571F6F03D600A165E2 /* Article+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846E77561F6F03D600A165E2 /* Article+Account.swift */; }; + 846E77591F6F03E300A165E2 /* Feed+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846E77581F6F03E300A165E2 /* Feed+Account.swift */; }; 848935001F62484F00CEBD24 /* Account.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 848934F61F62484F00CEBD24 /* Account.framework */; }; 848935051F62485000CEBD24 /* AccountTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848935041F62485000CEBD24 /* AccountTests.swift */; }; /* End PBXBuildFile section */ @@ -110,8 +111,9 @@ 841974241F6DDCE4006346C4 /* AccountDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountDelegate.swift; sourceTree = "<group>"; }; 8419742C1F6DDE84006346C4 /* LocalAccountDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalAccountDelegate.swift; sourceTree = "<group>"; }; 8419742D1F6DDE96006346C4 /* LocalAccountRefresher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalAccountRefresher.swift; sourceTree = "<group>"; }; - 846E77511F6EFDFB00A165E2 /* Feed+Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Feed+Account.swift"; sourceTree = "<group>"; }; 846E77531F6F00E300A165E2 /* AccountManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountManager.swift; sourceTree = "<group>"; }; + 846E77561F6F03D600A165E2 /* Article+Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Article+Account.swift"; path = "Extensions/Article+Account.swift"; sourceTree = "<group>"; }; + 846E77581F6F03E300A165E2 /* Feed+Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Feed+Account.swift"; path = "Extensions/Feed+Account.swift"; sourceTree = "<group>"; }; 848934F61F62484F00CEBD24 /* Account.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Account.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 848934FA1F62484F00CEBD24 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 848934FF1F62484F00CEBD24 /* AccountTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AccountTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -210,6 +212,15 @@ name = Frameworks; sourceTree = "<group>"; }; + 846E77551F6F03B200A165E2 /* Extensions */ = { + isa = PBXGroup; + children = ( + 846E77581F6F03E300A165E2 /* Feed+Account.swift */, + 846E77561F6F03D600A165E2 /* Article+Account.swift */, + ); + name = Extensions; + sourceTree = "<group>"; + }; 848934EC1F62484F00CEBD24 = { isa = PBXGroup; children = ( @@ -217,7 +228,7 @@ 848935101F62486800CEBD24 /* Account.swift */, 841974241F6DDCE4006346C4 /* AccountDelegate.swift */, 841974001F6DD1EC006346C4 /* Folder.swift */, - 846E77511F6EFDFB00A165E2 /* Feed+Account.swift */, + 846E77551F6F03B200A165E2 /* Extensions */, 841974141F6DD4FF006346C4 /* Container */, 8419742B1F6DDE84006346C4 /* Local */, 8469F80F1F6DC3C10084783E /* Frameworks */, @@ -439,7 +450,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 846E77521F6EFDFB00A165E2 /* Feed+Account.swift in Sources */, + 846E77571F6F03D600A165E2 /* Article+Account.swift in Sources */, 8469F81C1F6DD15E0084783E /* Account.swift in Sources */, 846E77451F6EF9B900A165E2 /* Container.swift in Sources */, 8419741A1F6DD583006346C4 /* Account+Container.swift in Sources */, @@ -447,6 +458,7 @@ 846E77541F6F00E300A165E2 /* AccountManager.swift in Sources */, 846E77501F6EF9C400A165E2 /* LocalAccountRefresher.swift in Sources */, 841974011F6DD1EC006346C4 /* Folder.swift in Sources */, + 846E77591F6F03E300A165E2 /* Feed+Account.swift in Sources */, 846E774F1F6EF9C000A165E2 /* LocalAccountDelegate.swift in Sources */, 841974181F6DD535006346C4 /* Folder+Container.swift in Sources */, ); diff --git a/Frameworks/Account/AccountManager.swift b/Frameworks/Account/AccountManager.swift index 91c47ea87..7ffd4b5ea 100644 --- a/Frameworks/Account/AccountManager.swift +++ b/Frameworks/Account/AccountManager.swift @@ -15,14 +15,14 @@ let AccountsDidChangeNotification = "AccountsDidChangeNotification" private let localAccountFolderName = "OnMyMac" private let localAccountIdentifier = "OnMyMac" -final class AccountManager: UnreadCountProvider { +public final class AccountManager: UnreadCountProvider { - static let sharedInstance = AccountManager() + public static let sharedInstance = AccountManager() + public let localAccount: Account private let accountsFolder = RSDataSubfolder(nil, "Accounts")! private var accountsDictionary = [String: Account]() - let localAccount: Account - var unreadCount = 0 { + public var unreadCount = 0 { didSet { postUnreadCountDidChangeNotification() } @@ -40,7 +40,7 @@ final class AccountManager: UnreadCountProvider { } } - var refreshInProgress: Bool { + public var refreshInProgress: Bool { get { for oneAccount in accountsDictionary.values { if oneAccount.refreshInProgress { @@ -51,7 +51,7 @@ final class AccountManager: UnreadCountProvider { } } - init() { + public init() { // The local "On My Mac" account must always exist, even if it's empty. @@ -75,12 +75,12 @@ final class AccountManager: UnreadCountProvider { // MARK: API - func existingAccountWithID(_ accountID: String) -> Account? { + public func existingAccountWithID(_ accountID: String) -> Account? { return accountsDictionary[accountID] } - func refreshAll() { + public func refreshAll() { accounts.forEach { (account) in account.refreshAll() @@ -108,8 +108,6 @@ final class AccountManager: UnreadCountProvider { return false } - // MARK: UnreadCountProvider - func updateUnreadCount() { let updatedUnreadCount = calculateUnreadCount(accounts) diff --git a/Frameworks/Account/Extensions/Article+Account.swift b/Frameworks/Account/Extensions/Article+Account.swift new file mode 100644 index 000000000..44e4940a5 --- /dev/null +++ b/Frameworks/Account/Extensions/Article+Account.swift @@ -0,0 +1,20 @@ +// +// Article+Account.swift +// Account +// +// Created by Brent Simmons on 9/17/17. +// Copyright © 2017 Ranchero Software, LLC. All rights reserved. +// + +import Foundation +import Data + +public extension Article { + + var account: Account? { + get { + return AccountManager.sharedInstance.existingAccountWithID(accountID) + } + } +} + diff --git a/Frameworks/Account/Feed+Account.swift b/Frameworks/Account/Extensions/Feed+Account.swift similarity index 100% rename from Frameworks/Account/Feed+Account.swift rename to Frameworks/Account/Extensions/Feed+Account.swift diff --git a/Frameworks/RSFeedFinder/RSFeedFinder.xcodeproj/project.pbxproj b/Frameworks/RSFeedFinder/RSFeedFinder.xcodeproj/project.pbxproj index 2c945f5c9..54e32cbb0 100644 --- a/Frameworks/RSFeedFinder/RSFeedFinder.xcodeproj/project.pbxproj +++ b/Frameworks/RSFeedFinder/RSFeedFinder.xcodeproj/project.pbxproj @@ -308,6 +308,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -351,6 +352,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; diff --git a/ToDo.opml b/ToDo.opml index ae0be2bdb..bf5adfbf2 100644 --- a/ToDo.opml +++ b/ToDo.opml @@ -6,15 +6,16 @@ </editor> --> <title>ToDo</title> <dateCreated>Tue, 12 Sep 2017 20:15:17 GMT</dateCreated> - <expansionState>11,16,17,20,24,29,31,34,37,39,40,42,46,49,51,53,55,64,69</expansionState> - <vertScrollState>52</vertScrollState> - <windowTop>3298</windowTop> - <windowLeft>544</windowLeft> - <windowRight>1276</windowRight> - <windowBottom>4057</windowBottom> + <expansionState>0,18,21,25,30,40,41,43,47,50,52,54,56,65,70</expansionState> + <vertScrollState>0</vertScrollState> + <windowTop>452</windowTop> + <windowLeft>543</windowLeft> + <windowRight>1275</windowRight> + <windowBottom>1211</windowBottom> </head> <body> <outline text="App"> + <outline text="Get it building again"/> <outline text="Require High Sierra"/> <outline text="Use new app icon"/> <outline text="Set -NSApplicationCrashOnExceptions YES"/>