Skip to content

Commit

Permalink
Updating the value dinamically (#33)
Browse files Browse the repository at this point in the history
* Updating the value dinamically

* Unused import
  • Loading branch information
gmerinojimenez authored May 10, 2023
1 parent 265dfbb commit b89e2aa
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.telefonica.tweaks.domain.Editable
import com.telefonica.tweaks.domain.TweakEntry
import com.telefonica.tweaks.domain.TweaksBusinessLogic
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch

class EditableTweakEntryViewModel<T>(
Expand All @@ -22,7 +21,9 @@ class EditableTweakEntryViewModel<T>(
val entry = (tweakEntry as TweakEntry)
init {
viewModelScope.launch {
value = tweaksBusinessLogic.getValue<T>(tweakEntry as TweakEntry).first()
tweaksBusinessLogic.getValue<T>(tweakEntry as TweakEntry).collect {
value = it
}
}
}

Expand Down

0 comments on commit b89e2aa

Please sign in to comment.