package Ġcom . example . my github . di . modules Ċ Ċ import Ġcom . example . my github . api . My GitHub Api Ċ import Ġdagger . Module Ċ import Ġdagger . Provides Ċ import Ġdagger . h ilt . Install In Ċ import Ġdagger . h ilt . android . components . Application Component Ċ import Ġokhttp 3 . Ok HttpClient Ċ import Ġokhttp 3 . logging . Http Logging Interceptor Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . converter . gson . Gson Converter Factory Ċ import Ġjavax . inject . Singleton Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ @ Module Ċ @ Install In ( Application Component :: class ) Ċ object ĠApp Module Ġ{ ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovides Logging Interceptor (): ĠHttp Logging Interceptor Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠHttp Logging Interceptor (). setLevel ( Http Logging Interceptor . Level . BODY ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġfun Ġprovide Ok HttpClient ( logging Interceptor : ĠHttp Logging Interceptor ): ĠOk HttpClient Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġok HttpClient Ġ= ĠOk HttpClient (). newBuilder () ĊĊĠĠĠĠĠĠĠ Ġok HttpClient . call Timeout ( 4 0 , ĠTimeUnit . SECONDS ) ĊĠĠĠĠĠĠĠ Ġok HttpClient . connect Timeout ( 4 0 , ĠTimeUnit . SECONDS ) ĊĠĠĠĠĠĠĠ Ġok HttpClient . read Timeout ( 4 0 , ĠTimeUnit . SECONDS ) ĊĠĠĠĠĠĠĠ Ġok HttpClient . write Timeout ( 4 0 , ĠTimeUnit . SECONDS ) ĊĠĠĠĠĠĠĠ Ġok HttpClient . add Interceptor ( logging Interceptor ) ĊĠĠĠĠĠĠĠ Ġok HttpClient . build () ĊĠĠĠĠĠĠĠ Ġreturn Ġok HttpClient . build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide Ret rofit ( ok HttpClient : ĠOk HttpClient ): ĠRet rofit Ġ= ĊĠĠĠĠĠĠĠ ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. baseUrl ( My GitHub Api . BASE _ URL ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. client ( ok HttpClient ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Converter Factory ( Gson Converter Factory . create ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide My GitHub Api ( ret rofit : ĠRet rofit ): ĠMy GitHub Api Ġ= ĊĠĠĠĠĠĠĠ Ġretrofit . create ( My GitHub Api :: class . java ) Ċ }