package Ġcom . am r developer . currency exchange . data . source Ċ Ċ import Ġcom . am r developer . currency exchange . data . History Response Ċ import Ġcom . am r developer . currency exchange . data . Latest Response Ċ import Ġcom . am r developer . currency exchange . data . source . remote . Currency Service Ċ import Ġio . reactivex . Single Ċ import Ġio . reactivex . android . schedul ers . Android Schedulers Ċ import Ġio . reactivex . schedul ers . Schedulers Ċ import Ġjava . time . LocalDate Ċ import Ġjavax . inject . Inject Ċ Ċ private Ġconst Ġval ĠTAG Ġ= Ġ" Currency Repository " Ċ Ċ class ĠCurrency Repository Ġ@ Inject Ġconstructor ( private Ġval Ġcurrency Service : ĠCurrency Service ) Ġ{ ĊĊĠĠĠ Ġfun Ġload Latest Rates ( base : ĠString ): ĠSingle < Latest Response > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcurrency Service . get Latest Rates ( base ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġload History Rates ( base : ĠString ): ĠSingle < History Response > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcurrent Date Ġ= ĠLocalDate . now (). toString () ĊĠĠĠĠĠĠĠ Ġval ĠstartDate Ġ= ĠLocalDate . now (). minus Days ( 1 0 ). toString () ĊĠĠĠĠĠĠĠ Ġreturn Ġcurrency Service . get History Rates ( startDate , Ġcurrent Date , Ġbase ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġload Exchange Rates ( base : ĠString , Ġsymbol : ĠString ): ĠSingle < Latest Response > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcurrency Service . get Exchange Rates ( base , Ġsymbol ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( Schedulers . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠ Ġ} Ċ Ċ }