aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/facebook
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-09-27 19:56:25 -0400
committerAllan Wang <me@allanwang.ca>2018-09-27 19:56:25 -0400
commit3aa44ba16e52ceaf37dd28a8075b302c42785526 (patch)
treef072ae062c404c0d87cb7cbc4aeb4d23e604a3e6 /app/src/main/kotlin/com/pitchedapps/frost/facebook
parentd3e11bbaaf497682f2e62a20b2866e2b05b8ba16 (diff)
downloadfrost-3aa44ba16e52ceaf37dd28a8075b302c42785526.tar.gz
frost-3aa44ba16e52ceaf37dd28a8075b302c42785526.tar.bz2
frost-3aa44ba16e52ceaf37dd28a8075b302c42785526.zip
Fix more lints
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt2
2 files changed, 4 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt
index cfa2796c..05467dfa 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt
@@ -1,5 +1,7 @@
package com.pitchedapps.frost.facebook
+import org.apache.commons.text.StringEscapeUtils
+
/**
* Created by Allan Wang on 21/12/17.
*
@@ -22,7 +24,7 @@ val FB_USER_MATCHER: Regex by lazy { Regex("c_user=([0-9]*);") }
val FB_EPOCH_MATCHER: Regex by lazy { Regex(":([0-9]+)") }
val FB_NOTIF_ID_MATCHER: Regex by lazy { Regex("notif_([0-9]+)") }
-val FB_MESSAGE_NOTIF_ID_MATCHER: Regex by lazy { Regex("[thread|user]_fbid_([0-9]+)") }
+val FB_MESSAGE_NOTIF_ID_MATCHER: Regex by lazy { Regex("(?:thread|user)_fbid_([0-9]+)") }
val FB_CSS_URL_MATCHER: Regex by lazy { Regex("url\\([\"|']?(.*?)[\"|']?\\)") }
val FB_JSON_URL_MATCHER: Regex by lazy { Regex("\"(http.*?)\"") }
val FB_IMAGE_ID_MATCHER: Regex by lazy { Regex("fbcdn.*?/[0-9]+_([0-9]+)_") }
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 5d023023..90d2a214 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
@@ -116,7 +116,7 @@ internal abstract class FrostParserBase<out T : Any>(private val redirectToText:
protected fun Elements.getStyleUrl() =
FB_CSS_URL_MATCHER.find(attr("style"))[1]?.formattedFbUrl
- protected open fun textToDoc(text: String) = if (!redirectToText)
+ 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")