diff options
author | Allan Wang <me@allanwang.ca> | 2020-02-23 16:36:31 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2020-02-23 16:36:31 -0800 |
commit | 0dfc1b3e6542b9deca6c56236b46e71e4c6976f5 (patch) | |
tree | d16e4c34b86b0cc236fce32baa38d71f3b7adfbf /app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | |
parent | cd69ccf7c49f486a6c90a7cee0d32a74ea00247d (diff) | |
download | frost-0dfc1b3e6542b9deca6c56236b46e71e4c6976f5.tar.gz frost-0dfc1b3e6542b9deca6c56236b46e71e4c6976f5.tar.bz2 frost-0dfc1b3e6542b9deca6c56236b46e71e4c6976f5.zip |
Remove singleton pattern for fbcookie
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.kt | 10 |
1 files changed, 7 insertions, 3 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 449f0ab0..9fe4c4c9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -35,13 +35,17 @@ import com.pitchedapps.frost.utils.showWebContextMenu import com.pitchedapps.frost.views.FrostWebView import kotlinx.coroutines.channels.SendChannel import kotlinx.coroutines.launch +import org.koin.android.ext.android.inject +import org.koin.core.KoinComponent +import org.koin.core.inject /** * Created by Allan Wang on 2017-06-01. */ class FrostJSI(val web: FrostWebView) { - private val prefs: Prefs = web.prefs + private val fbCookie: FbCookie get() = web.fbCookie + private val prefs: Prefs get() = web.prefs private val context: Context = web.context private val activity: MainActivity? = context as? MainActivity private val header: SendChannel<String>? = activity?.headerBadgeChannel @@ -80,7 +84,7 @@ class FrostJSI(val web: FrostWebView) { @JavascriptInterface fun contextMenu(url: String?, text: String?) { // url will be formatted through webcontext - web.post { context.showWebContextMenu(WebContext(url.takeIf { it.isIndependent }, text)) } + web.post { context.showWebContextMenu(WebContext(url.takeIf { it.isIndependent }, text), fbCookie) } } /** @@ -114,7 +118,7 @@ class FrostJSI(val web: FrostWebView) { fun loadLogin() { L.d { "Sign up button found; load login" } context.ctxCoroutine.launch { - FbCookie.logout(context) + fbCookie.logout(context) } } |