-
public final class DeprecatedKt
-
-
Method Summary
Modifier and Type Method Description final static UnitSubscribe(ConsumerScope<?, ?> $self)Equivalent to calling ConsumerScope.consume. final static <A extends MVIAction> UnitSubscribe(ConsumerScope<?, A> $self, SuspendFunction2<CoroutineScope, A, Unit> onAction)Equivalent to calling ConsumerScope.consume. final static <I extends MVIIntent, A extends MVIAction> UnitEmptyScope(Function1<ConsumerScope<I, A>, Unit> call)A no-op scope for testing and preview purposes. final static <S extends MVIState, I extends MVIIntent, A extends MVIAction> UnitMVIComposable(Store<S, I, A> store, Lifecycle.State lifecycleState, Function2<ConsumerScope<I, A>, S, Unit> content)A function that introduces ConsumerScope to the content and ensures safe lifecycle-aware and efficient collection of states and actions. final static <S extends MVIState, I extends MVIIntent, A extends MVIAction> UnitMVIComposable(Store<S, I, A> store, Lifecycle.State lifecycleState, SuspendFunction2<CoroutineScope, A, Unit> consume, Function2<ConsumerScope<I, A>, S, Unit> content)An overload of MVIComposable that accepts a consume block to automatically subscribe to the store upon invocation. -
-
Method Detail
-
Subscribe
final static Unit Subscribe(ConsumerScope<?, ?> $self)
Equivalent to calling ConsumerScope.consume.
-
Subscribe
final static <A extends MVIAction> Unit Subscribe(ConsumerScope<?, A> $self, SuspendFunction2<CoroutineScope, A, Unit> onAction)
Equivalent to calling ConsumerScope.consume.
-
EmptyScope
final static <I extends MVIIntent, A extends MVIAction> Unit EmptyScope(Function1<ConsumerScope<I, A>, Unit> call)
A no-op scope for testing and preview purposes. ConsumerScope.send and ConsumerScope.consume do nothing
-
MVIComposable
final static <S extends MVIState, I extends MVIIntent, A extends MVIAction> Unit MVIComposable(Store<S, I, A> store, Lifecycle.State lifecycleState, Function2<ConsumerScope<I, A>, S, Unit> content)
A function that introduces ConsumerScope to the content and ensures safe lifecycle-aware and efficient collection of states and actions.
Use ConsumerScope.consume to subscribe to the store
Usage:
@Composable fun HomeScreen() = MVIComposable(getViewModel<HomeViewModel>()) { // this: ConsumerScope<S, I, A> consume { action -> when(action) { /*...*/ } } when(state) { //use state to render content } }- Parameters:
store- a Store (usually a androidx.lifecycle.ViewModel) that handles this screen's logiclifecycleState- the minimum lifecycle state, in which the activity must be to receive actions/statescontent- the actual screen content.
-
MVIComposable
final static <S extends MVIState, I extends MVIIntent, A extends MVIAction> Unit MVIComposable(Store<S, I, A> store, Lifecycle.State lifecycleState, SuspendFunction2<CoroutineScope, A, Unit> consume, Function2<ConsumerScope<I, A>, S, Unit> content)
An overload of MVIComposable that accepts a consume block to automatically subscribe to the store upon invocation.
-
-
-
-