Refactor: Rename MyLocationsViewModel to WeatherAppViewModel and update references accordingly

This commit is contained in:
Nebojsa Vuksic 2025-08-07 10:08:28 +02:00
parent c137351389
commit 9591bc93f3
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import org.jetbrains.plugins.template.CoroutineScopeHolder
import org.jetbrains.plugins.template.ui.ChatAppSample import org.jetbrains.plugins.template.ui.ChatAppSample
import org.jetbrains.plugins.template.weatherApp.model.Location import org.jetbrains.plugins.template.weatherApp.model.Location
import org.jetbrains.plugins.template.weatherApp.services.LocationsProvider import org.jetbrains.plugins.template.weatherApp.services.LocationsProvider
import org.jetbrains.plugins.template.weatherApp.services.MyLocationsViewModel import org.jetbrains.plugins.template.weatherApp.services.WeatherAppViewModel
import org.jetbrains.plugins.template.weatherApp.services.WeatherForecastService import org.jetbrains.plugins.template.weatherApp.services.WeatherForecastService
import org.jetbrains.plugins.template.weatherApp.ui.WeatherAppSample import org.jetbrains.plugins.template.weatherApp.ui.WeatherAppSample
@ -26,10 +26,10 @@ class ComposeSamplesToolWindowFactory : ToolWindowFactory, DumbAware {
val locationProviderApi = remember { service<LocationsProvider>() } val locationProviderApi = remember { service<LocationsProvider>() }
val viewModel = remember { val viewModel = remember {
val weatherForecastServiceApi = WeatherForecastService(Dispatchers.IO) val weatherForecastServiceApi = WeatherForecastService(Dispatchers.IO)
MyLocationsViewModel( WeatherAppViewModel(
listOf(Location("Munich", "Germany")), listOf(Location("Munich", "Germany")),
coroutineScopeHolder coroutineScopeHolder
.createScope(MyLocationsViewModel::class.java.simpleName), .createScope(WeatherAppViewModel::class.java.simpleName),
weatherForecastServiceApi weatherForecastServiceApi
) )
} }

View File

@ -52,7 +52,7 @@ interface WeatherViewModelApi {
* @property viewModelScope The coroutine scope in which this ViewModel operates. * @property viewModelScope The coroutine scope in which this ViewModel operates.
* @property weatherService The service responsible for fetching weather forecasts for given locations. * @property weatherService The service responsible for fetching weather forecasts for given locations.
*/ */
class MyLocationsViewModel( class WeatherAppViewModel(
myInitialLocations: List<Location>, myInitialLocations: List<Location>,
private val viewModelScope: CoroutineScope, private val viewModelScope: CoroutineScope,
private val weatherService: WeatherForecastServiceApi, private val weatherService: WeatherForecastServiceApi,