package Ġcom . example . ex ch anger ates . presentation . dialog . calculate Bottom Fragment Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġcom . example . ex ch anger ates . domain . model . Money Room Model Ċ import Ġcom . example . ex ch anger ates . domain . use case . Make Db Specific Data UseCase Ċ import Ġcom . example . ex ch anger ates . domain . use case . Make Delete Sing e Data Info Db UseCase Ċ import Ġcom . example . ex ch anger ates . domain . use case . Make Single Insert Db Data UseCase Ċ import Ġio . reactivex . rx java 3 . android . schedul ers . Android Schedulers Ċ import Ġio . reactivex . rx java 3 . dis pos ables . Composite Disposable Ċ import Ġio . reactivex . rx java 3 . schedul ers . Schedulers Ċ import Ġkotlinx . coroutines . flow . Mutable Shared Flow Ċ import Ġkotlinx . coroutines . flow . Shared Flow Ċ import Ġkotlinx . coroutines . flow . as Shared Flow Ċ import Ġkotlinx . coroutines . launch Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠBottom Sheet ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġmake Db Specific Data UseCase : ĠMake Db Specific Data UseCase , ĊĠĠĠ Ġprivate Ġval Ġmake Single Insert Db Data UseCase : ĠMake Single Insert Db Data UseCase , ĊĠĠĠ Ġprivate Ġval Ġmake Delete Sing e Data Info Db UseCase : ĠMake Delete Sing e Data Info Db UseCase ĊĠĠĠ Ġ): ĠViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġcomposite Disposable Ġ= ĠComposite Disposable () ĊĊĠĠĠ Ġprivate Ġval Ġ_ specific Data Db Ġ= ĠMutable Shared Flow < Money Room Model >() ĊĠĠĠ Ġval Ġspecific Data Db : Shared Flow < Money Room Model > Ġ= Ġ_ specific Data Db . as Shared Flow () ĊĊĠĠĠ Ġfun Ġmake Db Specific Data ( charCode : String ){ ĊĠĠĠĠĠĠ ĠviewModel Scope . launch Ġ{ ĊĠĠĠĠĠĠĠĠĠĠ Ġ_ specific Data Db . emit ( make Db Specific Data UseCase . do It ( charCode )) ĊĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġmake Single Insert Db Data ( data : ĠMoney Room Model ){ ĊĠĠĠĠĠĠĠ Ġval Ġzap ros Single Insert Db Data Ġ= Ġmake Single Insert Db Data UseCase . do It ( data ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . single ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe () ĊĊĠĠĠĠĠĠĠ Ġcomposite Disposable . add ( zap ros Single Insert Db Data ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġfun Ġmake Delete Sing e Data Info Db ( charCode : String ){ ĊĠĠĠĠĠĠĠ Ġval Ġzap ros Delete Sing e Data Info Db Ġ= Ġmake Delete Sing e Data Info Db UseCase . do It ( charCode ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . single ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe () ĊĊĠĠĠĠĠĠĠ Ġcomposite Disposable . add ( zap ros Delete Sing e Data Info Db ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġclear Composite Disposable (){ ĊĠĠĠĠĠĠĠ Ġcomposite Disposable . clear () ĊĠĠĠ Ġ} Ċ }