update favorite data when opening favorite detail view from list

This commit is contained in:
johan12345
2022-07-03 00:11:30 +02:00
parent 60b151c690
commit caee3b1d67

View File

@@ -434,6 +434,11 @@ class MapViewModel(application: Application, private val state: SavedStateHandle
chargerDetails.value = response
if (response.status == Status.SUCCESS) {
chargerSparse.value = response.data
if (response.data != null && favorites.value?.any { it.charger.id == response.data.id } == true) {
// update data of stored favorite
db.chargeLocationsDao().insert(response.data)
}
} else {
chargerSparse.value = null
}