From 1b801cfe66db6f6ebcef9da201ae0535d83c21e5 Mon Sep 17 00:00:00 2001 From: Laimonas Turauskas Date: Wed, 25 Sep 2024 14:07:00 -0400 Subject: [PATCH] Pass FragmentId to FeatureFactory. --- .../java/com/instacart/formula/android/FeatureFactory.kt | 5 +++-- .../com/instacart/formula/android/FragmentEnvironment.kt | 2 +- .../formula/android/internal/MappedFeatureFactory.kt | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/formula-android/src/main/java/com/instacart/formula/android/FeatureFactory.kt b/formula-android/src/main/java/com/instacart/formula/android/FeatureFactory.kt index 05402b84..5d13c455 100644 --- a/formula-android/src/main/java/com/instacart/formula/android/FeatureFactory.kt +++ b/formula-android/src/main/java/com/instacart/formula/android/FeatureFactory.kt @@ -39,6 +39,7 @@ abstract class FeatureFactory { inner class Params( val dependencies: @UnsafeVariance Dependencies, + val fragmentId: FragmentId, val key: @UnsafeVariance Key, ) @@ -50,7 +51,7 @@ abstract class FeatureFactory { /** * Initializes state observable and a view factory for a specific [key]. */ - fun initialize(dependencies: Dependencies, key: Key): Feature { - return Params(dependencies, key).initialize() + fun initialize(dependencies: Dependencies, fragmentId: FragmentId, key: Key): Feature { + return Params(dependencies, fragmentId, key).initialize() } } diff --git a/formula-android/src/main/java/com/instacart/formula/android/FragmentEnvironment.kt b/formula-android/src/main/java/com/instacart/formula/android/FragmentEnvironment.kt index acebe07d..aec45bcd 100644 --- a/formula-android/src/main/java/com/instacart/formula/android/FragmentEnvironment.kt +++ b/formula-android/src/main/java/com/instacart/formula/android/FragmentEnvironment.kt @@ -30,7 +30,7 @@ data class FragmentEnvironment( dependencies: DependenciesT, key: KeyT, ): Feature { - return factory.initialize(dependencies, key) + return factory.initialize(dependencies, fragmentId, key) } /** diff --git a/formula-android/src/main/java/com/instacart/formula/android/internal/MappedFeatureFactory.kt b/formula-android/src/main/java/com/instacart/formula/android/internal/MappedFeatureFactory.kt index e1f3efb4..1978d68e 100644 --- a/formula-android/src/main/java/com/instacart/formula/android/internal/MappedFeatureFactory.kt +++ b/formula-android/src/main/java/com/instacart/formula/android/internal/MappedFeatureFactory.kt @@ -12,6 +12,7 @@ internal class MappedFeatureFactory( override fun Params.initialize(): Feature { return delegate.initialize( dependencies = toDependencies(dependencies), + fragmentId = fragmentId, key = key, ) }