From 382433780c3f4403723a78e409cb161c9fad5034 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 19 Jun 2017 15:31:10 -0700 Subject: Parse header badges --- app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt index 36193b8b..532b9f82 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -10,12 +10,16 @@ import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.cookies import com.pitchedapps.frost.utils.launchNewTask import com.pitchedapps.frost.utils.launchWebOverlay +import io.reactivex.subjects.Subject /** * Created by Allan Wang on 2017-06-01. */ class FrostJSI(val context: Context, val webView: FrostWebViewCore) { + + val headerObservable: Subject? = (context as? MainActivity)?.headerBadgeObservable + val cookies: ArrayList get() = (context as? MainActivity)?.cookies() ?: arrayListOf() @@ -51,4 +55,9 @@ class FrostJSI(val context: Context, val webView: FrostWebViewCore) { webView.post { webView.frostWebClient!!.handleHtml(html) } } + @JavascriptInterface + fun handleHeader(html: String) { + headerObservable?.onNext(html) + } + } \ No newline at end of file -- cgit v1.2.3