aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-03-29 19:25:00 -0700
committerAllan Wang <me@allanwang.ca>2020-03-29 19:25:00 -0700
commita51f349c8682ba26ea28a63b845d80a8c2aeeebf (patch)
tree53524eedf825717c334cbb8fd9b20e365db76ea2 /app/src/main/kotlin/com/pitchedapps/frost/utils
parentb6e1b70e860773f8040dfe5e70bbd88b6d3c7e7c (diff)
downloadfrost-a51f349c8682ba26ea28a63b845d80a8c2aeeebf.tar.gz
frost-a51f349c8682ba26ea28a63b845d80a8c2aeeebf.tar.bz2
frost-a51f349c8682ba26ea28a63b845d80a8c2aeeebf.zip
Encode url query
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index 6db7179d..a8e7c64c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -81,6 +81,8 @@ import org.apache.commons.text.StringEscapeUtils
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
+import java.net.URLEncoder
+import java.nio.charset.StandardCharsets
/**
* Created by Allan Wang on 2017-06-03.
@@ -370,6 +372,9 @@ val dependentSegments = arrayOf(
inline val String?.isExplicitIntent
get() = this != null && (startsWith("intent://") || startsWith("market://"))
+fun String.urlEncode(): String =
+ URLEncoder.encode(this, StandardCharsets.UTF_8.name())
+
fun Context.frostChangelog() = showChangelog(R.xml.frost_changelog)
fun Context.frostUriFromFile(file: File): Uri =