-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing FlowFactory and Flow. #380
Conversation
JaCoCo Code Coverage 88.59% ✅
Generated by 🚫 Danger |
fde869a
to
0e53190
Compare
} | ||
} | ||
|
||
|
||
private val lifecycleEvents = PublishRelay.create<FragmentLifecycleEvent>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this logic is moved into FragmentFlowStoreFormula
.
9fe4eb4
to
95c0dcd
Compare
* Defines how specific keys bind to the state management associated | ||
*/ | ||
@PublishedApi | ||
internal abstract class Binding<in ParentComponent> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for an abstract binding class anymore
@@ -1,6 +0,0 @@ | |||
package com.instacart.formula.android.internal | |||
|
|||
internal class Bindings<in Component>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed as we expose List<FeatureBinding<>>
directly
output = Unit, | ||
actions = context.actions { | ||
val isInScope = input.activeFragments.any { binds(it.key) } | ||
Action.onData(isInScope).onEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't have scopes anymore, we don't need CompositeBinding
anymore
*/ | ||
internal class FeatureBinding<in Component, in Dependencies, in Key : FragmentKey>( | ||
private val type: Class<Key>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified this to a simple class with properties and moved logic to FragmentFlowStoreFormula
) | ||
} | ||
|
||
private fun initFeature( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved from FeatureBinding
import com.instacart.formula.android.FragmentKey | ||
|
||
@PublishedApi | ||
internal class MappedFeatureFactory<Component, Dependencies, Key : FragmentKey>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature factory that maps Component
to Dependency
internally
) | ||
} | ||
|
||
@Test fun `component is shared between flow features`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed flow related tests
@@ -29,26 +30,30 @@ class FragmentAndroidEventTest { | |||
initialContract = TestLifecycleKey() | |||
}, | |||
contracts = { | |||
|
|||
bind<TestLifecycleKey> { _, _ -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed bind
with a lambda within FragmentStoreBuilder
95c0dcd
to
2e08ceb
Compare
@PublishedApi | ||
internal inline fun <Component> build( | ||
init: FragmentStoreBuilder<Component>.() -> Unit | ||
): Bindings<Component> { | ||
): List<FeatureBinding<Component, *>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make sure to bump the version to note that this is not a backwards compatible change.
What
Removing
FlowFactory
andFlow
because it's a rarely used feature and it's not built well. Instead, if this functionality is needed, it should be built outside theformula-android
module.FragmentFlowStoreFormula
and moved most logic fromFragmentFlowStore
thereBindings
,Binding
andCompositeBinding
classes