aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-01-03 23:10:53 -0500
committerGitHub <noreply@github.com>2019-01-03 23:10:53 -0500
commit82f79a7d368caad4068d97051ad8deddd05b4f7e (patch)
treebfaca5c42f0ffb878c58b21b72731610f4da879a /app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
parentbc6566bc92d073e64a8c51a681ff01ba973d7ee7 (diff)
downloadfrost-82f79a7d368caad4068d97051ad8deddd05b4f7e.tar.gz
frost-82f79a7d368caad4068d97051ad8deddd05b4f7e.tar.bz2
frost-82f79a7d368caad4068d97051ad8deddd05b4f7e.zip
Add asset preloader (#1311)
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt8
1 files changed, 8 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 3f92c41d..4410b26e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -70,8 +70,11 @@ import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.FbUrlFormatter.Companion.VIDEO_REDIRECT
import com.pitchedapps.frost.facebook.USER_AGENT_BASIC
import com.pitchedapps.frost.facebook.formattedFbUrl
+import com.pitchedapps.frost.injectors.CssAssets
+import com.pitchedapps.frost.injectors.JsAssets
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import org.apache.commons.text.StringEscapeUtils
import org.jsoup.Jsoup
@@ -421,3 +424,8 @@ fun String.unescapeHtml(): String =
StringEscapeUtils.unescapeXml(this)
.replace("\\u003C", "<")
.replace("\\\"", "\"")
+
+suspend fun Context.loadAssets(): Unit = coroutineScope {
+ CssAssets.load(this@loadAssets)
+ JsAssets.load(this@loadAssets)
+}