package Ġcom . ade sso . move e . scene . mov iel ist Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġcom . ade sso . move e . base . Base Android ViewModel Ċ import Ġcom . ade sso . move e . domain . Fetch Now Playing Movies UseCase Ċ import Ġcom . ade sso . move e . internal . util . UseCase Ċ import Ġcom . ade sso . move e . scene . mov iel ist . model . Movie Ui Model Ċ import Ġjavax . inject . Inject Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠMovie List ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġapplication : ĠApplication , ĊĠĠĠ Ġprivate Ġval Ġfetch Now Playing Movies UseCase : ĠFetch Now Playing Movies UseCase Ċ ) Ġ: ĠBase Android ViewModel ( application ), ĠMovie Item Listener Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġ_ now Playing Movies Ġ= ĠMutable LiveData < List < Movie Ui Model >>() ĊĠĠĠ Ġval Ġnow Playing Movies : ĠLive Data < List < Movie Ui Model >> Ġget () Ġ= Ġ_ now Playing Movies ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġfetch Now Playing Movies () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġfetch Now Playing Movies () Ġ= ĠviewModel Scope . launch Ġ{ ĊĠĠĠĠĠĠĠ Ġfetch Now Playing Movies UseCase ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. run ( UseCase . None ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. either (:: handle Failure , Ġ:: post Now Playing Movies ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġpost Now Playing Movies ( movies : ĠList < Movie Ui Model >) Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ now Playing Movies . value Ġ= Ġmovies ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Movie Item Click ( movie : ĠMovie Ui Model ) Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigate ( Movie List Fragment Directions . action Movie Fragment To Movie Detail Fragment ( movie . id )) ĊĠĠĠ Ġ} Ċ } Ċ