diff --git a/domain/src/main/java/com/tangem/domain/redux/ReStoreHub.kt b/domain/src/main/java/com/tangem/domain/redux/ReStoreHub.kt index 1c8bd9314c..72aa9ca605 100644 --- a/domain/src/main/java/com/tangem/domain/redux/ReStoreHub.kt +++ b/domain/src/main/java/com/tangem/domain/redux/ReStoreHub.kt @@ -102,13 +102,24 @@ internal abstract class BaseStoreHub( } protected abstract suspend fun handleAction(action: Action, storeState: DomainState, cancel: ValueCallback) - protected abstract fun reduceAction(action: Action, state: State): State + + @Deprecated( + replaceWith = ReplaceWith("ReStoreReducer"), + message = "must return a Reducer instance. The reducer must be a separate component - this closes " + + "access to the states that can be obtained from ReStoreHub" + ) + abstract fun reduceAction(action: Action, state: State): State +// protected abstract fun getReducer(): ReStoreReducer protected abstract fun getHubState(storeState: DomainState): State protected abstract fun updateStoreState(storeState: DomainState, newHubState: State): DomainState } +internal interface ReStoreReducer { + fun reduceAction(action: Action, state: State): State +} + internal suspend inline fun ReStoreHub<*, *>.dispatchOnMain(vararg actions: Action) { withMainContext { actions.forEach { domainStore.dispatch(it) } } }