Fix some build errors.
This commit is contained in:
parent
1b391c262e
commit
c0ce68e64b
|
@ -66,7 +66,7 @@ public final class ArticleStylesManager {
|
|||
updateStyleNames()
|
||||
updateCurrentStyle()
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name.NSApplication.didBecomeActiveNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name.NSApplicationDidBecomeActiveNotification, object: nil)
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
|
|
|
@ -12,51 +12,39 @@ import Account
|
|||
|
||||
// These handle multiple accounts.
|
||||
|
||||
func markArticles(_ articles: NSSet, statusKey: ArticleStatusKey, flag: Bool) {
|
||||
func markArticles(_ articles: Set<Article>, statusKey: String, flag: Bool) {
|
||||
|
||||
let d: [String: NSSet] = accountAndArticlesDictionary(articles)
|
||||
let d: [String: Set<Article>] = accountAndArticlesDictionary(articles)
|
||||
|
||||
d.keys.forEach { (oneAccountIdentifier) in
|
||||
d.keys.forEach { (accountID) in
|
||||
|
||||
guard let oneAccountArticles = d[oneAccountIdentifier], let oneAccount = accountWithIdentifier(oneAccountIdentifier) else {
|
||||
guard let accountArticles = d[accountID], let account = accountWithID(accountID) else {
|
||||
return
|
||||
}
|
||||
|
||||
oneAccount.markArticles(oneAccountArticles, statusKey: statusKey, flag: flag)
|
||||
account.markArticles(accountArticles, statusKey: statusKey, flag: flag)
|
||||
}
|
||||
}
|
||||
|
||||
private func accountAndArticlesDictionary(_ articles: NSSet) -> [String: NSSet] {
|
||||
private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String: Set<Article>] {
|
||||
|
||||
var d = [String: NSMutableSet]()
|
||||
var d = [String: Set<Article>]()
|
||||
|
||||
articles.forEach { (oneObject) in
|
||||
articles.forEach { (article) in
|
||||
|
||||
guard let oneArticle = oneObject as? Article else {
|
||||
return
|
||||
}
|
||||
guard let oneAccountIdentifier = oneArticle.account?.accountID else {
|
||||
return
|
||||
}
|
||||
|
||||
let oneArticleSet: NSMutableSet = d[oneAccountIdentifier] ?? NSMutableSet()
|
||||
oneArticleSet.add(oneArticle)
|
||||
d[oneAccountIdentifier] = oneArticleSet
|
||||
let accountID = article.accountID
|
||||
var articleSet: Set<Article> = d[accountID] ?? Set<Article>()
|
||||
articleSet.insert(article)
|
||||
d[accountID] = articleSet
|
||||
}
|
||||
|
||||
return d
|
||||
}
|
||||
|
||||
private func accountWithID(_ accountID: String) -> Account? {
|
||||
|
||||
return AccountManager.sharedInstance.existingAccountWithIdentifier(accountID)
|
||||
}
|
||||
|
||||
func preferredLink(for article: Article) -> String? {
|
||||
extension Article {
|
||||
|
||||
if let s = article.permalink {
|
||||
return s
|
||||
func preferredLink() -> String? {
|
||||
|
||||
return url ?? externalURL
|
||||
}
|
||||
return article.link
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class AddFeedController: AddFeedWindowControllerDelegate, FeedFinderDelegate {
|
|||
|
||||
func addFeedWindowController(_: AddFeedWindowController, userEnteredURL url: URL, userEnteredTitle title: String?, folder: Folder) {
|
||||
|
||||
closeAddFeedSheet(NSModalResponseOK)
|
||||
closeAddFeedSheet(NSApplication.ModalResponse.OK)
|
||||
|
||||
assert(folder.account != nil, "Folder must have an account.")
|
||||
let account = folder.account ?? AccountManager.sharedInstance.localAccount
|
||||
|
@ -77,7 +77,7 @@ class AddFeedController: AddFeedWindowControllerDelegate, FeedFinderDelegate {
|
|||
|
||||
func addFeedWindowControllerUserDidCancel(_: AddFeedWindowController) {
|
||||
|
||||
closeAddFeedSheet(NSModalResponseCancel)
|
||||
closeAddFeedSheet(NSApplication.ModalResponse.cancel)
|
||||
}
|
||||
|
||||
// MARK: FeedFinderDelegate
|
||||
|
@ -128,14 +128,14 @@ private extension AddFeedController {
|
|||
|
||||
var urlStringFromPasteboard: String? {
|
||||
get {
|
||||
if let urlString = NSPasteboard.rs_urlString(from: NSPasteboard.general()) {
|
||||
if let urlString = NSPasteboard.rs_urlString(from: NSPasteboard.general) {
|
||||
return urlString.rs_normalizedURL()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func closeAddFeedSheet(_ returnCode: NSModalResponse) {
|
||||
func closeAddFeedSheet(_ returnCode: NSApplication.ModalResponse) {
|
||||
|
||||
if let sheetWindow = addFeedWindowController?.window {
|
||||
hostWindow.endSheet(sheetWindow, returnCode: returnCode)
|
||||
|
|
|
@ -112,7 +112,7 @@ class AddFeedWindowController : NSWindowController {
|
|||
@IBAction func localShowFeedList(_ sender: AnyObject) {
|
||||
|
||||
NSApplication.shared.sendAction(NSSelectorFromString("showFeedList:"), to: nil, from: sender)
|
||||
hostWindow.endSheet(window!, returnCode: NSModalResponseContinue)
|
||||
hostWindow.endSheet(window!, returnCode: NSApplication.ModalResponse.continue)
|
||||
}
|
||||
|
||||
// MARK: NSTextFieldDelegate
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import Cocoa
|
||||
import Data
|
||||
import Account
|
||||
|
||||
//func addFolderWindowController() -> AddFolderWindowController {
|
||||
//
|
||||
|
@ -22,7 +23,7 @@ class AddFolderWindowController : NSWindowController {
|
|||
|
||||
convenience init() {
|
||||
|
||||
self.init(windowNibName: "AddFolderSheet")
|
||||
self.init(windowNibName: NSNib.Name(rawValue: "AddFolderSheet"))
|
||||
}
|
||||
|
||||
// MARK: API
|
||||
|
@ -30,9 +31,9 @@ class AddFolderWindowController : NSWindowController {
|
|||
func runSheetOnWindow(_ w: NSWindow) {
|
||||
|
||||
hostWindow = w
|
||||
hostWindow!.beginSheet(window!) { (returnCode: NSModalResponse) -> Void in
|
||||
hostWindow!.beginSheet(window!) { (returnCode: NSApplication.ModalResponse) -> Void in
|
||||
|
||||
if returnCode == NSModalResponseOK {
|
||||
if returnCode == NSApplication.ModalResponse.OK {
|
||||
self.addFolderIfNeeded()
|
||||
}
|
||||
}
|
||||
|
@ -74,12 +75,12 @@ class AddFolderWindowController : NSWindowController {
|
|||
|
||||
@IBAction func cancel(_ sender: AnyObject) {
|
||||
|
||||
hostWindow!.endSheet(window!, returnCode: NSModalResponseCancel)
|
||||
hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.cancel)
|
||||
}
|
||||
|
||||
@IBAction func addFolder(_ sender: AnyObject) {
|
||||
|
||||
hostWindow!.endSheet(window!, returnCode: NSModalResponseOK)
|
||||
hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.OK)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class DetailViewController: NSViewController, WKNavigationDelegate, WKUIDelegate
|
|||
|
||||
// MARK: Notifications
|
||||
|
||||
func timelineSelectionDidChange(_ note: Notification) {
|
||||
@objc func timelineSelectionDidChange(_ note: Notification) {
|
||||
|
||||
let timelineView = note.userInfo?[viewKey] as! NSView
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
super.windowDidLoad()
|
||||
|
||||
// window?.titleVisibility = .hidden
|
||||
window?.setFrameUsingName(kWindowFrameKey, force: true)
|
||||
window?.setFrameUsingName(NSWindow.FrameAutosaveName(rawValue: kWindowFrameKey), force: true)
|
||||
|
||||
detailSplitViewItem?.minimumThickness = 384
|
||||
|
||||
|
@ -33,12 +33,12 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
|
||||
// MARK: Notifications
|
||||
|
||||
func applicationWillTerminate(_ note: Notification) {
|
||||
@objc func applicationWillTerminate(_ note: Notification) {
|
||||
|
||||
window?.saveFrame(usingName: kWindowFrameKey)
|
||||
window?.saveFrame(usingName: NSWindow.FrameAutosaveName(rawValue: kWindowFrameKey))
|
||||
}
|
||||
|
||||
func appNavigationKeyPressed(_ note: Notification) {
|
||||
@objc func appNavigationKeyPressed(_ note: Notification) {
|
||||
|
||||
guard let key = note.userInfo?[appNavigationKey] as? Int else {
|
||||
return
|
||||
|
@ -50,14 +50,14 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
print(key)
|
||||
}
|
||||
|
||||
func refreshProgressDidChange(_ note: Notification) {
|
||||
@objc func refreshProgressDidChange(_ note: Notification) {
|
||||
|
||||
rs_performSelectorCoalesced(#selector(MainWindowController.coalescedMakeToolbarValidate(_:)), with: nil, afterDelay: 0.1)
|
||||
}
|
||||
|
||||
// MARK: Toolbar
|
||||
|
||||
func coalescedMakeToolbarValidate(_ sender: Any) {
|
||||
@objc func coalescedMakeToolbarValidate(_ sender: Any) {
|
||||
|
||||
window?.toolbar?.validateVisibleItems()
|
||||
}
|
||||
|
|
|
@ -103,14 +103,14 @@ import Account
|
|||
|
||||
outlineView.selectRowIndexes(IndexSet([row]), byExtendingSelection: false)
|
||||
|
||||
NSApplication.shared().sendAction(NSSelectorFromString("nextUnread:"), to: nil, from: self)
|
||||
NSApplication.shared.sendAction(NSSelectorFromString("nextUnread:"), to: nil, from: self)
|
||||
}
|
||||
|
||||
// MARK: NSOutlineViewDelegate
|
||||
|
||||
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
|
||||
|
||||
let cell = outlineView.make(withIdentifier: "DataCell", owner: self) as! SidebarCell
|
||||
let cell = outlineView.make(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "DataCell"), owner: self) as! SidebarCell
|
||||
|
||||
let node = item as! Node
|
||||
configure(cell, node)
|
||||
|
|
|
@ -33,7 +33,7 @@ final class StatusBarView: NSView {
|
|||
override func awakeFromNib() {
|
||||
|
||||
let progressLabelFontSize = progressLabel.font?.pointSize ?? 13.0
|
||||
progressLabel.font = NSFont.monospacedDigitSystemFont(ofSize: progressLabelFontSize, weight: NSFontWeightRegular)
|
||||
progressLabel.font = NSFont.monospacedDigitSystemFont(ofSize: progressLabelFontSize, weight: NSFont.Weight.regular)
|
||||
progressLabel.stringValue = ""
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil)
|
||||
|
@ -91,7 +91,7 @@ private extension StatusBarView {
|
|||
return
|
||||
}
|
||||
|
||||
let s = preferredLink(for: article)
|
||||
let s = article.preferredLink()
|
||||
if let s = s {
|
||||
urlLabel.stringValue = (s as NSString).rs_stringByStrippingHTTPOrHTTPSScheme()
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import Foundation
|
||||
import Data
|
||||
import RSParser
|
||||
|
||||
private let truncatedFeedNameCache = NSMutableDictionary()
|
||||
private let truncatedTitleCache = NSMutableDictionary()
|
||||
|
@ -102,7 +103,7 @@ func timelineNormalizedTextTruncated(_ text: String) -> String {
|
|||
return cachedText
|
||||
}
|
||||
|
||||
var s: NSString = (text as NSString).rs_stringByDecodingHTMLEntities() as NSString
|
||||
var s: NSString = (text as NSString).rsparser_stringByDecodingHTMLEntities() as NSString
|
||||
s = s.rs_stringByTrimmingWhitespace() as NSString
|
||||
s = s.rs_stringWithCollapsedWhitespace() as NSString
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||
NotificationCenter.default.addObserver(self, selector: #selector(sidebarSelectionDidChange(_:)), name: .SidebarSelectionDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(articleStatusesDidChange(_:)), name: .ArticleStatusesDidChange, object: nil)
|
||||
|
||||
NSUserDefaultsController.shared().addObserver(self, forKeyPath:timelineFontSizeKVOKey, options: NSKeyValueObservingOptions(rawValue: 0), context: nil)
|
||||
NSUserDefaultsController.shared.addObserver(self, forKeyPath:timelineFontSizeKVOKey, options: NSKeyValueObservingOptions(rawValue: 0), context: nil)
|
||||
|
||||
didRegisterForNotifications = true
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||
|
||||
// MARK: Actions
|
||||
|
||||
func openArticleInBrowser(_ sender: AnyObject) {
|
||||
@objc func openArticleInBrowser(_ sender: AnyObject) {
|
||||
|
||||
guard let article = oneSelectedArticle else {
|
||||
return
|
||||
|
@ -221,7 +221,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||
|
||||
// MARK: Notifications
|
||||
|
||||
func sidebarSelectionDidChange(_ note: Notification) {
|
||||
@objc func sidebarSelectionDidChange(_ note: Notification) {
|
||||
|
||||
let sidebarView = note.userInfo?[viewKey] as! NSView
|
||||
|
||||
|
@ -230,7 +230,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||
}
|
||||
}
|
||||
|
||||
func articleStatusesDidChange(_ note: Notification) {
|
||||
@objc func articleStatusesDidChange(_ note: Notification) {
|
||||
|
||||
guard let articles = note.userInfo?[articlesKey] as? NSSet else {
|
||||
return
|
||||
|
|
|
@ -16,7 +16,7 @@ class IndeterminateProgressWindowController: NSWindowController {
|
|||
|
||||
convenience init(message: String) {
|
||||
|
||||
self.init(windowNibName: "IndeterminateProgressWindow")
|
||||
self.init(windowNibName: NSNib.Name(rawValue: "IndeterminateProgressWindow"))
|
||||
self.message = message
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ class IndeterminateProgressWindowController: NSWindowController {
|
|||
func runIndeterminateProgressWithMessage(_ message: String) {
|
||||
|
||||
let windowController = IndeterminateProgressWindowController(message: message)
|
||||
NSApplication.shared().runModal(for: windowController.window!)
|
||||
NSApplication.shared.runModal(for: windowController.window!)
|
||||
}
|
||||
|
||||
func stopIndeterminateProgress() {
|
||||
|
||||
NSApplication.shared().stopModal()
|
||||
NSApplication.shared.stopModal()
|
||||
}
|
||||
|
|
|
@ -65,6 +65,11 @@ public final class Account: DisplayNameProvider, Hashable {
|
|||
// TODO
|
||||
}
|
||||
|
||||
public func markArticles(_ articles: Set<Article>, statusKey: String, flag: Bool) {
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
// MARK: - Equatable
|
||||
|
||||
public class func ==(lhs: Account, rhs: Account) -> Bool {
|
||||
|
|
|
@ -34,7 +34,7 @@ public final class AccountManager: UnreadCountProvider {
|
|||
}
|
||||
}
|
||||
|
||||
var sortedAccounts: [Account] {
|
||||
public var sortedAccounts: [Account] {
|
||||
get {
|
||||
return accountsSortedByName()
|
||||
}
|
||||
|
@ -191,6 +191,12 @@ private func accountFilePathWithFolder(_ folderPath: String) -> String {
|
|||
return NSString(string: folderPath).appendingPathComponent(accountDataFileName)
|
||||
}
|
||||
|
||||
public func accountWithID(_ accountID: String) -> Account? {
|
||||
|
||||
// Shortcut.
|
||||
return AccountManager.sharedInstance.existingAccountWithID(accountID)
|
||||
}
|
||||
|
||||
private struct AccountSpecifier {
|
||||
|
||||
let type: String
|
||||
|
|
|
@ -13,7 +13,7 @@ public extension Article {
|
|||
|
||||
var account: Account? {
|
||||
get {
|
||||
return AccountManager.sharedInstance.existingAccountWithID(accountID)
|
||||
return accountWithID(accountID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public extension Feed {
|
|||
|
||||
var account: Account? {
|
||||
get {
|
||||
return AccountManager.sharedInstance.existingAccountWithID(accountID)
|
||||
return accountWithID(accountID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,13 @@ public final class Folder: DisplayNameProvider, UnreadCountProvider {
|
|||
|
||||
public let accountID: String
|
||||
var childObjects = [AnyObject]()
|
||||
|
||||
|
||||
public var account: Account? {
|
||||
get {
|
||||
return accountWithID(accountID)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - DisplayNameProvider
|
||||
|
||||
public var nameForDisplay: String
|
||||
|
|
Loading…
Reference in New Issue