- minor code clean up

This commit is contained in:
2024-09-30 10:04:54 +01:00
parent 24da85d20d
commit 8507116e5a
3 changed files with 7 additions and 6 deletions

View File

@@ -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

View File

@@ -51,7 +51,7 @@ fun <T> createRetrofit(
return Retrofit.Builder()
.client(okHttpClient)
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.addConverterFactory(createGsonConverterFactory())
.build()
.create(service)
}

View File

@@ -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()
)