From cb095feeec64d8db57cd84d6f562e564723e6ed8 Mon Sep 17 00:00:00 2001 From: pranshulgg Date: Mon, 14 Sep 2026 21:54:58 +0530 Subject: [PATCH] use real-time instead of outdated saved timestamp closes #1088 --- .../core/model/domain/weather/Weather.kt | 1 - .../computing/summary/ComputeDaySummary.kt | 3 ++- .../data/local/WeatherMasterDatabase.kt | 22 +++++++++++++------ .../entity/weather/CurrentWeatherEntity.kt | 4 ---- .../mapper/weather/WeatherDomainMapper.kt | 1 - .../weather/WeatherWithRelationsMapper.kt | 4 ++-- .../weather/sources/accu/AccuJsonMapper.kt | 1 - .../weather/sources/aemet/AemetJsonMapper.kt | 1 - .../weather/sources/bmkg/BmkgJsonMapper.kt | 1 - .../weather/sources/china/ChinaJsonMapper.kt | 1 - .../weather/sources/cwa/CwaJsonMapper.kt | 1 - .../weather/sources/dwd/DwdJsonMapper.kt | 1 - .../weather/sources/eccc/EcccJsonMapper.kt | 1 - .../weather/sources/fmi/FmiXmlMapper.kt | 1 - .../sources/gismeteo/GismeteoJsonMapper.kt | 1 - .../weather/sources/imd/ImdJsonMapper.kt | 1 - .../weather/sources/inmet/InmetJsonMapper.kt | 2 -- .../weather/sources/ipma/IpmaJsonMapper.kt | 1 - .../weather/sources/jma/JmaJsonMapper.kt | 1 - .../sources/meteoam/MeteoamJsonMapper.kt | 1 - .../meteofrance/MeteFranceJsonMapper.kt | 1 - .../sources/metnorway/MetNorwayJsonMapper.kt | 1 - .../sources/metoffice/MetOfficeJsonMapper.kt | 1 - .../weather/sources/nws/NwsJsonMapper.kt | 1 - .../sources/openmeteo/OpenMeteoJsonMapper.kt | 1 - .../openweather/OpenWeatherJsonMapper.kt | 1 - .../pirateweather/PirateWeatherMapper.kt | 1 - .../weather/sources/smhi/SmhiJsonMapper.kt | 1 - .../SendGadgetBridgeWeatherData.kt | 3 ++- .../worker/widgets/WidgetWeatherMapper.kt | 4 ++-- .../screens/airquality/AirQualityScreen.kt | 6 ++--- .../blocks/screens/humidity/HumidityScreen.kt | 4 +++- .../screens/precipitation/RainScreen.kt | 4 +++- .../screens/precipitation/SnowScreen.kt | 4 +++- .../blocks/screens/pressure/PressureScreen.kt | 4 +++- .../blocks/screens/uvindex/UvIndexScreen.kt | 4 +++- .../screens/visibility/VisibilityScreen.kt | 4 +++- .../feature/blocks/screens/wind/WindScreen.kt | 4 +++- .../locations/ui/LocationsScreenContent.kt | 3 ++- .../main/components/FroggyContainer.kt | 3 ++- .../feature/main/ui/BackgroundGradients.kt | 3 ++- .../feature/main/ui/CurrentWeatherCard.kt | 5 +++-- .../ui/weatherAnimations/WeatherAnimations.kt | 3 ++- .../mapper/NotificationWeatherMapper.kt | 2 +- gradle/libs.versions.toml | 16 +++++++------- 45 files changed, 67 insertions(+), 67 deletions(-) diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/core/model/domain/weather/Weather.kt b/app/src/main/java/com/pranshulgg/weather_master_app/core/model/domain/weather/Weather.kt index 4ab2ba5a8..d8d888eb8 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/core/model/domain/weather/Weather.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/core/model/domain/weather/Weather.kt @@ -23,7 +23,6 @@ data class WeatherCurrent( val uvIndex: Double?, val weatherCondition: WeatherCondition, val feelsLike: Double?, - val time: Long, // NOTE: ALWAYS MILLISECONDS val dewPoint: Double?, val utcOffsetSeconds: Long?, val lastUpdatedInMilli: Long diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/core/utils/weather/computing/summary/ComputeDaySummary.kt b/app/src/main/java/com/pranshulgg/weather_master_app/core/utils/weather/computing/summary/ComputeDaySummary.kt index 2fea03981..fd341b8fa 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/core/utils/weather/computing/summary/ComputeDaySummary.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/core/utils/weather/computing/summary/ComputeDaySummary.kt @@ -10,6 +10,7 @@ import com.pranshulgg.weather_master_app.core.model.domain.weather.WeatherUnits import com.pranshulgg.weather_master_app.core.model.weather.WeatherCondition import com.pranshulgg.weather_master_app.core.model.weather.toLabel import com.pranshulgg.weather_master_app.core.prefs.AppPrefsState +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.safeZoneId import com.pranshulgg.weather_master_app.core.utils.locale.getCurrentAppLocale import com.pranshulgg.weather_master_app.core.utils.weather.computing.computeDailyWeatherCondition @@ -36,7 +37,7 @@ fun computeDaySummary( val currentIndex = findHourlyIndexForTime( hourly.map { it.time }, - weather.current.time + getCurrentTimeFor(weather.location.timezone) ) diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt index 81c85b70c..32b0c164a 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt @@ -3,8 +3,10 @@ package com.pranshulgg.weather_master_app.data.local import android.content.Context import androidx.room.AutoMigration import androidx.room.Database +import androidx.room.DeleteColumn import androidx.room.Room import androidx.room.RoomDatabase +import androidx.room.migration.AutoMigrationSpec import androidx.room.migration.Migration import androidx.sqlite.db.SupportSQLiteDatabase import com.pranshulgg.weather_master_app.data.local.dao.airquality.AirQualityDao @@ -31,6 +33,12 @@ import com.pranshulgg.weather_master_app.data.local.entity.weather.blocks.Weathe import com.pranshulgg.weather_master_app.data.local.entity.weather.nws.NwsGridPointsEntity import com.pranshulgg.weather_master_app.data.local.entity.weather.units.AppWeatherUnitsEntity +@DeleteColumn( + tableName = "weather_current", + columnName = "time" +) +class WeatherCurrentDeleteTimeSpec : AutoMigrationSpec + @Database( entities = [ WeatherLocationEntity::class, @@ -47,7 +55,7 @@ import com.pranshulgg.weather_master_app.data.local.entity.weather.units.AppWeat AlertEntity::class, ApiKeyEntity::class ], - version = 59, + version = 60, autoMigrations = [ AutoMigration(from = 39, to = 40), AutoMigration(from = 42, to = 43), @@ -62,9 +70,11 @@ import com.pranshulgg.weather_master_app.data.local.entity.weather.units.AppWeat AutoMigration(from = 54, to = 55), AutoMigration(from = 56, to = 57), AutoMigration(from = 57, to = 58), - AutoMigration(from = 58, to = 59) - ] + AutoMigration(from = 58, to = 59), + AutoMigration(from = 59, to = 60, spec = WeatherCurrentDeleteTimeSpec::class) + ], ) + abstract class WeatherMasterDatabase : RoomDatabase() { abstract fun weatherContextDao(): WeatherContextDao @@ -74,11 +84,8 @@ abstract class WeatherMasterDatabase : RoomDatabase() { abstract fun airQualityDao(): AirQualityDao abstract fun nwsDao(): NwsDao abstract fun githubDao(): GithubDao - abstract fun locationKeysDao(): LocationKeysDao - abstract fun alertsDao(): AlertsDao - abstract fun apiKeysDao(): ApiKeysDao companion object { @@ -217,4 +224,5 @@ val MIGRATION_55_56 = object : Migration(55, 56) { ) } } -} \ No newline at end of file +} + diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/entity/weather/CurrentWeatherEntity.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/entity/weather/CurrentWeatherEntity.kt index e29295d21..4f909a586 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/entity/weather/CurrentWeatherEntity.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/entity/weather/CurrentWeatherEntity.kt @@ -22,7 +22,6 @@ import com.pranshulgg.weather_master_app.data.local.entity.location.WeatherLocat ) data class CurrentWeatherEntity( val locationId: String, - val temperature: Double?, val humidity: Double?, val windSpeed: Double?, @@ -33,10 +32,7 @@ data class CurrentWeatherEntity( val uvIndex: Double?, val weatherCondition: WeatherCondition, val feelsLike: Double?, - val time: Long, val dewPoint: Double?, - val utcOffsetSeconds: Long?, - val lastUpdatedInMilli: Long ) \ No newline at end of file diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherDomainMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherDomainMapper.kt index ad20c6421..7b2606b92 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherDomainMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherDomainMapper.kt @@ -25,7 +25,6 @@ fun WeatherCurrent.toCurrentWeatherEntity( uvIndex = uvIndex, weatherCondition = weatherCondition, feelsLike = feelsLike, - time = time, dewPoint = dewPoint, utcOffsetSeconds = utcOffsetSeconds, lastUpdatedInMilli = lastUpdatedInMilli diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherWithRelationsMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherWithRelationsMapper.kt index 6bb793a9b..830798a57 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherWithRelationsMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/WeatherWithRelationsMapper.kt @@ -7,6 +7,7 @@ import com.pranshulgg.weather_master_app.core.model.domain.weather.WeatherCurren import com.pranshulgg.weather_master_app.core.model.domain.weather.WeatherDaily import com.pranshulgg.weather_master_app.core.model.domain.weather.WeatherHourly import com.pranshulgg.weather_master_app.core.model.weather.WeatherCondition +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.safeZoneId import com.pranshulgg.weather_master_app.core.utils.weather.cache.isWeatherDomainSafe import com.pranshulgg.weather_master_app.data.local.entity.weather.DailyWeatherEntity @@ -23,7 +24,7 @@ fun WeatherWithRelations.toDomain(): Weather? { // DROP PAST DAYS val todayIndex = getDailyIndexForToday( - current?.time ?: System.currentTimeMillis(), + getCurrentTimeFor(timezone), daily, timezone ).coerceAtLeast(0) @@ -54,7 +55,6 @@ fun WeatherWithRelations.toDomain(): Weather? { uvIndex = current?.uvIndex, weatherCondition = current?.weatherCondition ?: WeatherCondition.NO_CONDITION_FOUND, feelsLike = current?.feelsLike, - time = current?.time ?: -1L, dewPoint = current?.dewPoint, utcOffsetSeconds = current?.utcOffsetSeconds, lastUpdatedInMilli = current?.lastUpdatedInMilli ?: -1L diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/accu/AccuJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/accu/AccuJsonMapper.kt index 33a26e814..b38cb0681 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/accu/AccuJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/accu/AccuJsonMapper.kt @@ -58,7 +58,6 @@ fun AccuWeatherBundle.toDomain(location: Location): Weather { uvIndex = current.uvIndex, weatherCondition = AccuWeatherConditionMap.getCondition(current.weatherIcon), feelsLike = current.feelsLike.metric.value, - time = current.time.secondsToMilliseconds(), dewPoint = current.dewPoint.metric.value, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/aemet/AemetJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/aemet/AemetJsonMapper.kt index 32a86e75e..e58e3cd89 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/aemet/AemetJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/aemet/AemetJsonMapper.kt @@ -76,7 +76,6 @@ fun AemetForecastJson.toDomain(location: Location): Weather { uvIndex = null, weatherCondition = current?.condition ?: WeatherCondition.NO_CONDITION_FOUND, feelsLike = current?.feelsLike, - time = currentTime, dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/bmkg/BmkgJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/bmkg/BmkgJsonMapper.kt index db39cfa69..2f15fb293 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/bmkg/BmkgJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/bmkg/BmkgJsonMapper.kt @@ -46,7 +46,6 @@ fun BmkgForecastBundle.toDomain(location: Location): Weather { current.humidity, WindSpeedUnit.KPH.convert(current.windSpeed, WindSpeedUnit.MPS) ), - time = current.datetime.iso8601TimestampToMilliseconds(), dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/china/ChinaJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/china/ChinaJsonMapper.kt index 3c038b77e..6f90d46a9 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/china/ChinaJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/china/ChinaJsonMapper.kt @@ -64,7 +64,6 @@ fun ChinaForecastJson.toDomain(location: Location): Weather { current.weather.toSafeDouble()?.toInt() ), feelsLike = current.feelsLike.value.toSafeDouble(), - time = current.pubTime.iso8601TimestampToMilliseconds(), dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/cwa/CwaJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/cwa/CwaJsonMapper.kt index 41bc242fe..8a1fcf064 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/cwa/CwaJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/cwa/CwaJsonMapper.kt @@ -89,7 +89,6 @@ fun CwaForecastBundle.toDomain(location: Location): Weather { uvIndex = null, weatherCondition = current?.condition ?: WeatherCondition.NO_CONDITION_FOUND, feelsLike = current?.feelsLike, - time = currentTime, dewPoint = current?.dewPoint, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/dwd/DwdJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/dwd/DwdJsonMapper.kt index 4771867c1..d16985f17 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/dwd/DwdJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/dwd/DwdJsonMapper.kt @@ -47,7 +47,6 @@ fun DwdWeatherJsonBundle.toDomain(location: Location): Weather { current.humidity?.toDouble(), current.windSpeed?.kmhToMs() ), - time = current.timestamp.iso8601TimestampToMilliseconds(), dewPoint = current.dewPoint, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/eccc/EcccJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/eccc/EcccJsonMapper.kt index 13a9279ae..158f604d6 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/eccc/EcccJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/eccc/EcccJsonMapper.kt @@ -85,7 +85,6 @@ fun EcccWeatherJson.toDomain(location: Location): Weather { WindSpeedUnit.MPS ) ), - time = current.timeStamp.iso8601TimestampToMilliseconds(), dewPoint = current.dewpoint.metric?.toSafeDouble(), utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/fmi/FmiXmlMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/fmi/FmiXmlMapper.kt index 33553c844..ab558f8c6 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/fmi/FmiXmlMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/fmi/FmiXmlMapper.kt @@ -108,7 +108,6 @@ fun FmiWeather.toDomain(location: Location): Weather { currentDataForParam("rh"), currentDataForParam("ws_10min") ), - time = if (current != null) current["t2m"]?.get(0)!!.time!!.iso8601TimestampToMilliseconds() else forecast.keys.sorted()[currentHour], dewPoint = currentDataForParam("td"), utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/gismeteo/GismeteoJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/gismeteo/GismeteoJsonMapper.kt index 82a9bd82f..224db137a 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/gismeteo/GismeteoJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/gismeteo/GismeteoJsonMapper.kt @@ -71,7 +71,6 @@ fun GismeteoModel.toDomain(location: Location): Weather { uvIndex = null, weatherCondition = GismeteoWeatherConditionMap.getCondition(current.icon), feelsLike = current.feelsLike, - time = fixTimeString(current.time).iso8601TimestampToMilliseconds(), dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis(), diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/imd/ImdJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/imd/ImdJsonMapper.kt index 5d6ae2b14..e076159e3 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/imd/ImdJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/imd/ImdJsonMapper.kt @@ -159,7 +159,6 @@ fun ImdForecastModel.toDomain(location: Location): Weather { WindSpeedUnit.MPS ), ), - time = currentTime, dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/inmet/InmetJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/inmet/InmetJsonMapper.kt index a39b39de5..e6116c767 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/inmet/InmetJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/inmet/InmetJsonMapper.kt @@ -340,7 +340,6 @@ private fun createCurrentFromObservation( uvIndex = null, weatherCondition = WeatherCondition.NO_CONDITION_FOUND, feelsLike = computeApparentTemperature(temp, humidity, windMs), - time = timeMilli, dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() @@ -399,7 +398,6 @@ private fun createCurrentFromForecast( uvIndex = null, weatherCondition = condition, feelsLike = computeApparentTemperature(temp, humidity, windMs), - time = System.currentTimeMillis(), dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/ipma/IpmaJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/ipma/IpmaJsonMapper.kt index 0e4057979..4ecfb2dd0 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/ipma/IpmaJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/ipma/IpmaJsonMapper.kt @@ -79,7 +79,6 @@ fun List.toDomain(location: Location): Weather { current.humidity.toSafeDouble(), WindSpeedUnit.KPH.convert(current.windSpeed.toSafeDouble(), WindSpeedUnit.MPS) ), - time = nowMillis, dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/jma/JmaJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/jma/JmaJsonMapper.kt index 2ee1e6a62..11aaec7d7 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/jma/JmaJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/jma/JmaJsonMapper.kt @@ -144,7 +144,6 @@ fun JmaForecastBundle.toDomain(location: Location): Weather { uvIndex = null, weatherCondition = nearestHourPoint?.condition ?: WeatherCondition.NO_CONDITION_FOUND, feelsLike = amedasFeelsLike, - time = currentTime, dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteoam/MeteoamJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteoam/MeteoamJsonMapper.kt index 3a084d0b0..b9c8a782d 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteoam/MeteoamJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteoam/MeteoamJsonMapper.kt @@ -88,7 +88,6 @@ fun MeteoamWeatherBundle.toDomain(location: Location): Weather { current.temperature.value, current.humidity.value, WindSpeedUnit.KPH.convert(current.windSpeedKmh.value, WindSpeedUnit.MPS) ), - time = time.iso8601TimestampToMilliseconds(), dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteofrance/MeteFranceJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteofrance/MeteFranceJsonMapper.kt index a27731c2d..62ebd64d9 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteofrance/MeteFranceJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/meteofrance/MeteFranceJsonMapper.kt @@ -52,7 +52,6 @@ fun MeteoFranceForecastJson.toDomain(location: Location): Weather { forecast[currentHour].temperature, forecast[currentHour].humidity?.toDouble(), forecast[currentHour].windSpeed?.toDouble() ), - time = forecast[currentHour].time.secondsToMilliseconds(), dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metnorway/MetNorwayJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metnorway/MetNorwayJsonMapper.kt index 1052b09fa..097b61b7b 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metnorway/MetNorwayJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metnorway/MetNorwayJsonMapper.kt @@ -61,7 +61,6 @@ fun MetNorwayForecastJson.toDomain(location: Location): Weather { current.instant.details.relativeHumidity, current.instant.details.windSpeed ), - time = currentTime, dewPoint = current.instant.details.dewPoint, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metoffice/MetOfficeJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metoffice/MetOfficeJsonMapper.kt index e0413090a..f45b95eae 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metoffice/MetOfficeJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/metoffice/MetOfficeJsonMapper.kt @@ -70,7 +70,6 @@ fun MetOfficeForecastJson.toDomain(location: Location): Weather { uvIndex = hourly[currentHourIndex].uvIndex, weatherCondition = MetOfficeWeatherConditionMap.getCondition(hourly[currentHourIndex].significantWeatherCode), feelsLike = hourly[currentHourIndex].feelsLikeTemperature, - time = currentTime, dewPoint = hourly[currentHourIndex].screenDewPointTemperature, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/nws/NwsJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/nws/NwsJsonMapper.kt index 658111de9..38e87632b 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/nws/NwsJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/nws/NwsJsonMapper.kt @@ -129,7 +129,6 @@ fun NwsWeatherJsonBundle.toDomain(location: Location): Weather { current.relativeHumidity.value, current.windSpeed.value?.kmhToMs() ), - time = current.timestamp.iso8601TimestampToMilliseconds(), dewPoint = hourly.periods[currentHourIndex].dewPoint.value, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openmeteo/OpenMeteoJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openmeteo/OpenMeteoJsonMapper.kt index 628c7f950..18666c7be 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openmeteo/OpenMeteoJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openmeteo/OpenMeteoJsonMapper.kt @@ -62,7 +62,6 @@ fun OpenMeteoWeatherJson.toDomain(location: Location): Weather { uvIndex = current.uvIndex, weatherCondition = OpenMeteoWeatherConditionMap.getCondition(current.weatherCode), feelsLike = current.feelsLike, - time = current.time.secondsToMilliseconds(), // Open-Meteo returns in seconds dewPoint = hourly.dewPoint[currentHourIndex], utcOffsetSeconds = utcOffsetSeconds, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openweather/OpenWeatherJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openweather/OpenWeatherJsonMapper.kt index 1ab4420b0..01d2dda8b 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openweather/OpenWeatherJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/openweather/OpenWeatherJsonMapper.kt @@ -64,7 +64,6 @@ fun OpenWeatherJsonBundle.toDomain(location: Location): Weather { uvIndex = null, weatherCondition = OpenWeatherConditionMap.getCondition(current.weather[0].icon), feelsLike = current.main.feelsLike, - time = current.dt.secondsToMilliseconds(), dewPoint = current.main.dewPoint, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/pirateweather/PirateWeatherMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/pirateweather/PirateWeatherMapper.kt index 12acb5dad..f80499160 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/pirateweather/PirateWeatherMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/pirateweather/PirateWeatherMapper.kt @@ -66,7 +66,6 @@ private fun PirateWeatherCurrentJson.toWeatherCurrent( uvIndex = uvIndex, weatherCondition = PirateWeatherConditionMap.getCondition(icon), feelsLike = apparentTemperature, - time = time.secondsToMilliseconds(), dewPoint = dewPoint, utcOffsetSeconds = utcOffsetSeconds, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/smhi/SmhiJsonMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/smhi/SmhiJsonMapper.kt index 7a1ddc99a..9fbeb7255 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/smhi/SmhiJsonMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/mapper/weather/sources/smhi/SmhiJsonMapper.kt @@ -53,7 +53,6 @@ fun SmhiForecastJson.toDomain(location: Location): Weather { current.humidity?.toDouble(), current.windSpeed ), - time = currentTime, dewPoint = null, utcOffsetSeconds = null, lastUpdatedInMilli = System.currentTimeMillis() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/gadgetbridge/SendGadgetBridgeWeatherData.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/gadgetbridge/SendGadgetBridgeWeatherData.kt index 4b62ff655..d81e97f9b 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/gadgetbridge/SendGadgetBridgeWeatherData.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/gadgetbridge/SendGadgetBridgeWeatherData.kt @@ -7,6 +7,7 @@ import com.pranshulgg.weather_master_app.core.model.domain.weather.Weather import com.pranshulgg.weather_master_app.core.model.weather.WeatherCondition import com.pranshulgg.weather_master_app.core.model.weather.toLabel import com.pranshulgg.weather_master_app.core.model.weather.wind.WindDirection +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import org.json.JSONArray import org.json.JSONObject import kotlin.math.roundToInt @@ -15,7 +16,7 @@ import kotlin.math.roundToInt fun sendGadgetBridgeWeatherData(context: Context, weather: Weather) { try { val rootWeatherJson = JSONObject().apply { - put("timestamp", weather.current.time / 1000L) + put("timestamp", getCurrentTimeFor(weather.location.timezone) / 1000L) put("location", weather.location.name) put("currentTemp", weather.current.temperature?.inKelvin()) put("todayMinTemp", weather.daily[0].temperatureMin?.inKelvin()) diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/widgets/WidgetWeatherMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/widgets/WidgetWeatherMapper.kt index 26cb6e2ed..630583588 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/widgets/WidgetWeatherMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/worker/widgets/WidgetWeatherMapper.kt @@ -35,12 +35,12 @@ fun widgetWeatherMapper( val currentCondition = weather.current.weatherCondition.toLabel(applicationContext) val currentIcon = weather.current.weatherCondition.toIcon( - targetTimeMilli = weather.current.time, + targetTimeMilli = getCurrentTimeFor(timezone), daily = weather.daily.firstOrNull() ) val currentFrogIcon = weather.current.weatherCondition.toFroggy( - targetTimeMilli = weather.current.time, + targetTimeMilli = getCurrentTimeFor(timezone), daily = weather.daily.firstOrNull() ) diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/airquality/AirQualityScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/airquality/AirQualityScreen.kt index 0229d896c..f0025ad62 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/airquality/AirQualityScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/airquality/AirQualityScreen.kt @@ -33,6 +33,7 @@ import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn import com.pranshulgg.weather_master_app.core.utils.extensions.DateTimeExtensions.secondsToMilliseconds +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString import com.pranshulgg.weather_master_app.core.utils.weather.airquality.AirQualityColors import com.pranshulgg.weather_master_app.feature.blocks.BlocksScreenViewModel @@ -46,13 +47,12 @@ fun AirQualityScreen(navController: NavController, index: Int = 0, locationId: S val viewModel: BlocksScreenViewModel = hiltViewModel() - - val airQuality = viewModel.weather.collectAsState().value.airQuality ?: return val weather = viewModel.weather.collectAsState().value.weather ?: return val hourly = airQuality.hourly - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val context = LocalContext.current val date = toDateString(weather.daily[index].time, weather.location.timezone) diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/humidity/HumidityScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/humidity/HumidityScreen.kt index 9b8d48031..cc66f7432 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/humidity/HumidityScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/humidity/HumidityScreen.kt @@ -36,6 +36,7 @@ import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn import com.pranshulgg.weather_master_app.core.ui.components.Symbol +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString import com.pranshulgg.weather_master_app.core.utils.weather.forecast.findMatchingHourly import com.pranshulgg.weather_master_app.feature.blocks.BlocksScreenViewModel @@ -55,7 +56,8 @@ fun HumidityScreen(navController: NavController, index: Int = 0, locationId: Str val weather = viewModel.weather.collectAsState().value.weather val hourly = weather?.hourly ?: return val units = viewModel.units.collectAsState().value.units - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val context = LocalContext.current val data = findMatchingHourly( hourly, diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/RainScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/RainScreen.kt index 32e564879..c4e8ecd3f 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/RainScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/RainScreen.kt @@ -23,6 +23,7 @@ import com.pranshulgg.weather_master_app.R import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString import com.pranshulgg.weather_master_app.core.utils.weather.forecast.findMatchingHourly import com.pranshulgg.weather_master_app.feature.blocks.BlocksScreenViewModel @@ -40,7 +41,8 @@ fun RainScreen(navController: NavController, index: Int = 0, locationId: String) val context = LocalContext.current val units = viewModel.units.collectAsState().value.units val zoneId = weather.location.timezone - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val data = findMatchingHourly( diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/SnowScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/SnowScreen.kt index bf628ed63..3e8423b63 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/SnowScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/precipitation/SnowScreen.kt @@ -23,6 +23,7 @@ import com.pranshulgg.weather_master_app.R import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString import com.pranshulgg.weather_master_app.core.utils.weather.forecast.findMatchingHourly import com.pranshulgg.weather_master_app.feature.blocks.BlocksScreenViewModel @@ -42,7 +43,8 @@ fun SnowScreen(navController: NavController, index: Int = 0, locationId: String) val context = LocalContext.current val units = viewModel.units.collectAsState().value.units val zoneId = weather.location.timezone - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val data = findMatchingHourly( diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/pressure/PressureScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/pressure/PressureScreen.kt index fe7785475..c459ce9fb 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/pressure/PressureScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/pressure/PressureScreen.kt @@ -23,6 +23,7 @@ import com.pranshulgg.weather_master_app.R import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString import com.pranshulgg.weather_master_app.core.utils.weather.forecast.findMatchingHourly import com.pranshulgg.weather_master_app.feature.blocks.BlocksScreenViewModel @@ -41,7 +42,8 @@ fun PressureScreen(navController: NavController, index: Int = 0, locationId: Str val hourly = weather?.hourly ?: return val units = viewModel.units.collectAsState().value.units val zoneId = weather.location.timezone - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val context = LocalContext.current diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/uvindex/UvIndexScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/uvindex/UvIndexScreen.kt index b51b918f0..bf1c67cfa 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/uvindex/UvIndexScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/uvindex/UvIndexScreen.kt @@ -34,6 +34,7 @@ import com.pranshulgg.weather_master_app.core.ui.components.AvatarIcon import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.to12HourTimeString import com.pranshulgg.weather_master_app.core.utils.formatters.to24HourTimeString import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString @@ -57,7 +58,8 @@ fun UvIndexScreen(navController: NavController, index: Int = 0, locationId: Stri val hourly = weather?.hourly ?: return val context = LocalContext.current - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val data = findMatchingHourly( diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/visibility/VisibilityScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/visibility/VisibilityScreen.kt index f0efca4c1..13a4e9bc0 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/visibility/VisibilityScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/visibility/VisibilityScreen.kt @@ -30,6 +30,7 @@ import com.pranshulgg.weather_master_app.core.prefs.LocalAppPrefs import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.to12HourTimeString import com.pranshulgg.weather_master_app.core.utils.formatters.to24HourTimeString import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString @@ -68,7 +69,8 @@ fun VisibilityScreen(navController: NavController, index: Int = 0, locationId: S val units = viewModel.units.collectAsState().value.units val context = LocalContext.current - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val data = findMatchingHourly( hourly, diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/wind/WindScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/wind/WindScreen.kt index c7bc69481..c6eb479c1 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/wind/WindScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/blocks/screens/wind/WindScreen.kt @@ -23,6 +23,7 @@ import com.pranshulgg.weather_master_app.R import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.LargeTopBarScaffold import com.pranshulgg.weather_master_app.core.ui.components.NavigateUpBtn +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.toDateString import com.pranshulgg.weather_master_app.core.utils.weather.forecast.findMatchingHourly import com.pranshulgg.weather_master_app.feature.blocks.BlocksScreenViewModel @@ -41,7 +42,8 @@ fun WindScreen(navController: NavController, index: Int = 0, locationId: String) val units = viewModel.units.collectAsState().value.units val context = LocalContext.current val zoneId = weather.location.timezone - val time = if (index != 0) weather.daily[index].time else weather.current.time + val time = + if (index != 0) weather.daily[index].time else getCurrentTimeFor(weather.location.timezone) val data = findMatchingHourly( hourly, diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/locations/ui/LocationsScreenContent.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/locations/ui/LocationsScreenContent.kt index 338b32995..729079f61 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/locations/ui/LocationsScreenContent.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/locations/ui/LocationsScreenContent.kt @@ -36,6 +36,7 @@ import com.pranshulgg.weather_master_app.core.model.weather.toIcon import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.SettingsTileIcon import com.pranshulgg.weather_master_app.core.ui.theme.ShapeRadius +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.getLastUpdatedTimeString import com.pranshulgg.weather_master_app.feature.shared.components.LocationItem @@ -127,7 +128,7 @@ fun LocationsScreenContent( onLocationSelect(location) }, icon = icon.toIcon( - targetTimeMilli = weather?.current?.time ?: System.currentTimeMillis(), + targetTimeMilli = if (weather != null) getCurrentTimeFor(weather.location.timezone) else System.currentTimeMillis(), daily = weather?.daily?.firstOrNull() ), isSelected = location.id == activeLocation?.id, diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/components/FroggyContainer.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/components/FroggyContainer.kt index 2f03c3833..6fc000a39 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/components/FroggyContainer.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/components/FroggyContainer.kt @@ -9,6 +9,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.pranshulgg.weather_master_app.core.model.domain.weather.Weather import com.pranshulgg.weather_master_app.core.model.weather.toFroggy +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor @Composable fun FroggyContainer(weather: Weather) { @@ -16,7 +17,7 @@ fun FroggyContainer(weather: Weather) { Image( painter = painterResource( weather.current.weatherCondition.toFroggy( - targetTimeMilli = weather.current.time, + targetTimeMilli = getCurrentTimeFor(weather.location.timezone), daily = weather.daily.firstOrNull() ) ), diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/BackgroundGradients.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/BackgroundGradients.kt index c6fb31daa..ef21b0ea2 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/BackgroundGradients.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/BackgroundGradients.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.graphics.Color import com.pranshulgg.weather_master_app.core.model.weather.WeatherCondition import com.pranshulgg.weather_master_app.core.model.domain.weather.Weather import com.pranshulgg.weather_master_app.core.ui.theme.isThemeDark +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.weather.cache.isWeatherDomainSafe data class Background( @@ -61,7 +62,7 @@ private fun backgroundGradients(weather: Weather?, isDark: Boolean = true): Back val isDay = if (day != null && day.sunrise != null && day.sunset != null) { - weather.current.time in day.sunrise..day.sunset + getCurrentTimeFor(weather.location.timezone) in day.sunrise..day.sunset } else { true } diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/CurrentWeatherCard.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/CurrentWeatherCard.kt index f523ffa1e..1e7d1a6aa 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/CurrentWeatherCard.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/CurrentWeatherCard.kt @@ -25,6 +25,7 @@ import com.pranshulgg.weather_master_app.core.model.weather.toLabel import com.pranshulgg.weather_master_app.core.ui.components.Gap import com.pranshulgg.weather_master_app.core.ui.components.Symbol import com.pranshulgg.weather_master_app.core.ui.components.WeatherIconBox +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor import com.pranshulgg.weather_master_app.core.utils.formatters.getLastUpdatedTimeString import kotlin.math.roundToInt @@ -84,7 +85,7 @@ private fun CardRowContent(weather: Weather, units: WeatherUnits, context: Conte ) WeatherIconBox( current.weatherCondition.toIcon( - targetTimeMilli = weather.current.time, + targetTimeMilli = getCurrentTimeFor(weather.location.timezone), daily = weather.daily.firstOrNull() ), size = 42.dp @@ -188,7 +189,7 @@ fun PixelStyleCurrentWeatherCard(weather: Weather, units: WeatherUnits, context: ) { WeatherIconBox( current.weatherCondition.toIcon( - targetTimeMilli = weather.current.time, + targetTimeMilli = getCurrentTimeFor(weather.location.timezone), daily = weather.daily.firstOrNull() ), size = 32.dp diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/weatherAnimations/WeatherAnimations.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/weatherAnimations/WeatherAnimations.kt index 104cea672..5f7cea2eb 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/weatherAnimations/WeatherAnimations.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/main/ui/weatherAnimations/WeatherAnimations.kt @@ -3,6 +3,7 @@ package com.pranshulgg.weather_master_app.feature.main.ui.weatherAnimations import androidx.compose.runtime.Composable import com.pranshulgg.weather_master_app.core.model.weather.WeatherCondition import com.pranshulgg.weather_master_app.core.model.domain.weather.Weather +import com.pranshulgg.weather_master_app.core.utils.formatters.getCurrentTimeFor @Composable fun WeatherAnimations(weather: Weather, isFroggyLayout: Boolean) { @@ -10,7 +11,7 @@ fun WeatherAnimations(weather: Weather, isFroggyLayout: Boolean) { val day = weather.daily.firstOrNull() val isDay = if (day != null && day.sunrise != null && day.sunset != null) { - weather.current.time in day.sunrise..day.sunset + getCurrentTimeFor(weather.location.timezone) in day.sunrise..day.sunset } else { true } diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/notifications/mapper/NotificationWeatherMapper.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/notifications/mapper/NotificationWeatherMapper.kt index d17759d7c..d8165ff35 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/notifications/mapper/NotificationWeatherMapper.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/notifications/mapper/NotificationWeatherMapper.kt @@ -31,7 +31,7 @@ fun notificationWeatherMapper( val currentCondition = weather.current.weatherCondition.toLabel(applicationContext) val currentIcon = weather.current.weatherCondition.toIcon( - targetTimeMilli = weather.current.time, + targetTimeMilli = getCurrentTimeFor(timezone), daily = weather.daily.firstOrNull() ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 23138cb18..a1eeb8b36 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,18 +10,18 @@ espressoCore = "3.7.0" kotlinxSerializationJson = "1.11.0" lifecycleRuntimeKtx = "2.11.0" activityCompose = "1.13.0" -kotlin = "2.4.10" -composeBom = "2026.08.00" +kotlin = "2.4.20" +composeBom = "2026.09.00" material3 = "1.5.0-alpha26" -navigationCompose = "2.9.8" -materialKolor = "5.0.0" -foundationLayout = "1.12.0" +navigationCompose = "2.10.1" +materialKolor = "5.0.1" +foundationLayout = "1.12.1" coil = "2.7.0" coroutines = "1.11.0" -room = "2.8.4" +room = "2.8.5" retrofit = "3.0.0" -okhttp = "5.4.0" -animationCore = "1.12.0" +okhttp = "5.5.0" +animationCore = "1.12.1" core-splashscreen = "1.2.0" hiltAndroid = "2.60.1" hiltNavigationCompose = "1.4.0"