From 474b27b2e41dcdfc1b7d8da8a68be1b113eaab9e Mon Sep 17 00:00:00 2001 From: Laimonas Turauskas Date: Mon, 9 Sep 2024 14:32:16 -0400 Subject: [PATCH] Remove FragmentComponent (not used). --- .../formula/android/FragmentComponent.kt | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 formula-android/src/main/java/com/instacart/formula/android/FragmentComponent.kt 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 0ef13692a..000000000 --- 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 - ) - } - } -}