package Ġcom . ne mes is protocol . crypt ocr aze . presentation . crypto transaction screen Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġcom . ne mes is protocol . crypt ocr aze . common . Dispatcher Provider Ċ import Ġcom . ne mes is protocol . crypt ocr aze . domain . transaction history . Transaction Record Ċ import Ġcom . ne mes is protocol . crypt ocr aze . domain . transaction history . use case . Add Transaction Record UseCase Ċ import Ġcom . ne mes is protocol . crypt ocr aze . domain . transaction history . use case . Delete Transaction Record UseCase Ċ import Ġcom . ne mes is protocol . crypt ocr aze . domain . transaction history . use case . Get Transaction Records UseCase Ċ import Ġdagger . h ilt . android . lifecycle . H ilt ViewModel Ċ import Ġkotlinx . coroutines . flow . Mutable State Flow Ċ import Ġkotlinx . coroutines . flow . State Flow Ċ import Ġkotlinx . coroutines . launch Ċ import Ġjavax . inject . Inject Ċ Ċ @ H ilt ViewModel Ċ class ĠCrypto Transaction ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġadd Transaction Record UseCase : ĠAdd Transaction Record UseCase , ĊĠĠĠ Ġprivate Ġval Ġdelete Transaction Record UseCase : ĠDelete Transaction Record UseCase , ĊĠĠĠ Ġprivate Ġval Ġget Transaction Records UseCase : ĠGet Transaction Records UseCase , ĊĠĠĠ Ġprivate Ġval Ġdispatcher Provider : ĠDispatcher Provider Ċ ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġ_ transaction History Ġ= ĠMutable State Flow < List < Transaction Record >>( emptyList ()) ĊĠĠĠ Ġval Ġtransaction History : ĠState Flow < List < Transaction Record >> Ġ= Ġ_ transaction History ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch ( dispatcher Provider . io ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ_ transaction History . value Ġ= Ġget Transaction Records UseCase () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġadd Transaction Record ( transaction Record : ĠTransaction Record ) Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch ( dispatcher Provider . io ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Transaction Record UseCase ( transaction Record Ġ= Ġtransaction Record ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdelete Transaction Record ( transaction Record : ĠTransaction Record ) Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch ( dispatcher Provider . io ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdelete Transaction Record UseCase ( transaction Record Ġ= Ġtransaction Record ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ