radityagumay
04/21/2018, 2:42 AMinterface WeatherRepository {
fun fetchWeather() : Single<List<Weather>>
}
class WeatherDataStore (private val service: WeatherService) : WeatherRepository {
override fun fetchWeather() : Single<List<Weather>> {
return service.fetchWeather()
.compose(singleIo())
}
}
class WeatherPresenter (private val repository : WeatherRepository) {
fun fetchWeather() {
repository.fetchWeather().subscribe({ success ->
// todo
}, { error ->
// todo
})
}
}