From 32dae64b835d82a2f9a60ae68b26038678066645 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 10 Jan 2018 14:00:06 -0800 Subject: [PATCH] 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