diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-31 18:57:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-31 18:57:28 -0500 |
commit | 149c6be1bfd4bd84381757940fece1be7b9801aa (patch) | |
tree | 85fe10e3ee3ea34ad717f0d61975ca0119dd36d5 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | |
parent | 7661bbfc9b8f34bf9d92dc08a9fcd7cc6ec7cbb3 (diff) | |
download | frost-149c6be1bfd4bd84381757940fece1be7b9801aa.tar.gz frost-149c6be1bfd4bd84381757940fece1be7b9801aa.tar.bz2 frost-149c6be1bfd4bd84381757940fece1be7b9801aa.zip |
Enhancement/coroutines (#1273)
* Convert rest of fbcookie to suspended methods
* Replace active checks with yield
* Apply spotless
* Switch cookie domain to exact url
* Optimize imports and enable travis tests again
* Update proguard rules
* Remove unnecessary yield
* Remove unused flyweight
* Remove unused disposable and method
* Use contexthelper instead of dispatcher main
* Convert login activity to coroutines
* Use kau helper methods for coroutines
* Enhancement/offline site (#1288)
* Begin conversion of offline site logic
* Fix offline tests and add validation tests
* Ignore cookie in jsoup if it is blank
* Force load and zip to be in io
* Use different zip files to fix tests
* Log all test output
* Do not log stdout
* Allow test skip for fb offline
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 | 14 |
1 files changed, 10 insertions, 4 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 c8b54e7a..19d16e87 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -16,31 +16,35 @@ */ package com.pitchedapps.frost.web +import android.content.Context import android.webkit.JavascriptInterface import com.pitchedapps.frost.activities.MainActivity import com.pitchedapps.frost.contracts.MainActivityContract import com.pitchedapps.frost.contracts.VideoViewHolder +import com.pitchedapps.frost.dbflow.CookieModel import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.WebContext import com.pitchedapps.frost.utils.cookies +import com.pitchedapps.frost.utils.ctxCoroutine 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 /** * Created by Allan Wang on 2017-06-01. */ class FrostJSI(val web: FrostWebView) { - private val context = web.context - private val activity = context as? MainActivity + private val context: Context = web.context + private val activity: MainActivity? = context as? MainActivity private val header: SendChannel<String>? = activity?.headerBadgeChannel private val refresh: SendChannel<Boolean> = web.parent.refreshChannel - private val cookies = activity?.cookies() ?: arrayListOf() + private val cookies: List<CookieModel> = activity?.cookies() ?: arrayListOf() /** * Attempts to load the url in an overlay @@ -103,7 +107,9 @@ class FrostJSI(val web: FrostWebView) { @JavascriptInterface fun loadLogin() { L.d { "Sign up button found; load login" } - FbCookie.logout(context) + context.ctxCoroutine.launch { + FbCookie.logout(context) + } } /** |