Skip to content

Commit

Permalink
- ViewModels moved to Hilt, Cleaned up dagger code.
Browse files Browse the repository at this point in the history
  • Loading branch information
WaheedNazir committed Jun 19, 2021
1 parent dc46dca commit acbf2f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.kotlin.mvvm.repository.model.countries.Country
import com.kotlin.mvvm.repository.repo.countries.CountriesRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

/**
* Created by Waheed on 08,November,2019
*/

/**
*
* A container for [Country] related data to show on the UI.
*/

@HiltViewModel
class CountriesViewModel @Inject constructor(val countriesRepository: CountriesRepository) :
ViewModel() {

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/kotlin/mvvm/ui/news/NewsViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.lifecycle.ViewModel
import com.kotlin.mvvm.repository.api.network.Resource
import com.kotlin.mvvm.repository.model.news.News
import com.kotlin.mvvm.repository.repo.news.NewsRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

/**
Expand All @@ -14,9 +15,9 @@ import javax.inject.Inject
/**
* A container for [News] related data to show on the UI.
*/
class NewsViewModel @Inject constructor(
private val newsRepository: NewsRepository
) : ViewModel() {

@HiltViewModel
class NewsViewModel @Inject constructor(private val newsRepository: NewsRepository) : ViewModel() {

/**
* Loading news articles from internet and database
Expand Down

0 comments on commit acbf2f3

Please sign in to comment.