Created
April 15, 2021 07:49
-
-
Save Foreman76/8a6d401d32626f68783dae7855268089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.int24.ownbarbershop.fragments.viewmodels | |
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MutableLiveData | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.viewModelScope | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.launch | |
import ru.int24.ownbarbershop.models.domen.DomSettings | |
import ru.int24.ownbarbershop.repositories.UsesCaseBaseRepositoryImpl | |
import javax.inject.Inject | |
class VMMainActivity @Inject constructor(private val usesCaseBaseRepositoryImpl: UsesCaseBaseRepositoryImpl): ViewModel() { | |
private val _isSettingsFromDB: MutableLiveData<DomSettings?> = MutableLiveData() | |
fun getSettingsFromDB(){ | |
viewModelScope.launch(Dispatchers.Main) { | |
_isSettingsFromDB.postValue(usesCaseBaseRepositoryImpl.getAllSettings()) | |
} | |
} | |
fun getSettingsFromVM(): LiveData<DomSettings?> = _isSettingsFromDB | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment