diff --git a/Appcasts/evergreen-beta.xml b/Appcasts/evergreen-beta.xml index 555511890..e0208b2da 100755 --- a/Appcasts/evergreen-beta.xml +++ b/Appcasts/evergreen-beta.xml @@ -6,6 +6,24 @@ Most recent Evergreen changes with links to updates. en + + Version 1.0d31 + Improve the promptness and reliability of user avatars appearing in the timeline.

+

Fix a bug detecting some JSON Feeds — those that use escaping on forward slashes in the text, such as http://curtclifton.net/feed.json

+

Draw a white unread indicator in the timeline when the cell is selected and emphasized.

+

Remove Error Log command from menu, since the Error Log won’t be until after 1.0.

+

Use the git commit number as the build number in Info.plist. Use Curtis Herbert’s script: https://blog.curtisherbert.com/automated-build-numbers/

+

Add Om Malik’s feed to the default list.

+

Check /index.xml when finding a feed when there are no other leads.

+ + ]]>
+ Mon, 08 Jan 2018 13:15:00 -0800 + + 10.13 +
+ Version 1.0d30 Bool - func sendObject(_ object: Any?) + func canSendObject(_ object: Any?, selectedText: String?) -> Bool + func sendObject(_ object: Any?, selectedText: String?) } extension SendToCommand { diff --git a/Commands/SendToMarsEditCommand.swift b/Commands/SendToMarsEditCommand.swift index ca1e29d81..5e221e843 100644 --- a/Commands/SendToMarsEditCommand.swift +++ b/Commands/SendToMarsEditCommand.swift @@ -10,12 +10,12 @@ import Foundation final class SendToMarsEditCommand: SendToCommand { - func canSendObject(_ object: Any?) -> Bool { + func canSendObject(_ object: Any?, selectedText: String?) -> Bool { return false } - func sendObject(_ object: Any?) { + func sendObject(_ object: Any?, selectedText: String?) { } } diff --git a/Commands/SendToMicroBlogCommand.swift b/Commands/SendToMicroBlogCommand.swift index 8260799dc..9af95afed 100644 --- a/Commands/SendToMicroBlogCommand.swift +++ b/Commands/SendToMicroBlogCommand.swift @@ -7,6 +7,7 @@ // import Cocoa +import Data // Not undoable. @@ -21,16 +22,50 @@ final class SendToMicroBlogCommand: SendToCommand { NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive(_:)), name: NSApplication.didBecomeActiveNotification, object: nil) } - func canSendObject(_ object: Any?) -> Bool { + func canSendObject(_ object: Any?, selectedText: String?) -> Bool { - if !appExists { + guard appExists, let article = object as? Article, let _ = article.preferredLink else { return false } - return false + + return true } - func sendObject(_ object: Any?) { + func sendObject(_ object: Any?, selectedText: String?) { + guard canSendObject(object, selectedText: selectedText) else { + return + } + guard let article = object as? Article else { + return + } + + // TODO: get text from contentHTML or contentText if no title and no selectedText. + var s = "" + if let selectedText = selectedText { + s += selectedText + if let link = article.preferredLink { + s += "\n\n\(link)" + } + } + else if let title = article.title { + s += title + if let link = article.preferredLink { + s = "[" + s + "](" + link + ")" + } + } + else if let link = article.preferredLink { + s = link + } + + guard let encodedString = s.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else { + return + } + guard let url = URL(string: "microblog://post?text=" + encodedString) else { + return + } + + let _ = try? NSWorkspace.shared.open(url, options: [], configuration: [:]) } @objc func appDidBecomeActive(_ note: Notification) { diff --git a/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift b/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift index cfc5de7b1..336dda0d7 100644 --- a/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift +++ b/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift @@ -214,7 +214,7 @@ class TimelineTableCellView: NSTableCellView { avatarImageView.wantsLayer = true avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius if avatarImageView.image == nil { - avatarImageView.layer?.backgroundColor = NSColor(calibratedWhite: 0.0, alpha: 0.1).cgColor + avatarImageView.layer?.backgroundColor = NSColor(calibratedWhite: 0.0, alpha: 0.05).cgColor } else { avatarImageView.layer?.backgroundColor = NSColor.clear.cgColor diff --git a/Evergreen/MainWindow/Timeline/TimelineViewController.swift b/Evergreen/MainWindow/Timeline/TimelineViewController.swift index d822d7d98..f96072ab0 100644 --- a/Evergreen/MainWindow/Timeline/TimelineViewController.swift +++ b/Evergreen/MainWindow/Timeline/TimelineViewController.swift @@ -119,6 +119,7 @@ class TimelineViewController: NSViewController, UndoableCommandRunner { NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .FeedIconDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(imageDidBecomeAvailable(_:)), name: .ImageDidBecomeAvailable, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(imageDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil) NSUserDefaultsController.shared.addObserver(self, forKeyPath: timelineFontSizeKVOKey, options: NSKeyValueObservingOptions(rawValue: 0), context: nil) @@ -351,7 +352,9 @@ class TimelineViewController: NSViewController, UndoableCommandRunner { @objc func imageDidBecomeAvailable(_ note: Notification) { - queueReloadAvailableCells() + if showAvatars { + queueReloadAvailableCells() + } } func fontSizeInDefaultsDidChange() {