aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-19 15:31:10 -0700
committerAllan Wang <me@allanwang.ca>2017-06-19 15:31:10 -0700
commit382433780c3f4403723a78e409cb161c9fad5034 (patch)
tree1138696bdd6e04d2227acaa4ab19ee8b85b4d2f8 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
parent0720413ee859762fc4c2d8748ba10402dffd0be7 (diff)
downloadfrost-382433780c3f4403723a78e409cb161c9fad5034.tar.gz
frost-382433780c3f4403723a78e409cb161c9fad5034.tar.bz2
frost-382433780c3f4403723a78e409cb161c9fad5034.zip
Parse header badges
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