From 6abaf596e4db5a36057f6a8acf31b72f57a12e18 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 17 Apr 2021 20:06:36 -0700 Subject: Remove koin dependency in production --- app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt | 3 +-- .../main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt | 8 ++++++-- app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt index dc375a8d..187e7d4e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt @@ -37,7 +37,6 @@ import com.pitchedapps.frost.utils.isFacebookUrl import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import org.koin.core.component.KoinComponent import java.io.File import javax.inject.Inject @@ -51,7 +50,7 @@ class DebugWebView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : WebView(context, attrs, defStyleAttr), KoinComponent { +) : WebView(context, attrs, defStyleAttr) { @Inject lateinit var prefs: Prefs diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt index 43b7071e..e687dd2d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt @@ -32,6 +32,7 @@ import com.afollestad.materialdialogs.callbacks.onDismiss import com.afollestad.materialdialogs.input.input import com.pitchedapps.frost.R import com.pitchedapps.frost.contracts.ActivityContract +import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.frostSnackbar import com.pitchedapps.frost.views.FrostWebView @@ -46,7 +47,10 @@ import kotlinx.coroutines.channels.SendChannel /** * The default chrome client */ -class FrostChromeClient(web: FrostWebView) : WebChromeClient() { +class FrostChromeClient( + web: FrostWebView, + private val themeProvider: ThemeProvider +) : WebChromeClient() { private val refresh: SendChannel = web.parent.refreshChannel private val progress: SendChannel = web.parent.progressChannel @@ -80,7 +84,7 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { fileChooserParams: FileChooserParams ): Boolean { activity?.openFileChooser(filePathCallback, fileChooserParams) - ?: webView.frostSnackbar(R.string.file_chooser_not_found) + ?: webView.frostSnackbar(R.string.file_chooser_not_found, themeProvider) return activity != null } 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 12e10e10..0d7bbb79 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -84,7 +84,8 @@ class FrostJSI(val web: FrostWebView) { web.post { context.showWebContextMenu( WebContext(url.takeIf { it.isIndependent }, text), - fbCookie + fbCookie, + prefs ) } } -- cgit v1.2.3