package Ġcom . github . ep hel sa . my care er . ui . question Ċ Ċ import Ġandroidx . h ilt . lifecycle . ViewModel Inject Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . as LiveData Ċ import Ġcom . github . ep hel sa . my care er . domain . shared . Resource Local Ċ import Ġcom . github . ep hel sa . my care er . domain . survey . User Answer Local Ċ import Ġcom . github . ep hel sa . my care er . ui . utils . Scoped ViewModel Ċ import Ġcom . github . ep hel sa . my care er . use case . survey . Send Stored User Answers UseCase Ċ import Ġcom . github . ep hel sa . my care er . use case . survey . Store User Answer UseCase Ċ import Ġcom . github . ep hel sa . my care er . use case . survey . Stored Questions And Question Answers UseCase Ċ import Ġkotlinx . coroutines . Coroutine Dispatcher Ċ Ċ class ĠQuestion ViewModel Ġ@ ViewModel Inject Ġconstructor ( ĊĠĠĠ Ġstored Questions And Question Answers UseCase : ĠStored Questions And Question Answers UseCase , ĊĠĠĠ Ġprivate Ġval Ġstore User Answer UseCase : ĠStore User Answer UseCase , ĊĠĠĠ Ġprivate Ġval Ġsend Stored User Answers UseCase : ĠSend Stored User Answers UseCase , ĊĠĠĠ Ġui Dispatcher : ĠCor outine Dispatcher Ċ ) Ġ: ĠScoped ViewModel ( ui Dispatcher ) Ġ{ ĊĊĠĠĠ Ġval Ġstored Questions And Question Answers Ġ= Ġstored Questions And Question Answers UseCase (). as LiveData () ĊĊĠĠĠ Ġfun Ġstore User Answer ( ĊĠĠĠĠĠĠĠ Ġuser Answer Local : ĠUser Answer Local , ĊĠĠĠĠĠĠĠ ĠisValid : ĠBoolean ĊĠĠĠ Ġ): ĠLive Data < Resource Local < Unit >> ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġstore User Answer UseCase ( user Answer Local ). as LiveData (). take If Ġ{ ĠisValid Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsend Stored User Answers ( survey Id : ĠString , Ġresolve Attempt : ĠInt ) Ġ= ĊĠĠĠĠĠĠĠ Ġsend Stored User Answers UseCase ( survey Id , Ġresolve Attempt ). as LiveData () Ċ } Ċ