Created
October 5, 2019 12:16
-
-
Save SeongUgJung/676f381577d090d474186e045fedcf52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InteractorController(private val mapProvider:MapProvider, | |
private varargs val interactors: Interactor) { | |
fun onInit(): Completable { | |
return mapProvider.initMap() | |
.switchMapCompletable { map -> | |
Observable.fromIterable(mapInteractors.asIterable()) | |
.flatMapCompletable { mapInteractor -> | |
mapInteractor.onInit(map) | |
} | |
} | |
.subscribe(Functions.EMPTY_ACTION, Consumer { Timber.e(it) }) | |
} | |
fun onVisible(): Completable { | |
return mapProvider.getMap() | |
.switchMapCompletable { map -> | |
Observable.fromIterable(mapInteractors.asIterable()) | |
.flatMapCompletable { mapInteractor -> | |
mapInteractor.onVisible(map) | |
} | |
} | |
.subscribe(Functions.EMPTY_ACTION, Consumer { Timber.e(it) }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment