aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-11-23 18:29:05 -0800
committerGitHub <noreply@github.com>2021-11-23 18:29:05 -0800
commit120ad1520db9184ebfa00885066e06a9f976e5f6 (patch)
tree50835fa79cf15ff348be386c46cea0a05552ba74 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
parente246b35323e27dd18fa48910e5ca95669b53f8b0 (diff)
parentdb646e23ce0047461e68be1af7021ce6171ac850 (diff)
downloadfrost-120ad1520db9184ebfa00885066e06a9f976e5f6.tar.gz
frost-120ad1520db9184ebfa00885066e06a9f976e5f6.tar.bz2
frost-120ad1520db9184ebfa00885066e06a9f976e5f6.zip
Merge pull request #1857 from AllanWang/flows
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.kt13
1 files changed, 7 insertions, 6 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 3ead78f4..4d92e8c2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -32,24 +32,24 @@ import com.pitchedapps.frost.utils.isIndependent
import com.pitchedapps.frost.utils.launchImageActivity
import com.pitchedapps.frost.utils.showWebContextMenu
import com.pitchedapps.frost.views.FrostWebView
-import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.launch
import javax.inject.Inject
/**
* Created by Allan Wang on 2017-06-01.
*/
+@FrostWebScoped
class FrostJSI @Inject internal constructor(
val web: FrostWebView,
private val activity: Activity,
private val fbCookie: FbCookie,
- private val prefs: Prefs
+ private val prefs: Prefs,
+ @FrostRefresh private val refreshEmit: FrostEmitter<Boolean>
) {
private val mainActivity: MainActivity? = activity as? MainActivity
private val webActivity: WebOverlayActivityBase? = activity as? WebOverlayActivityBase
- private val header: SendChannel<String>? = mainActivity?.headerBadgeChannel
- private val refresh: SendChannel<Boolean> = web.parent.refreshChannel
+ private val headerEmit: FrostEmitter<String>? = mainActivity?.headerEmit
private val cookies: List<CookieEntity> = activity.cookies()
/**
@@ -144,7 +144,8 @@ class FrostJSI @Inject internal constructor(
@JavascriptInterface
fun isReady() {
if (web.frostWebClient !is FrostWebViewClientMenu) {
- refresh.offer(false)
+ L.v { "JSI is ready" }
+ refreshEmit(false)
}
}
@@ -157,7 +158,7 @@ class FrostJSI @Inject internal constructor(
@JavascriptInterface
fun handleHeader(html: String?) {
html ?: return
- header?.offer(html)
+ headerEmit?.invoke(html)
}
@JavascriptInterface