package Ġac ul ix . channel ify . app . repository Ċ Ċ import Ġac ul ix . channel ify . app . api . Videos Service Ċ import Ġac ul ix . channel ify . app . db . Favorite Video Dao Ċ import Ġac ul ix . channel ify . app . model . Favorite Video Ċ import Ġac ul ix . channel ify . app . model . Video Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . with Context Ċ import Ġretrofit 2 . Response Ċ Ċ class ĠVideo Details Repository ( ĊĠĠĠ Ġprivate Ġval Ġvideos Service : ĠV ideos Service , ĊĠĠĠ Ġprivate Ġval Ġfavorite Video Dao : ĠF avorite Video Dao Ċ ) Ġ{ ĊĊĠĠĠ Ġsuspend Ġfun Ġget Video Info ( video Id : ĠString ): ĠResponse < Video > Ġ= ĊĠĠĠĠĠĠĠ Ġvideos Service . get Video Info ( video Id ) ĊĊĠĠĠ Ġsuspend Ġfun Ġadd Video To F avorites ( favorite Video : ĠF avorite Video ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwith Context ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfavorite Video Dao . add Favorite Video ( favorite Video ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun Ġremove Video From F avorites ( favorite Video : ĠF avorite Video ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwith Context ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfavorite Video Dao . remove Favorite Video ( favorite Video ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsuspend Ġfun Ġis Video Added To F avorites ( video Id : ĠString ): ĠBoolean Ġ= Ġwith Context ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfavorite Video Dao . get Favorite Video Id ( video Id ) Ġ!= Ġnull ĊĠĠĠ Ġ} Ċ Ċ }