I want to make changes to existing flow of data loading such that I call a new cache API without changing any logical change to anything else.
I have a observable variable of type Weather. I want to call another Completable API which simply stores a boolean in the shared preference. This new API is completable as I don't expect any result from it.
How can I add this completable call to the observable so whenever someone subscribes to the observable, I simply execute the completable.
fun fetchWeather(): Observable<Weather> {
return weatherObservable
.startWithItem(
// Weather Object
)
}
fun hasWeatherFetched(): Completable {
// Call shared preference
}