package Ġcom . rc orch ero . app . core . di . data Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . database . sqlite . SQLite Open Helper Ċ import Ġcom . rc orch ero . app . Build Config Ċ import Ġcom . rc orch ero . app . core . platform . Network Handler Ċ import Ġcom . rc orch ero . data . TV Shows Repository Impl Ċ import Ġcom . rc orch ero . data . source . local . TV Shows Database Helper Ċ import Ġcom . rc orch ero . data . source . local . TV Shows Local DataSource Ċ import Ġcom . rc orch ero . data . source . local . TV Shows Local DataSource Impl Ċ import Ġcom . rc orch ero . data . source . remote . TV Shows Remote DataSource Ċ import Ġcom . rc orch ero . data . source . remote . TV Shows Remote DataSource Impl Ċ import Ġcom . rc orch ero . data . source . remote . TV Shows Service Ċ import Ġcom . rc orch ero . domain . repository . TV Shows Repository Ċ 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 . converter . mos hi . M oshi Converter Factory Ċ import Ġjavax . inject . Singleton Ċ Ċ @ Module Ċ class ĠData Module Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠBASE _ URL Ġ= Ġ" https :// api . the mov ied b . org /" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġinternal Ġfun Ġprovide Repository ( ĊĠĠĠĠĠĠĠ Ġnetwork Handler : ĠNetwork Handler , ĊĠĠĠĠĠĠĠ Ġlocal DataSource : ĠTV Shows Local DataSource , ĊĠĠĠĠĠĠĠ Ġremote DataSource : ĠTV Shows Remote DataSource ĊĠĠĠ Ġ): ĠTV Shows Repository Ġ= ĊĠĠĠĠĠĠĠ ĠTV Shows Repository Impl ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis Online Ġ= Ġnetwork Handler . is Online (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocal DataSource Ġ= Ġlocal DataSource , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġremote DataSource Ġ= Ġremote DataSource ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġinternal Ġfun Ġprovide Local DataSource ( sq Lite Open Helper : ĠSQLite Open Helper ): ĠTV Shows Local DataSource Ġ= ĊĠĠĠĠĠĠĠ ĠTV Shows Local DataSource Impl ( sq Lite Open Helper ) ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġinternal Ġfun Ġprovide SQLite Open Helper ( context : ĠContext ): ĠSQLite Open Helper Ġ= ĊĠĠĠĠĠĠĠ ĠTV Shows Database Helper ( context ) ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġinternal Ġfun Ġprovide Remote DataSource ( tv Shows Service : ĠTV Shows Service ): ĠTV Shows Remote DataSource Ġ= ĊĠĠĠĠĠĠĠ ĠTV Shows Remote DataSource Impl ( tv Shows Service ) ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġinternal Ġfun Ġprovide Service (): ĠTV Shows Service Ġ= ĊĠĠĠĠĠĠĠ ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. baseUrl ( BASE _ URL ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Converter Factory ( M oshi Converter Factory . create ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. client ( create Client ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. create ( TV Shows Service :: class . java ) ĊĊĠĠĠ Ġprivate Ġfun Ġcreate Client (): ĠOk HttpClient Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġok HttpClient Builder : ĠOk HttpClient . Builder Ġ= ĠOk HttpClient . Builder () ĊĠĠĠĠĠĠĠ Ġif Ġ( Build Config . DEBUG ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlogging Interceptor Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠHttp Logging Interceptor (). setLevel ( Http Logging Interceptor . Level . BODY ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġok HttpClient Builder . add Interceptor ( logging Interceptor ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġok HttpClient Builder . build () ĊĠĠĠ Ġ} Ċ }