diff --git a/elmslie-core/src/main/java/vivid/money/elmslie/core/store/ElmStore.kt b/elmslie-core/src/main/java/vivid/money/elmslie/core/store/ElmStore.kt index 778a55be..99537e06 100644 --- a/elmslie-core/src/main/java/vivid/money/elmslie/core/store/ElmStore.kt +++ b/elmslie-core/src/main/java/vivid/money/elmslie/core/store/ElmStore.kt @@ -26,7 +26,7 @@ class ElmStore( storeListeners: Set>? = null, override val startEvent: Event? = null, private val key: String = - (reducer::class.java.canonicalName ?: reducer::class.java.simpleName).replace( + (reducer::class.qualifiedName?: reducer::class.simpleName).orEmpty().replace( "Reducer", "Store", ), diff --git a/elmslie-core/src/main/java/vivid/money/elmslie/core/store/Result.kt b/elmslie-core/src/main/java/vivid/money/elmslie/core/store/Result.kt index 412e0096..5c90fb46 100644 --- a/elmslie-core/src/main/java/vivid/money/elmslie/core/store/Result.kt +++ b/elmslie-core/src/main/java/vivid/money/elmslie/core/store/Result.kt @@ -13,8 +13,8 @@ data class Result( command: Command? = null, ) : this( state = state, - effects = effect?.let(::listOf) ?: emptyList(), - commands = command?.let(::listOf) ?: emptyList(), + effects = listOfNotNull(effect), + commands = listOfNotNull(command), ) constructor( diff --git a/elmslie-core/src/main/java/vivid/money/elmslie/core/store/dsl/ScreenDslReducer.kt b/elmslie-core/src/main/java/vivid/money/elmslie/core/store/dsl/ScreenDslReducer.kt index dfc6529b..639aedaf 100644 --- a/elmslie-core/src/main/java/vivid/money/elmslie/core/store/dsl/ScreenDslReducer.kt +++ b/elmslie-core/src/main/java/vivid/money/elmslie/core/store/dsl/ScreenDslReducer.kt @@ -21,9 +21,9 @@ abstract class ScreenDslReducer body.ui(event as Ui) - internalEventClass.java.isAssignableFrom(event.javaClass) -> body.internal(event as Internal) - else -> error("Event ${event.javaClass} is neither UI nor Internal") + uiEventClass.isInstance(event) -> body.ui(event as Ui) + internalEventClass.isInstance(event) -> body.internal(event as Internal) + else -> error("Event ${event::class} is neither UI nor Internal") } return body.build() }