aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-01-18 23:23:56 -0500
committerAllan Wang <me@allanwang.ca>2018-01-20 16:42:37 -0500
commitd766100c297bc094491de150f24c04719ffa8f4e (patch)
treeb69863dace2fcb45d5fd25c276ca450e07305c44 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
parent78b3cc41e4c9f8d141ad46ee75e476fa2d177f19 (diff)
downloadfrost-d766100c297bc094491de150f24c04719ffa8f4e.tar.gz
frost-d766100c297bc094491de150f24c04719ffa8f4e.tar.bz2
frost-d766100c297bc094491de150f24c04719ffa8f4e.zip
Enhancement/speed up (#650)
* Revert back to m.facebook * Add initial speedup * Update theme * Fix link press for event status * Move web states to fb const * Fix images and email * Fix up flyweight for requests * Ensure frost request is synchronous * Prepare diff utils * Improve speed and fix blank overlay * Update comments * Add debugger and fix searchview * Theme discover pages. Resolves #654 * Fix duplicate reload * Fix image loading * Update changelog * Update tests * Rename test Update dependencies Update gitignore
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index d0f7d490..f1b30795 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -73,7 +73,10 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
CssHider.SUGGESTED_GROUPS.maybe(!Prefs.showSuggestedGroups && IS_FROST_PRO),
Prefs.themeInjector,
CssHider.NON_RECENT.maybe((web.url?.contains("?sk=h_chr") ?: false)
- && Prefs.aggressiveRecents))
+ && Prefs.aggressiveRecents),
+ JsAssets.DOCUMENT_WATCHER)
+ else
+ refresh.onNext(false)
}
override fun onPageFinished(view: WebView, url: String?) {
@@ -142,7 +145,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
return true
}
if (path.startsWith("/composer/")) return launchRequest(request)
- if (url.contains("scontent-sea1-1.xx.fbcdn.net") && (path.endsWith(".jpg") || path.endsWith(".png")))
+ if (url.isImageUrl)
return launchImage(url)
if (Prefs.linksInDefaultApp && view.context.resolveActivityForUri(request.url)) return true
return super.shouldOverrideUrlLoading(view, request)
@@ -150,6 +153,11 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
}
+private const val EMIT_THEME = 0b1
+private const val EMIT_ID = 0b10
+private const val EMIT_COMPLETE = EMIT_THEME or EMIT_ID
+private const val EMIT_FINISH = 0
+
/**
* Client variant for the menu view
*/
@@ -171,7 +179,9 @@ class FrostWebViewClientMenu(web: FrostWebView) : FrostWebViewClient(web) {
override fun emit(flag: Int) {
super.emit(flag)
- super.injectAndFinish()
+ when (flag) {
+ EMIT_FINISH -> super.injectAndFinish()
+ }
}
override fun onPageFinishedActions(url: String) {