aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-15 20:41:55 -0700
committerAllan Wang <me@allanwang.ca>2017-06-15 20:41:55 -0700
commitf84a05f8aeb73ce63f77b7cc779845c31427b2b2 (patch)
treeb11309b4649c5e7e1f4666e9a07e60da56b1c307 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
parentc8f76b5aa406f84f49789a50871c68a1a95a232d (diff)
downloadfrost-f84a05f8aeb73ce63f77b7cc779845c31427b2b2.tar.gz
frost-f84a05f8aeb73ce63f77b7cc779845c31427b2b2.tar.bz2
frost-f84a05f8aeb73ce63f77b7cc779845c31427b2b2.zip
Reorganize observables and clean up
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
index e4ff4e10..07b9a949 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
@@ -22,12 +22,14 @@ import io.reactivex.subjects.Subject
/**
* Created by Allan Wang on 2017-05-31.
*/
-open class FrostWebViewClient(val refreshObservable: Subject<Boolean>) : WebViewClient() {
+open class FrostWebViewClient(val webCore: FrostWebViewCore) : WebViewClient() {
+
+ val refreshObservable: Subject<Boolean> = webCore.refreshObservable
override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) {
super.onPageStarted(view, url, favicon)
L.i("FWV Loading $url")
- L.v("Cookies ${CookieManager.getInstance().getCookie(url)}")
+// L.v("Cookies ${CookieManager.getInstance().getCookie(url)}")
refreshObservable.onNext(true)
if (!url.contains(FACEBOOK_COM)) return
if (url.contains("logout.php")) FbCookie.logout(Prefs.userId, { launchLogin(view.context) })
@@ -49,16 +51,16 @@ open class FrostWebViewClient(val refreshObservable: Subject<Boolean>) : WebView
}
L.i("Page finished $url")
JsActions.LOGIN_CHECK.inject(view)
- onPageFinishedActions(view as FrostWebViewCore, url)
+ onPageFinishedActions(url)
}
- open internal fun onPageFinishedActions(view: FrostWebViewCore, url: String?) {
- onPageFinishedActions(view)
+ open internal fun onPageFinishedActions(url: String?) {
+ injectAndFinish()
}
- internal fun onPageFinishedActions(view: FrostWebViewCore) {
+ internal fun injectAndFinish() {
L.d("Page finished reveal")
- view.jsInject(CssHider.HEADER,
+ webCore.jsInject(CssHider.HEADER,
Prefs.themeInjector,
JsAssets.CLICK_INTERCEPTOR,
callback = {