From d1b991fcbdf2d209b56091c3cb020cd770196fd0 Mon Sep 17 00:00:00 2001 From: MM20 <15646950+MM2-0@users.noreply.github.com> Date: Sun, 30 Jan 2022 15:03:51 +0100 Subject: [PATCH] Revert "Fix potential NPE" This reverts commit 95798327e7cae6d27fc588447f6640a0c61faa60. --- .../ui/launcher/widgets/weather/WeatherWidgetWM.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/weather/WeatherWidgetWM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/weather/WeatherWidgetWM.kt index e3314eb6..cd0a6b98 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/weather/WeatherWidgetWM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/weather/WeatherWidgetWM.kt @@ -22,11 +22,6 @@ class WeatherWidgetWM : ViewModel(), KoinComponent { private val dataStore: LauncherDataStore by inject() - val currentForecast = MutableLiveData(getCurrentlySelectedForecast()) - val dailyForecasts = MutableLiveData>(emptyList()) - val currentDayForecasts = MutableLiveData>(emptyList()) - val currentDailyForecast = MutableLiveData(null) - private var selectedDayIndex = 0 set(value) { field = min(value, forecasts.lastIndex) @@ -71,6 +66,11 @@ class WeatherWidgetWM : ViewModel(), KoinComponent { } } + val currentForecast = MutableLiveData(getCurrentlySelectedForecast()) + val dailyForecasts = MutableLiveData>(emptyList()) + val currentDayForecasts = MutableLiveData>(emptyList()) + val currentDailyForecast = MutableLiveData(null) + val hasLocationPermission = permissionsManager.hasPermission(PermissionGroup.Location).asLiveData() fun requestLocationPermission(context: AppCompatActivity) { permissionsManager.requestPermission(context, PermissionGroup.Location)