aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-15 13:46:41 -0700
committerGitHub <noreply@github.com>2017-08-15 13:46:41 -0700
commit19ec9b543e15fe453b576f1b38994b3f8692054f (patch)
tree99600f87160b492de453a7f249bf3b258b5ef990 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
parent203305e1890f9e23caa80d7ad6921767f830a4da (diff)
downloadfrost-19ec9b543e15fe453b576f1b38994b3f8692054f.tar.gz
frost-19ec9b543e15fe453b576f1b38994b3f8692054f.tar.bz2
frost-19ec9b543e15fe453b576f1b38994b3f8692054f.zip
Add checks before injections (#180)
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.kt17
1 files changed, 9 insertions, 8 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 5f679c65..2ebf2c0c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -51,7 +51,7 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
if (url == null) return
L.i("FWV Loading", url)
refreshObservable.onNext(true)
- if (!url.contains(FACEBOOK_COM)) return
+ if (!url.isFacebookUrl) return
if (url.contains("logout.php")) FbCookie.logout(Prefs.userId, { launchLogin(view.context) })
else if (url.contains("login.php")) FbCookie.reset({ launchLogin(view.context) })
}
@@ -71,18 +71,19 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
override fun onPageCommitVisible(view: WebView, url: String?) {
super.onPageCommitVisible(view, url)
injectBackgroundColor()
- view.jsInject(
- CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
- CssHider.HEADER,
- CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends && IS_FROST_PRO),
- Prefs.themeInjector,
- CssHider.NON_RECENT.maybe(webCore.url?.contains("?sk=h_chr") ?: false))
+ if (url.isFacebookUrl)
+ view.jsInject(
+ CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
+ CssHider.HEADER,
+ CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends && IS_FROST_PRO),
+ Prefs.themeInjector,
+ CssHider.NON_RECENT.maybe(webCore.url?.contains("?sk=h_chr") ?: false))
}
override fun onPageFinished(view: WebView, url: String?) {
url ?: return
L.i("Page finished", url)
- if (!url.contains(FACEBOOK_COM)) {
+ if (!url.isFacebookUrl) {
refreshObservable.onNext(false)
return
}