package Ġcom . xm art labs . sample . di Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . arch . persistence . room . Room Ċ import Ġcom . facebook . ste tho . okhttp 3 . St eth o Interceptor Ċ import Ġcom . google . gson . Field Naming Policy Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . google . gson . Gson Builder Ċ import Ġcom . jak ew h art on . ret rofit 2 . adapter . kotlin . coroutines . Coroutine Call Adapter Factory Ċ import Ġcom . xm art labs . sample . db . App Db Ċ import Ġcom . xm art labs . sample . service . UserService Ċ import Ġdagger . Module Ċ import Ġdagger . Provides Ċ import Ġokhttp 3 . Ok HttpClient Ċ import Ġokhttp 3 . logging . Http Logging Interceptor Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . adapter . rx java 2 . Rx Java 2 Call Adapter Factory Ċ import Ġretrofit 2 . converter . gson . Gson Converter Factory Ċ import Ġtim ber . log . Tim ber Ċ import Ġjavax . inject . Singleton Ċ Ċ @ Module Ċ class ĠApp Module Ġ{ ĊĠ Ġ@ Singleton ĊĠ Ġ@ Provides ĊĠ Ġfun Ġprovide Gson (): ĠGson Ġ{ ĊĠĠĠ Ġreturn ĠGson Builder () ĊĠĠĠĠĠĠĠ Ġ. setField Naming Policy ( Field Naming Policy . LOWER _ CASE _ WITH _ UNDER SCO RES ) ĊĠĠĠĠĠĠĠ Ġ. create () ĊĠ Ġ} ĊĊĠ Ġ@ Singleton ĊĠ Ġ@ Provides ĊĠ Ġfun Ġprovide Ok HttpClient (): ĠOk HttpClient Ġ{ ĊĠĠĠ Ġval Ġlogging Interceptor Ġ= ĠHttp Logging Interceptor Ġ{ ĠTim ber . tag (" Ok Http "). d ( it ) Ġ} ĊĠĠĠ Ġlogging Interceptor . level Ġ= ĠHttp Logging Interceptor . Level . BODY ĊĊĠĠĠ Ġreturn ĠOk HttpClient . Builder () ĊĠĠĠĠĠĠĠ Ġ. add Network Interceptor ( logging Interceptor ) ĊĠĠĠĠĠĠĠ Ġ. add Network Interceptor ( St eth o Interceptor ()) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠ Ġ} ĊĊĠ Ġ@ Singleton ĊĠ Ġ@ Provides ĊĠ Ġfun Ġprovide Ret rofit ( gson : ĠGson , Ġok HttpClient : ĠOk HttpClient ): ĠRet rofit Ġ{ ĊĠĠĠ Ġreturn ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠ Ġ. baseUrl (" https :// api . github . com /") ĊĠĠĠĠĠĠĠ Ġ. client ( ok HttpClient ) ĊĠĠĠĠĠĠĠ Ġ. add Call Adapter Factory ( Coroutine Call Adapter Factory ()) ĊĠĠĠĠĠĠĠ Ġ. add Call Adapter Factory ( Rx Java 2 Call Adapter Factory . create ()) ĊĠĠĠĠĠĠĠ Ġ. add Converter Factory ( Gson Converter Factory . create ( gson )) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠ Ġ} ĊĊĠ Ġ@ Singleton ĊĠ Ġ@ Provides ĊĠ Ġfun Ġprovide Github Service ( ret rofit : ĠRet rofit ) Ġ= Ġretrofit . create ( UserService :: class . java ) ĊĊĠ Ġ@ Singleton ĊĠ Ġ@ Provides ĊĠ Ġfun Ġprovide Db ( app : ĠApplication ): ĠApp Db Ġ{ ĊĠĠĠ Ġreturn ĠRoom ĊĠĠĠĠĠĠĠ Ġ. database Builder ( app , ĠApp Db :: class . java , Ġ" github . db ") ĊĠĠĠĠĠĠĠ Ġ. fallback To Dest ruct ive Migration () ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠ Ġ} ĊĊĠ Ġ@ Singleton ĊĠ Ġ@ Provides ĊĠ Ġfun Ġprovide User Dao ( db : ĠApp Db ) Ġ= Ġdb . user Dao () Ċ } Ċ