package Ġcom . bal oc co . android navigation . feature . ven ues . view model Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġcom . bal oc co . android components . common . scheduler . Scheduler Provider Ċ import Ġcom . bal oc co . android navigation . common . view model . Base ViewModel Ċ import Ġcom . bal oc co . android navigation . data . model . Location Ċ import Ġcom . bal oc co . android navigation . data . model . Venue Ċ import Ġcom . bal oc co . android navigation . feature . ven ues . domain . Fetch Rest aurants UseCase Ċ import Ġcom . bal oc co . android navigation . feature . ven ues . domain . Near by Ven ues Provider Ċ import Ġio . reactivex . rx java 3 . kotlin . addTo Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠV en ues ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġscheduler Provider : ĠScheduler Provider , ĊĠĠĠ Ġprivate Ġval Ġnearby Ven ues Provider : ĠN ear by Ven ues Provider , ĊĠĠĠ Ġprivate Ġval Ġfetch Rest aurants UseCase : ĠFetch Rest aurants UseCase Ċ ) Ġ: ĠBase ViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġnearby Ven ues State : ĠMutable LiveData < Near by Ven ues State > Ġ= ĠMutable LiveData () ĊĊĠĠĠ Ġfun Ġnearby Ven ues State (): ĠLive Data < Near by Ven ues State > Ġ= Ġnearby Ven ues State ĊĊĠĠĠ Ġfun Ġstart () Ġ{ ĊĠĠĠĠĠĠĠ Ġnearby Ven ues Provider . ven ues Observable () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( scheduler Provider . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( scheduler Provider . ui ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ Ġresults Ġ-> Ġnotify Near by Ven ues State ( Near by Ven ues State . State . SUCCESS , Ġresults ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ Ġnotify Near by Ven ues State ( Near by Ven ues State . State . ERROR ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addTo ( composite Disposable ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġon Map Center Changed ( new Center : ĠLocation , Ġmap Radius : ĠDouble ) Ġ{ ĊĠĠĠĠĠĠĠ Ġnearby Ven ues Provider . update Prox imity Info ( new Center , Ġmap Radius ) ĊĠĠĠĠĠĠĠ Ġfetch Rest aurants ( new Center . literal (), Ġmap Radius ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġfetch Rest aurants ( center : ĠString , Ġradius : ĠDouble ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfetch Rest aurants UseCase ( center , Ġradius ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( scheduler Provider . io ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( scheduler Provider . ui ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addTo ( composite Disposable ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġnotify Near by Ven ues State ( ĊĠĠĠĠĠĠĠ Ġstate : ĠN ear by Ven ues State . State , ĊĠĠĠĠĠĠĠ Ġven ues : ĠList < Venue > Ġ= Ġmutable ListOf () ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġnearby Ven ues State . value Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠN ear by Ven ues State ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstate , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġven ues ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ }