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