aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt9
1 files changed, 9 insertions, 0 deletions
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<String>? = (context as? MainActivity)?.headerBadgeObservable
+
val cookies: ArrayList<CookieModel>
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