package Ġcom . inion gun group . mobile . d roid . news app . home Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġcom . inion gun group . mobile . d roid . news app . common . base . Base ViewModel Ċ import Ġcom . inion gun group . mobile . d roid . news app . common . utils . li ved ata event . LiveData Event Ċ import Ġcom . inion gun group . mobile . d roid . news app . common . utils . rx scheduler . Scheduler Provider Ċ import Ġcom . inion gun group . mobile . d roid . news app . common . utils . rx scheduler . subscribe On Io Ob serve On Ui Ċ import Ġcom . inion gun group . mobile . d roid . news app . entities . Article Ċ import Ġcom . inion gun group . mobile . d roid . news app . repository . IN ews Repo Ċ import Ġjavax . inject . Inject Ċ Ċ /** Ċ Ġ* ĠCreated Ġby ĠI sa ac ĠIn ion gun Ġon Ġ 2 3 / 0 6 / 2 0 2 0 . Ċ Ġ* ĠFor ĠNews ĠApp Ġproject . Ċ Ġ*/ Ċ Ċ class ĠHome Activity ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġnews Repo : ĠIN ews Repo , ĊĠĠĠ Ġscheduler Provider : ĠScheduler Provider Ċ ): ĠBase ViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġ_ news Articles Ġ= ĠMutable LiveData < List < Article >>() ĊĠĠĠ Ġval Ġnews Articles : ĠLive Data < List < Article >> Ġ= Ġ_ news Articles ĊĊĠĠĠ Ġprivate Ġval Ġ_ article Ġ= ĠMutable LiveData < LiveData Event < Article >>() ĊĠĠĠ Ġval Ġarticle : ĠLive Data < LiveData Event < Article >> Ġ= Ġ_ article ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġnews Repo . get News (). subscribe On Io Ob serve On Ui ( scheduler Provider , Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ_ news Articles . value Ġ= Ġit . articles ĊĠĠĠĠĠĠĠ Ġ}) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġhandle News Item Clicked ( article : ĠArticle ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ article . value Ġ= ĠLive Data Event ( article ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġhandle Coroutine Exception ( throwable : ĠThrowable ) Ġ{ ĊĠĠĠĠĠĠĠ Ġpost Failure Notification ( throwable . message ) ĊĠĠĠ Ġ} Ċ }