From 8b2f9b333af436bd57520c8888b7f2773942168a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 9 Jan 2018 21:09:09 -0800 Subject: [PATCH 1/5] Make feed icons and favicons show up more quickly and reliably in the timeline. --- Evergreen/MainWindow/Timeline/TimelineViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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() { From ccc699741d4c7318ae9007aa81cf4a7a4bf243db Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 9 Jan 2018 21:33:13 -0800 Subject: [PATCH 2/5] Decrease the opacity of the placeholder color for avatars in the timeline. --- Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From f324e65f16164a36d1efaa6e1b91a96f5dc32e37 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 9 Jan 2018 22:04:45 -0800 Subject: [PATCH 3/5] Make further progress on sending to MarsEdit and Micro.blog. --- Commands/SendToCommand.swift | 6 ++-- Commands/SendToMarsEditCommand.swift | 4 +-- Commands/SendToMicroBlogCommand.swift | 46 ++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/Commands/SendToCommand.swift b/Commands/SendToCommand.swift index ec56f3338..413ddb8c1 100644 --- a/Commands/SendToCommand.swift +++ b/Commands/SendToCommand.swift @@ -8,10 +8,12 @@ import Cocoa +// Unlike UndoableCommand commands, you instantiate one of each of these and reuse them. + protocol SendToCommand { - func canSendObject(_ object: Any?) -> 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..f0f401f52 100644 --- a/Commands/SendToMicroBlogCommand.swift +++ b/Commands/SendToMicroBlogCommand.swift @@ -7,6 +7,7 @@ // import Cocoa +import Data // Not undoable. @@ -21,16 +22,53 @@ 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 else { return false } - return false + guard let article = object as? Article else { + return false + } + guard let _ = article.preferredLink else { + 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 + ")" + } + } + + 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) { From 790a6f6d2dde15b8e7ce7a619b0960fe9b3fbff8 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 10 Jan 2018 13:59:33 -0800 Subject: [PATCH 4/5] Update app cast for 1.0d31. --- Appcasts/evergreen-beta.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 Date: Wed, 10 Jan 2018 14:00:06 -0800 Subject: [PATCH 5/5] Continue work on send to Micro.blog. --- Commands/SendToMicroBlogCommand.swift | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Commands/SendToMicroBlogCommand.swift b/Commands/SendToMicroBlogCommand.swift index f0f401f52..9af95afed 100644 --- a/Commands/SendToMicroBlogCommand.swift +++ b/Commands/SendToMicroBlogCommand.swift @@ -24,13 +24,7 @@ final class SendToMicroBlogCommand: SendToCommand { func canSendObject(_ object: Any?, selectedText: String?) -> Bool { - guard appExists else { - return false - } - guard let article = object as? Article else { - return false - } - guard let _ = article.preferredLink else { + guard appExists, let article = object as? Article, let _ = article.preferredLink else { return false } @@ -60,6 +54,9 @@ final class SendToMicroBlogCommand: SendToCommand { s = "[" + s + "](" + link + ")" } } + else if let link = article.preferredLink { + s = link + } guard let encodedString = s.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else { return