package Ġcom . on dev . lyr ics search . di Ċ Ċ import Ġandroid . content . Context Ċ import Ġcom . on dev . lyr ics search . data . App Database Ċ import Ġcom . on dev . lyr ics search . data . repository . L yr ics Repository Ċ import Ġcom . on dev . lyr ics search . data . source . local . IL yr ics Dao Ċ import Ġcom . on dev . lyr ics search . data . source . remote . IL yr ics Api Ċ import Ġcom . on dev . lyr ics search . data . source . remote . L yr ics Remote DataSource Ċ import Ġcom . on dev . lyr ics search . utils . API _ URL Ċ import Ġcom . squareup . mos hi . M oshi Ċ import Ġdagger . Module Ċ import Ġdagger . Provides Ċ import Ġdagger . h ilt . Install In Ċ import Ġdagger . h ilt . android . qual ifiers . ApplicationContext Ċ import Ġdagger . h ilt . components . Singleton Component Ċ import Ġokhttp 3 . Ok HttpClient Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . converter . mos hi . M oshi Converter Factory Ċ import Ġjavax . inject . Singleton Ċ Ċ @ Module Ċ @ Install In ( Singleton Component :: class ) Ċ object ĠApp Module Ġ{ ĊĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Ret rofit ( mos hi : ĠM oshi , Ġok HttpClient : ĠOk HttpClient ): ĠRet rofit Ġ= ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠ Ġ. baseUrl ( API _ URL ) ĊĠĠĠĠĠĠĠ Ġ. client ( ok HttpClient ) ĊĠĠĠĠĠĠĠ Ġ. add Converter Factory ( M oshi Converter Factory . create ( mos hi )) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide M oshi (): ĠM oshi Ġ= ĠM oshi . Builder (). build () ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Ok HttpClient (): ĠOk HttpClient Ġ= ĠOk HttpClient () ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide L yr ics ApiService ( ret rofit : ĠRet rofit ): ĠIL yr ics Api Ġ= ĊĠĠĠĠĠĠĠ Ġretrofit . create ( IL yr ics Api :: class . java ) ĊĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide L yr ics Remote DataSource ( lyr ics Api : ĠIL yr ics Api ) Ġ= ĊĠĠĠĠĠĠĠ ĠL yr ics Remote DataSource ( lyr ics Api ) ĊĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Database (@ ApplicationContext Ġapp Context : ĠContext ) Ġ= ĊĠĠĠĠĠĠĠ ĠApp Database . get Database ( app Context ) ĊĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide L yr ics Dao ( db : ĠApp Database ) Ġ= Ġdb . lyr ics Dao () ĊĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Repository ( ĊĠĠĠĠĠĠĠ Ġremote DataSource : ĠL yr ics Remote DataSource , ĊĠĠĠĠĠĠĠ Ġlocal DataSource : ĠIL yr ics Dao ĊĠĠĠ Ġ) Ġ= ĠL yr ics Repository ( remote DataSource , Ġlocal DataSource ) ĊĊ Ċ }