ResoCoder / forecast-mvvm-android-kotlin

Forecast MVVM app as found in the free course.
https://www.youtube.com/playlist?list=PLB6lc7nQ1n4jTLDyU2muTBo8xk0dg0D_w
339 stars 163 forks source link

lastWeatherLocation #9

Closed EkeKoseoglu closed 5 years ago

EkeKoseoglu commented 5 years ago

Queries that return LiveData, are working asynchronously, so weahterDao.getLocation().value statement in the repository is always returning null. That's why isFetchCurrentNeeded is never triggered. In order to fix this bug, declare lastWeatherLocation as a nullable property of ForecastRepositoryImpl and set it when downloadedCurrentWeather has changed.

ResoDev commented 5 years ago

Thank you, I will solve it in a bit different manner in the next tutorial. Again, I cannot merge this pr since I need to show it on video.