diff options
author | Allan Wang <me@allanwang.ca> | 2020-02-29 19:29:09 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2020-02-29 19:29:09 -0800 |
commit | c5d38e5122bcb452b1e61ea6526434cf62e9da8c (patch) | |
tree | 3b31b15cd40fc81738592b8cb8af15fe23450d65 /app/src/main/kotlin/com/pitchedapps/frost/views | |
parent | a93cdf52cc3b7eff1e2d4cf436b8f8dbc3cf14a2 (diff) | |
download | frost-c5d38e5122bcb452b1e61ea6526434cf62e9da8c.tar.gz frost-c5d38e5122bcb452b1e61ea6526434cf62e9da8c.tar.bz2 frost-c5d38e5122bcb452b1e61ea6526434cf62e9da8c.zip |
Update koin usage
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt | 6 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt index 16df7f8e..ec822bfa 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt @@ -41,7 +41,7 @@ import com.devbrackets.android.exomedia.listener.VideoControlsVisibilityListener import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.databinding.ViewVideoBinding -import com.pitchedapps.frost.db.FrostDatabase +import com.pitchedapps.frost.db.CookieDao import com.pitchedapps.frost.db.currentCookie import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs @@ -88,6 +88,7 @@ class FrostVideoViewer @JvmOverloads constructor( } private val prefs: Prefs by inject() + private val cookieDao: CookieDao by inject() private val binding: ViewVideoBinding = ViewVideoBinding.inflate(LayoutInflater.from(context), this, true) @@ -116,8 +117,7 @@ class FrostVideoViewer @JvmOverloads constructor( when (it.itemId) { R.id.action_pip -> video.isExpanded = false R.id.action_download -> context.ctxCoroutine.launchMain { - val cookie = - FrostDatabase.get().cookieDao().currentCookie() ?: return@launchMain + val cookie = cookieDao.currentCookie(prefs) ?: return@launchMain context.frostDownload(cookie, video.videoUri) } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt index dd31d303..9ca622a3 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt @@ -28,6 +28,7 @@ import ca.allanwang.kau.utils.launchMain import com.pitchedapps.frost.contracts.FrostContentContainer import com.pitchedapps.frost.contracts.FrostContentCore import com.pitchedapps.frost.contracts.FrostContentParent +import com.pitchedapps.frost.db.CookieDao import com.pitchedapps.frost.db.FrostDatabase import com.pitchedapps.frost.db.currentCookie import com.pitchedapps.frost.facebook.FB_HOME_URL @@ -62,6 +63,7 @@ class FrostWebView @JvmOverloads constructor( val fbCookie: FbCookie by inject() val prefs: Prefs by inject() + val cookieDao: CookieDao by inject() override fun reload(animate: Boolean) { if (parent.registerTransition(false, animate)) @@ -92,10 +94,9 @@ class FrostWebView @JvmOverloads constructor( webChromeClient = FrostChromeClient(this) addJavascriptInterface(FrostJSI(this), "Frost") setBackgroundColor(Color.TRANSPARENT) - val db = FrostDatabase.get() setDownloadListener { url, userAgent, contentDisposition, mimetype, contentLength -> context.ctxCoroutine.launchMain { - val cookie = db.cookieDao().currentCookie() ?: return@launchMain + val cookie = cookieDao.currentCookie(prefs) ?: return@launchMain context.frostDownload( cookie, url, |