diff --git a/formula-android/src/main/java/com/instacart/formula/android/FragmentComponent.kt b/formula-android/src/main/java/com/instacart/formula/android/FragmentComponent.kt deleted file mode 100644 index 0ef13692..00000000 --- a/formula-android/src/main/java/com/instacart/formula/android/FragmentComponent.kt +++ /dev/null @@ -1,75 +0,0 @@ -package com.instacart.formula.android - -import com.instacart.formula.Renderer -import com.instacart.formula.RenderView - -/** - * [FragmentComponent] defines the way the [FormulaFragment] can interact - * with outside world. This class has a [RenderView] that will handle state rendering - * and also provides a way to listen to fragment lifecycle events. - */ -class FragmentComponent private constructor( - val renderView: RenderView, - val lifecycleCallbacks: FragmentLifecycleCallback? = null -) { - companion object { - /** - * A no-op component which does no rendering - */ - fun noOp(): FragmentComponent { - return create( - render = {} - ) - } - - /** - * Creates an inline render view with the given render lambda - * @param render called on each change to the [RenderModel] to render the view - */ - fun create( - render: (T) -> Unit - ): FragmentComponent { - return create( - renderView = object : RenderView { - override val render: Renderer = Renderer.create(render) - }, - lifecycleCallbacks = null - ) - } - - /** - * Creates an inline render view with the given render lambda - * - * @param render called on each change to the [RenderModel] to render the view - * @param lifecycleCallbacks Fragment lifecycle callbacks. - */ - fun create( - render: (T) -> Unit, - lifecycleCallbacks: FragmentLifecycleCallback - ): FragmentComponent { - return create( - renderView = object : RenderView { - override val render: Renderer = Renderer(render) - }, - lifecycleCallbacks = lifecycleCallbacks - ) - } - - /** - * With the given [renderView] and optional [lifecycleCallbacks], provides the needed integration between - * the fragment and the [io.reactivex.rxjava3.core.Observable] stream of [RenderModel]s - * @param renderView the render view which will receive [RenderModel]s - * @param lifecycleCallbacks optional lifecycle callbacks that correspond to the fragment lifecycle. - * Only provide if needed - */ - fun create( - renderView: RenderView, - lifecycleCallbacks: FragmentLifecycleCallback? = null - ): FragmentComponent { - return FragmentComponent( - renderView = renderView, - lifecycleCallbacks = lifecycleCallbacks - ) - } - } -}