package Ġcom . raz ew are . emit ron . data . filter Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġcom . raz ew are . emit ron . data . filter . dao . Category Dao Ċ import Ġcom . raz ew are . emit ron . data . filter . dao . Domain Dao Ċ import Ġcom . raz ew are . emit ron . model . Data Ċ import Ġcom . raz ew are . emit ron . model . entity . Category Ċ import Ġcom . raz ew are . emit ron . model . entity . Domain Ċ import Ġjavax . inject . Inject Ċ Ċ /** Ċ Ġ* ĠLocal Ġdata Ġsource Ġto Ġfetch Ġfilter Ġcategories / domains Ċ Ġ*/ Ċ class ĠFilter DataSource Local Ġ@ Inject Ġconstructor ( ĊĠ Ġprivate Ġval Ġdomain Dao : ĠDomain Dao , ĊĠ Ġprivate Ġval Ġcategory Dao : ĠCategory Dao Ċ ) Ġ{ ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠSave Ġdomains Ġto Ġdatabase ĊĠĠ Ġ*/ ĊĠ Ġsuspend Ġfun Ġsave Domains ( domains : ĠList < Data >) Ġ{ ĊĠĠĠ Ġval Ġdomain List Ġ= ĠDomain . list From ( domains ) ĊĠĠĠ Ġdomain Dao . insert Domains ( domain List ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠSave Ġcategories Ġto Ġdatabase ĊĠĠ Ġ*/ ĊĠ Ġsuspend Ġfun Ġsave Categories ( categories : ĠList < Data >) Ġ{ ĊĠĠĠ Ġval Ġcategory List Ġ= ĠCategory . list From ( categories ) ĊĠĠĠ Ġcategory Dao . insert Categories ( category List ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠGet Ġobserver Ġfor Ġcategory Ġtable ĊĠĠ Ġ*/ ĊĠ Ġfun Ġget Categories (): ĠLive Data < List < Category >> Ġ= Ġcategory Dao . getC ategories () ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠGet Ġobserver Ġfor Ġdomain Ġtable ĊĠĠ Ġ*/ ĊĠ Ġfun Ġget Domains (): ĠLive Data < List < Domain >> Ġ= Ġdomain Dao . get Domains () Ċ Ċ } Ċ