From 6c57086f25e19178382cea177e5e680311745e9d Mon Sep 17 00:00:00 2001 From: Gandalf Date: Fri, 12 Jun 2026 10:28:36 +0100 Subject: [PATCH] chore: add Firebase Crashlytics settings and fix temperature unit toggle state handling --- .idea/appInsightsSettings.xml | 26 +++++++++++++++++++ .idea/planningMode.xml | 1 + .../ui/main/MainScreenViewModel.kt | 5 +++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .idea/appInsightsSettings.xml diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml new file mode 100644 index 0000000..371f2e2 --- /dev/null +++ b/.idea/appInsightsSettings.xml @@ -0,0 +1,26 @@ + + + + + + \ No newline at end of file diff --git a/.idea/planningMode.xml b/.idea/planningMode.xml index 0982938..8b57a96 100644 --- a/.idea/planningMode.xml +++ b/.idea/planningMode.xml @@ -4,6 +4,7 @@ diff --git a/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt b/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt index 3478e2d..0b4a4ab 100644 --- a/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt +++ b/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt @@ -6,7 +6,9 @@ import com.example.esp32aldldashboard.bluetooth.ConnectionState import com.example.esp32aldldashboard.parser.ALDLFrame import com.example.esp32aldldashboard.repository.SettingsRepository import com.example.esp32aldldashboard.repository.TelemetryRepository +import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch class MainScreenViewModel( @@ -24,10 +26,11 @@ class MainScreenViewModel( val currentFrameRate: StateFlow = telemetryRepository.currentFrameRate val isCelsius: StateFlow = settingsRepository.isCelsiusFlow + .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), false) fun toggleTemperatureUnit() { viewModelScope.launch { - val currentValue = settingsRepository.isCelsiusFlow.value + val currentValue = isCelsius.value settingsRepository.setIsCelsius(!currentValue) } }