From 34dbbf2af3166cf7976f82b88f066a904cbce6f5 Mon Sep 17 00:00:00 2001 From: Nebojsa Vuksic Date: Fri, 25 Jul 2025 14:42:57 +0200 Subject: [PATCH] Change cityName parameter to location in WeatherForecastData.kt --- .../template/weatherApp/model/WeatherForecastData.kt | 6 +++--- .../template/weatherApp/services/WeatherForecastService.kt | 2 +- .../template/weatherApp/ui/components/WeatherDetailsCard.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/WeatherForecastData.kt b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/WeatherForecastData.kt index 84a423f..5a39cc0 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/WeatherForecastData.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/WeatherForecastData.kt @@ -5,8 +5,8 @@ import java.time.LocalDateTime /** * Data class representing weather information to be displayed in the Weather Card. */ -data class WeatherForecastData( - val cityName: String, +internal data class WeatherForecastData( + val location: Location, val temperature: Float, val currentTime: LocalDateTime, val windSpeed: Float, @@ -16,7 +16,7 @@ data class WeatherForecastData( ) { companion object Companion { val EMPTY: WeatherForecastData = WeatherForecastData( - "", + Location("", ""), 0f, LocalDateTime.now(), 0f, diff --git a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/WeatherForecastService.kt b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/WeatherForecastService.kt index 3e18243..025f9f1 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/WeatherForecastService.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/WeatherForecastService.kt @@ -46,7 +46,7 @@ internal class WeatherForecastService(private val cs: CoroutineScope) { delay(100) return WeatherForecastData( - cityName = location.name, + location = location, temperature = temperature, currentTime = LocalDateTime.of(LocalDate.now(), getRandomTime()), windSpeed = windSpeed, diff --git a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/ui/components/WeatherDetailsCard.kt b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/ui/components/WeatherDetailsCard.kt index ab74995..7f1de0b 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/ui/components/WeatherDetailsCard.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/ui/components/WeatherDetailsCard.kt @@ -60,7 +60,7 @@ internal fun WeatherDetailsCard( ) { // City name Text( - text = weatherForecastData.cityName, + text = weatherForecastData.location.id, color = textColor, fontSize = 28.sp, fontWeight = FontWeight.Bold