package Ġcom . all sof td roid . audio book . feature . feature _ audio book _ en hance _ details . data . repository Ċ Ċ import Ġcom . all sof td roid . audio book . feature . feature _ audio book _ en hance _ details . data . model . Book Details Ċ import Ġcom . all sof td roid . audio book . feature . feature _ audio book _ en hance _ details . domain . network . Network Response Listener Ċ import Ġcom . all sof td roid . audio book . feature . feature _ audio book _ en hance _ details . domain . repository . IF etch Addition Book Details Repository Ċ import Ġcom . all sof td roid . audio book . feature . feature _ audio book _ en hance _ details . domain . repository . IS tore Repository Ċ import Ġcom . all sof td roid . audio book . feature . feature _ audio book _ en hance _ details . utils . Book Details Parser From Html Ċ import Ġcom . all sof td roid . common . base . network . Failure Ċ import Ġcom . all sof td roid . common . base . network . Success Ċ import Ġcom . dropbox . android . external . store 4 . get Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . with Context Ċ import Ġtim ber . log . Tim ber Ċ Ċ class ĠFetch Additional Book Details Repository Impl ( private Ġval Ġstore Caching Repository : ĠI Store Repository , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġbook Details Parser : ĠBook Details Parser From Html Ċ ) Ġ: ĊĠĠĠ ĠIF etch Addition Book Details Repository Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġlistener : ĠNetwork Response Listener ? Ġ= Ġnull ĊĊĠĠĠ Ġoverride Ġfun Ġregister Network Response ( listener : ĠNetwork Response Listener ){ ĊĠĠĠĠĠĠĠ Ġthis . listener Ġ= Ġlistener ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġun Register Network Response () Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . listener Ġ= Ġnull ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġfetch Book Details ( book Url : String ){ ĊĠĠĠĠĠĠĠ Ġwith Context ( Dispatch ers . IO ){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġvar Ġdetails : Book Details ?= null ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpage Data Ġ= Ġstore Caching Repository . provide En hance Book Details Store (). get ( book Url ) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif ( page Data . isNotEmpty ()){ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdetails Ġ= Ġbook Details Parser . load Details ( page Data ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTim ber . d (" Details :$ details ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener ?. on Response ( Success ( details )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} catch Ġ( exception : Exception ){ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTim ber . e (" Found ĠException :$ exception ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlistener ?. on Response ( Failure ( Error ( exception . message ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }