mirror of
https://github.com/hmalik144/Weather-apps.git
synced 2026-01-31 02:51:46 +00:00
- minor code clean up
This commit is contained in:
@@ -5,7 +5,6 @@ import com.appttude.h_mal.atlas_weather.data.repository.Repository
|
||||
import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
|
||||
import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
|
||||
import com.appttude.h_mal.atlas_weather.model.types.LocationType
|
||||
import com.appttude.h_mal.atlas_weather.model.types.UnitType
|
||||
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
|
||||
import com.appttude.h_mal.atlas_weather.utils.getSymbol
|
||||
import java.io.IOException
|
||||
@@ -34,8 +33,10 @@ class WeatherSource(
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
suspend fun forceFetchWeather(latLon: Pair<Double, Double>,
|
||||
locationType: LocationType = LocationType.Town): FullWeather {
|
||||
suspend fun forceFetchWeather(
|
||||
latLon: Pair<Double, Double>,
|
||||
locationType: LocationType = LocationType.Town
|
||||
): FullWeather {
|
||||
// get data from database
|
||||
val weatherEntity = repository.loadSingleCurrentWeatherFromRoom(CURRENT_LOCATION)
|
||||
// check unit type - if same do nothing
|
||||
|
||||
@@ -51,7 +51,7 @@ fun <T> createRetrofit(
|
||||
return Retrofit.Builder()
|
||||
.client(okHttpClient)
|
||||
.baseUrl(baseUrl)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(createGsonConverterFactory())
|
||||
.build()
|
||||
.create(service)
|
||||
}
|
||||
@@ -58,7 +58,7 @@ data class DailyWeather(
|
||||
days.sunsetEpoch,
|
||||
days.tempmin,
|
||||
days.tempmax,
|
||||
days.temp?.toDouble(),
|
||||
days.temp,
|
||||
days.feelslike,
|
||||
days.pressure?.toInt(),
|
||||
days.humidity?.toInt(),
|
||||
@@ -72,7 +72,7 @@ data class DailyWeather(
|
||||
days.conditions,
|
||||
days.datetimeEpoch,
|
||||
days.cloudcover?.toInt(),
|
||||
days.precipprob?.toDouble(),
|
||||
days.precipprob,
|
||||
days.uvindex?.toDouble(),
|
||||
days.precip?.toDouble()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user