diff --git a/library/src/main/kotlin/com/github/terrakok/cicerone/BaseRouter.kt b/library/src/main/kotlin/com/github/terrakok/cicerone/BaseRouter.kt index 24e5423..0479043 100644 --- a/library/src/main/kotlin/com/github/terrakok/cicerone/BaseRouter.kt +++ b/library/src/main/kotlin/com/github/terrakok/cicerone/BaseRouter.kt @@ -5,9 +5,9 @@ package com.github.terrakok.cicerone * * Extend it to add needed transition methods. */ -abstract class BaseRouter { +abstract class BaseRouter(private val resultWire: ResultWire = ResultWire()) { internal val commandBuffer = CommandBuffer() - private val resultWire = ResultWire() + /** * Sets data listener with given key diff --git a/library/src/main/kotlin/com/github/terrakok/cicerone/ResultWire.kt b/library/src/main/kotlin/com/github/terrakok/cicerone/ResultWire.kt index 524096f..153c008 100644 --- a/library/src/main/kotlin/com/github/terrakok/cicerone/ResultWire.kt +++ b/library/src/main/kotlin/com/github/terrakok/cicerone/ResultWire.kt @@ -14,7 +14,7 @@ fun interface ResultListenerHandler { fun dispose() } -internal class ResultWire { +class ResultWire { private val listeners = mutableMapOf() fun setResultListener(key: String, listener: ResultListener): ResultListenerHandler { diff --git a/library/src/main/kotlin/com/github/terrakok/cicerone/Router.kt b/library/src/main/kotlin/com/github/terrakok/cicerone/Router.kt index 40a2298..eabe774 100644 --- a/library/src/main/kotlin/com/github/terrakok/cicerone/Router.kt +++ b/library/src/main/kotlin/com/github/terrakok/cicerone/Router.kt @@ -7,7 +7,7 @@ package com.github.terrakok.cicerone * This implementation covers almost all cases needed for the average app. * Extend it if you need some tricky navigation. */ -open class Router : BaseRouter() { +open class Router(resultWire: ResultWire = ResultWire()) : BaseRouter(resultWire) { /** * Open new screen and add it to the screens chain. *