1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-09-19 15:11:42 +02:00

Commit broken entrypoint

This commit is contained in:
Allan Wang 2023-06-20 01:25:17 -07:00
parent 3bd266feb4
commit 45cbab7795
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
4 changed files with 48 additions and 14 deletions

View File

@ -27,13 +27,9 @@ import com.pitchedapps.frost.web.state.TabAction
import com.pitchedapps.frost.web.state.TabAction.ContentAction.UpdateProgressAction
import com.pitchedapps.frost.web.state.TabAction.ContentAction.UpdateTitleAction
import com.pitchedapps.frost.web.state.get
import com.pitchedapps.frost.webview.FrostWeb
import javax.inject.Inject
/** The default chrome client */
class FrostChromeClient
@Inject
internal constructor(@FrostWeb private val tabId: WebTargetId, private val store: FrostWebStore) :
class FrostChromeClient(private val tabId: WebTargetId, private val store: FrostWebStore) :
WebChromeClient() {
private fun FrostWebStore.dispatch(action: TabAction.Action) {

View File

@ -32,9 +32,7 @@ import com.pitchedapps.frost.web.state.TabAction
import com.pitchedapps.frost.web.state.TabAction.ContentAction.UpdateNavigationAction
import com.pitchedapps.frost.web.state.TabAction.ContentAction.UpdateProgressAction
import com.pitchedapps.frost.web.state.TabAction.ContentAction.UpdateTitleAction
import com.pitchedapps.frost.webview.FrostWeb
import java.io.ByteArrayInputStream
import javax.inject.Inject
/**
* Created by Allan Wang on 2017-05-31.
@ -62,10 +60,8 @@ abstract class BaseWebViewClient : WebViewClient() {
}
/** The default webview client */
class FrostWebViewClient
@Inject
internal constructor(
@FrostWeb private val tabId: WebTargetId,
class FrostWebViewClient(
private val tabId: WebTargetId,
private val store: FrostWebStore,
override val webHelper: FrostWebHelper
) : BaseWebViewClient() {

View File

@ -42,6 +42,7 @@ internal constructor(
@ApplicationContext context: Context,
val components: FrostComponents,
val frostCoreExtension: FrostCoreExtension,
// sample: FrostWebEntrySample,
frostWebComposer: FrostWebComposer,
) : ViewModel() {

View File

@ -16,10 +16,20 @@
*/
package com.pitchedapps.frost.webview
import android.webkit.WebViewClient
import com.pitchedapps.frost.compose.webview.FrostWebViewClient
import com.pitchedapps.frost.ext.WebTargetId
import com.pitchedapps.frost.web.FrostWebHelper
import com.pitchedapps.frost.web.state.FrostWebStore
import dagger.BindsInstance
import dagger.Module
import dagger.Provides
import dagger.hilt.DefineComponent
import dagger.hilt.android.components.ViewModelComponent
import dagger.hilt.EntryPoint
import dagger.hilt.EntryPoints
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Inject
import javax.inject.Qualifier
import javax.inject.Scope
@ -35,9 +45,8 @@ annotation class FrostWebScoped
@Qualifier annotation class FrostWeb
@FrostWebScoped @DefineComponent(parent = ViewModelComponent::class) interface FrostWebComponent
@FrostWebScoped @DefineComponent(parent = SingletonComponent::class) interface FrostWebComponent
/** Using this component seems to be buggy, leading to an invalid param tabId error. */
@DefineComponent.Builder
interface FrostWebComponentBuilder {
@ -45,3 +54,35 @@ interface FrostWebComponentBuilder {
fun build(): FrostWebComponent
}
@Module
@InstallIn(FrostWebComponent::class)
internal object FrostWebModule {
@Provides
fun client(
@FrostWeb tabId: WebTargetId,
store: FrostWebStore,
webHelper: FrostWebHelper
): WebViewClient = FrostWebViewClient(tabId, store, webHelper)
}
/**
* Using this injection seems to be buggy, leading to an invalid param tabId error:
*
* Cause: not a valid name: tabId-4xHwVBUParam
*/
class FrostWebEntrySample
@Inject
internal constructor(private val frostWebComponentBuilder: FrostWebComponentBuilder) {
fun test(tabId: WebTargetId): WebViewClient {
val component = frostWebComponentBuilder.tabId(tabId).build()
return EntryPoints.get(component, FrostWebEntryPoint::class.java).client()
}
@EntryPoint
@InstallIn(FrostWebComponent::class)
interface FrostWebEntryPoint {
fun client(): WebViewClient
}
}