From 2bc366f8f4501a93d773c8a6d8ad103d05cce08d Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 27 Sep 2018 20:36:01 -0400 Subject: Fix method signatures --- .../com/pitchedapps/frost/facebook/parsers/FrostParser.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'app/src') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt index 90d2a214..3d5c5bce 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt @@ -104,22 +104,19 @@ internal abstract class FrostParserBase(private val redirectToText: protected abstract fun parseImpl(doc: Document): T? - // protected abstract fun parse(doc: Document): T? - /** * Attempts to find inner element with some style containing a url * Returns the formatted url, or an empty string if nothing was found */ - protected fun Element.getInnerImgStyle() = + protected fun Element.getInnerImgStyle(): String? = select("i.img[style*=url]").getStyleUrl() - protected fun Elements.getStyleUrl() = + protected fun Elements.getStyleUrl(): String? = FB_CSS_URL_MATCHER.find(attr("style"))[1]?.formattedFbUrl - protected open fun textToDoc(text: String): Document = if (!redirectToText) - Jsoup.parse(text) - else - throw RuntimeException("${this::class.java.simpleName} requires text redirect but did not implement textToDoc") + protected open fun textToDoc(text: String): Document? = + if (!redirectToText) Jsoup.parse(text) + else throw RuntimeException("${this::class.java.simpleName} requires text redirect but did not implement textToDoc") protected fun parseLink(element: Element?): FrostLink? { val a = element?.getElementsByTag("a")?.first() ?: return null -- cgit v1.2.3