Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the ResultWire injectable parameter of the BaseRouter class #171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fun interface ResultListenerHandler {
fun dispose()
}

internal class ResultWire {
class ResultWire {
private val listeners = mutableMapOf<String, ResultListener>()

fun setResultListener(key: String, listener: ResultListener): ResultListenerHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down