Package 

Class DeprecatedKt

    • Method Summary

      Modifier and Type Method Description
      final static Unit Subscribe(ConsumerScope<?, ?> $self) Equivalent to calling ConsumerScope.consume.
      final static <A extends MVIAction> Unit Subscribe(ConsumerScope<?, A> $self, SuspendFunction2<CoroutineScope, A, Unit> onAction) Equivalent to calling ConsumerScope.consume.
      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.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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 logic
        lifecycleState - the minimum lifecycle state, in which the activity must be to receive actions/states
        content - 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.