package Ġcom . clean architecture . presentation . albums Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġcom . clean architecture . domain . albums . Domain Album Ċ import Ġcom . clean architecture . domain . albums . Get Album s UseCase Ċ import Ġcom . clean architecture . domain . common . Mapper Ċ import Ġcom . clean architecture . presentation . common . Base ViewModel Ċ import Ġcom . clean architecture . presentation . common . Ui Error Ċ import Ġcom . clean architecture . presentation . common . extensions . addTo Ċ Ċ class ĠAlbum s ViewModel ( private Ġval Ġget Album s UseCase : ĠGet Album s UseCase , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġmapper : ĠMapper < Domain Album , ĠUi Album >, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġui Error Mapper : ĠMapper < Throwable , ĠUi Error >) Ġ: ĠBase ViewModel () Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠTAG Ġ= Ġ" Album s ViewModel " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġloading LiveData Ġ= ĠMutable LiveData < Boolean >() ĊĠĠĠ Ġprivate Ġval Ġcontent LiveData Ġ= ĠMutable LiveData < List < Ui Album >>() ĊĠĠĠ Ġprivate Ġval Ġerror LiveData Ġ= ĠMutable LiveData < Ui Error >() ĊĊĠĠĠ Ġfun Ġget Album s () Ġ{ ĊĠĠĠĠĠĠĠ Ġget Album s UseCase . execute () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġmapper . map List ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. do On Subscribe Ġ{ Ġloading LiveData . value Ġ= Ġtrue Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. do On Event Ġ{ Ġ_, Ġ_ Ġ-> Ġloading LiveData . value Ġ= Ġfalse Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe ({ Ġresponse : ĠList < Ui Album > Ġ-> Ġcontent LiveData . value Ġ= Ġresponse Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ Ġerror : ĠThrowable Ġ-> Ġerror LiveData . value Ġ= Ġui Error Mapper . map ( error ) Ġ}) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. addTo ( composite Disposable ) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Loading Observable (): ĠLive Data < Boolean > Ġ= Ġloading LiveData ĊĠĠĠ Ġfun ĠgetContent Observable (): ĠLive Data < List < Ui Album >> Ġ= Ġcontent LiveData ĊĠĠĠ Ġfun Ġget Error Observable (): ĠLive Data < Ui Error > Ġ= Ġerror LiveData Ċ Ċ }