I just can\'t see how to chain LiveData from Repo to VM, so I have tried to boil this down to the most simple of example!:
Fragment
No need to change MutableLiveData inside ViewModel. Try to pass whatever Repository send to View. Check below
class LoginViewModel : ViewModel() {
private val firestoreRepository : FirestoreRepository = FirestoreRepository()
fun getCurrentName(): MutableLiveData {
return firestoreRepository.getCurrentName()
}
fun changeText() {
firestoreRepository.changeText()
}
}
And also your FirestoreRepository
class FirestoreRepository {
private val mCurrentName = MutableLiveData()
fun getCurrentName(): MutableLiveData {
return mCurrentName
}
fun changeText() {
mCurrentName.value = "Button Clicked!!"
}
}