features/characters_list / com.vmadalin.dynamicfeatures.characterslist.ui.detail / CharacterDetailViewModel

CharacterDetailViewModel

class CharacterDetailViewModel : ViewModel

View model responsible for preparing and managing the data for CharacterDetailFragment.

See Also

ViewModel

Constructors

<init>

View model responsible for preparing and managing the data for CharacterDetailFragment.

CharacterDetailViewModel(marvelRepository: MarvelRepository, characterFavoriteRepository: CharacterFavoriteRepository, characterDetailMapper: CharacterDetailMapper)

Properties

characterDetailMapper

val characterDetailMapper: CharacterDetailMapper

characterFavoriteRepository

val characterFavoriteRepository: CharacterFavoriteRepository

data

val data: LiveData<CharacterDetail>

marvelRepository

val marvelRepository: MarvelRepository

state

val state: LiveData<CharacterDetailViewState>

Functions

addCharacterToFavorite

Store selected character to database favorite list.

fun addCharacterToFavorite(): Unit

dismissCharacterDetail

Send interaction event for dismiss character detail view.

fun dismissCharacterDetail(): Unit

loadCharacterDetail

Fetch selected character detail info.

fun loadCharacterDetail(characterId: Long): Unit