package Ġdev . ms l al ith . focus launcher . data . repository Ċ Ċ import Ġdev . ms l al ith . focus launcher . data . database . dao . Apps Dao Ċ import Ġdev . ms l al ith . focus launcher . data . database . dao . Hidden Apps Dao Ċ import Ġdev . ms l al ith . focus launcher . data . di . modules . App To Room Mapper Provider Ċ import Ġdev . ms l al ith . focus launcher . data . di . modules . Hidden To Room Mapper Provider Ċ import Ġdev . ms l al ith . focus launcher . data . dto . App To Room Mapper Ċ import Ġdev . ms l al ith . focus launcher . data . dto . Hidden To Room Mapper Ċ import Ġdev . ms l al ith . focus launcher . data . model . App Ċ import Ġkotlinx . coroutines . flow . Flow Ċ import Ġkotlinx . coroutines . flow . map Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠHidden Apps Repo Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġapps Dao : ĠApps Dao , ĊĠĠĠ Ġprivate Ġval Ġhidden Apps Dao : ĠHidden Apps Dao , ĊĠĠĠ Ġ@ App To Room Mapper Provider Ġprivate Ġval Ġapp To Room Mapper : ĠApp To Room Mapper , ĊĠĠĠ Ġ@ Hidden To Room Mapper Provider Ġprivate Ġval Ġhidden To Room Mapper : ĠHidden To Room Mapper Ċ ) Ġ{ ĊĠĠĠ Ġval Ġonly Hidden Apps Flow : ĠFlow < List < App >> ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġhidden Apps Dao . get Hidden Apps Flow (). map Ġ{ Ġhidden Apps Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġhidden Apps . map NotNull Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġapp Room Ġ= Ġapps Dao . getApp By ( it . packageName ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġapp Room ?. let Ġ{ Ġit 1 Ġ-> Ġapp To Room Mapper . from Entity ( it 1 ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun ĠaddTo Hidden Apps ( app : ĠApp ) Ġ{ ĊĠĠĠĠĠĠĠ Ġhidden Apps Dao . hide App ( hidden To Room Mapper . to Entity ( app )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun ĠaddTo Hidden Apps ( apps : ĠList < App >) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhidden App Room List Ġ= Ġapps . map ( hidden To Room Mapper :: to Entity ) ĊĠĠĠĠĠĠĠ Ġhidden Apps Dao . hide Apps ( hidden App Room List ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun Ġremove From Hidden Apps ( packageName : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġapp Room Ġ= Ġapps Dao . getApp By ( packageName ) Ġ?: Ġthrow ĠIllegalStateException ("$ packageName Ġapp Ġwas Ġnot Ġfound Ġin ĠDatabase ") ĊĠĠĠĠĠĠĠ Ġval Ġapp Ġ= Ġapp To Room Mapper . from Entity ( app Room ) ĊĠĠĠĠĠĠĠ Ġhidden Apps Dao . un Hide App ( hidden To Room Mapper . to Entity ( app )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun Ġclear Hidden Apps () Ġ= Ġhidden Apps Dao . clear Hidden Apps () ĊĊĠĠĠ Ġprivate Ġsuspend Ġfun Ġis Hidden ( packageName : ĠString ) Ġ= Ġhidden Apps Dao . get Hidden App By ( packageName ) Ġ!= Ġnull Ċ } Ċ