mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Continue fixing build errors.
This commit is contained in:
@@ -13,6 +13,7 @@ import RSTextDrawing
|
||||
import RSTree
|
||||
import RSParser
|
||||
import RSWeb
|
||||
import Account
|
||||
|
||||
var currentTheme: VSTheme!
|
||||
|
||||
@@ -40,40 +41,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
||||
super.init()
|
||||
}
|
||||
|
||||
private func evergreenImage() -> NSImage? {
|
||||
var image: NSImage? = nil
|
||||
let imageWidth = 1024
|
||||
let imageHeight = 1024
|
||||
let imageSize = NSMakeSize(CGFloat(imageWidth), CGFloat(imageHeight))
|
||||
|
||||
if let drawingContext = CGContext(data: nil, width: imageWidth, height: imageHeight, bitsPerComponent: 8, bytesPerRow: 0, space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: CGImageAlphaInfo.premultipliedFirst.rawValue) {
|
||||
|
||||
let graphicsContext = NSGraphicsContext(cgContext: drawingContext, flipped: false)
|
||||
NSGraphicsContext.saveGraphicsState()
|
||||
NSGraphicsContext.setCurrent(graphicsContext)
|
||||
|
||||
let targetRect = NSRect(origin: NSZeroPoint, size: imageSize)
|
||||
NSString(string: "🌲").draw(in: targetRect, withAttributes: [NSFontAttributeName: NSFont.systemFont(ofSize: 1000)])
|
||||
|
||||
NSGraphicsContext.restoreGraphicsState()
|
||||
|
||||
if let coreImage = drawingContext.makeImage() {
|
||||
image = NSImage(cgImage: coreImage, size: imageSize)
|
||||
}
|
||||
}
|
||||
|
||||
return image
|
||||
}
|
||||
|
||||
// MARK: NSApplicationDelegate
|
||||
|
||||
func applicationDidFinishLaunching(_ note: Notification) {
|
||||
|
||||
if let appIconImage = evergreenImage() {
|
||||
appIconImage.setName("NSApplicationIcon")
|
||||
NSApplication.shared().applicationIconImage = appIconImage
|
||||
}
|
||||
|
||||
registerDefaults()
|
||||
|
||||
currentTheme = themeLoader.defaultTheme
|
||||
@@ -90,9 +61,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
||||
importDefaultFeedsIfNeeded(isFirstRun, account: AccountManager.sharedInstance.localAccount)
|
||||
createAndShowMainWindow()
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
AccountManager.sharedInstance.updateUnreadCount()
|
||||
|
||||
#if RELEASE
|
||||
DispatchQueue.main.async {
|
||||
self.refreshAll(self)
|
||||
@@ -120,7 +88,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
||||
|
||||
// MARK: GetURL Apple Event
|
||||
|
||||
func getURL(_ event: NSAppleEventDescriptor, _ withReplyEvent: NSAppleEventDescriptor) {
|
||||
@objc func getURL(_ event: NSAppleEventDescriptor, _ withReplyEvent: NSAppleEventDescriptor) {
|
||||
|
||||
guard let urlString = event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue else {
|
||||
return
|
||||
@@ -148,7 +116,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
||||
@objc dynamic func updateBadge() {
|
||||
|
||||
let label = unreadCount > 0 ? "\(unreadCount)" : ""
|
||||
NSApplication.shared().dockTile.badgeLabel = label
|
||||
NSApplication.shared.dockTile.badgeLabel = label
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
@@ -165,7 +133,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations {
|
||||
|
||||
func windowControllerWithName(_ storyboardName: String) -> NSWindowController {
|
||||
|
||||
let storyboard = NSStoryboard(name: storyboardName, bundle: nil)
|
||||
let storyboard = NSStoryboard(name: NSStoryboard.Name(rawValue: storyboardName), bundle: nil)
|
||||
return storyboard.instantiateInitialController()! as! NSWindowController
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ import Account
|
||||
|
||||
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
|
||||
|
||||
let cell = outlineView.make(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "DataCell"), owner: self) as! SidebarCell
|
||||
let cell = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "DataCell"), owner: self) as! SidebarCell
|
||||
|
||||
let node = item as! Node
|
||||
configure(cell, node)
|
||||
|
||||
@@ -357,9 +357,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
|
||||
private func rowForArticle(_ article: Article) -> Int {
|
||||
|
||||
if let index = articles.index(where: { (oneArticle) -> Bool in
|
||||
return oneArticle === article
|
||||
}) {
|
||||
if let index = articles.index(where: { $0.articleID == article.articleID }) {
|
||||
return index
|
||||
}
|
||||
|
||||
@@ -406,9 +404,9 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
for oneObject in representedObjects {
|
||||
|
||||
if let oneFeed = oneObject as? Feed {
|
||||
addToAccountArray(accountID: oneFeed.account.identifier, object: oneFeed)
|
||||
addToAccountArray(accountID: oneFeed.account.accountID, object: oneFeed)
|
||||
}
|
||||
else if let oneFolder = oneObject as? Folder, let accountID = oneFolder.account?.identifier {
|
||||
else if let oneFolder = oneObject as? Folder, let accountID = oneFolder.account?.accountID {
|
||||
addToAccountArray(accountID: accountID, object: oneFolder)
|
||||
}
|
||||
}
|
||||
@@ -478,14 +476,14 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
|
||||
func tableView(_ tableView: NSTableView, rowViewForRow row: Int) -> NSTableRowView? {
|
||||
|
||||
let rowView: TimelineTableRowView = tableView.make(withIdentifier: "timelineRow", owner: self) as! TimelineTableRowView
|
||||
let rowView: TimelineTableRowView = tableView.make(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "timelineRow"), owner: self) as! TimelineTableRowView
|
||||
rowView.cellAppearance = cellAppearance
|
||||
return rowView
|
||||
}
|
||||
|
||||
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
||||
|
||||
let cell: TimelineTableCellView = tableView.make(withIdentifier: "timelineCell", owner: self) as! TimelineTableCellView
|
||||
let cell: TimelineTableCellView = tableView.make(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "timelineCell"), owner: self) as! TimelineTableCellView
|
||||
cell.cellAppearance = cellAppearance
|
||||
|
||||
if let article = articleAtRow(row) {
|
||||
@@ -502,7 +500,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
|
||||
var userInfo = [String: AnyObject]()
|
||||
if let article = selectedArticle {
|
||||
userInfo[articleKey] = article
|
||||
userInfo[articleKey] = article as AnyObject
|
||||
}
|
||||
userInfo[viewKey] = self.tableView
|
||||
|
||||
|
||||
Reference in New Issue
Block a user