Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @HiltViewModel
- class ProfileViewModel @Inject constructor(
- private val repository: GirlsRepositoryImpl
- ) : ViewModel() {
- val user = liveData {
- emit(repository.getUserFromDb())
- }
- fun updateUser2(userEntity: UserEntity) {
- Timber.e("view model name ${userEntity.name}")
- repository.updateUser2(userEntity)
- }
- }
- class GirlsRepositoryImpl @Inject constructor(
- private val localDataSource: LocalDataSource
- ) : GirlsRepository {
- override fun getUserFromDb(): UserEntity {
- return localDataSource.getUserFromDb()
- }
- override fun updateUser2(userEntity: UserEntity) {
- localDataSource.updateUser2(userEntity)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement