package Ġcom . realtime map . repo Ċ Ċ import Ġcom . realtime map . domain . model . Location Update Ċ import Ġcom . realtime map . domain . model . User Location Ċ import Ġcom . realtime map . domain . model . User Location With Address Model Ċ import Ġcom . realtime map . repo . remote . Dummy Data Ċ import Ġcom . realtime map . repo . remote . Location Repository Ċ import Ġkotlinx . coroutines . flow . Flow Ċ import Ġkotlinx . coroutines . flow . flow Ċ import Ġkotlinx . coroutines . flow . flow Of Ċ import Ġjava . net . Socket TimeoutException Ċ Ċ class ĠFake Location Repository Ġ: ĠLocation Repository Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠERROR _ MSG : ĠString Ġ= Ġ" No Ġnetwork " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġvar Ġflow User Locations Ġ= Ġflow Of ( Dummy Data . user Locations ) ĊĊĠĠĠ Ġoverride Ġfun Ġfetch Locations (): ĠFlow < List < User Location >> Ġ= Ġflow User Locations ĊĊĠĠĠ Ġinternal Ġvar Ġresponse Type Location List : ĠResponse Type Ġ= ĠResponse Type . DATA ĊĠĠĠĠĠĠĠ Ġset ( value ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfield Ġ= Ġvalue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġflow User Locations Ġ= Ġmake Response Location List ( value ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmake Response Location List ( type : ĠResponse Type ): ĠFlow < Mutable List < User Location >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ( type ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse Type . DATA Ġ-> Ġflow Of ( Dummy Data . user Locations ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse Type . EMPTY Ġ-> Ġflow Of ( mutable ListOf < User Location >()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse Type . ERROR Ġ-> Ġflow Ġ{ Ġthrow ĠSocket TimeoutException ( ERROR _ MSG ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġprivate Ġval Ġflow User Location With Address Model Ġ= Ġflow Of ( Dummy Data . user Location With Address Model ) ĊĊĠĠĠ Ġoverride Ġfun Ġfetch Address ( params : ĠUser Location ?): ĠFlow < User Location With Address Model > Ġ= ĊĠĠĠĠĠĠĠ Ġflow User Location With Address Model ĊĊĠĠĠ Ġinternal Ġvar Ġresponse Type Location Updates : ĠResponse Type Ġ= ĠResponse Type . DATA ĊĠĠĠĠĠĠĠ Ġset ( value ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfield Ġ= Ġvalue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġflow Location Updates Ġ= Ġmake Response Location Update ( value ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmake Response Location Update ( type : ĠResponse Type ): ĠFlow < Location Update > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ( type ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse Type . DATA Ġ-> Ġflow Of ( Dummy Data . location Update ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse Type . EMPTY Ġ-> Ġflow Of ( Location Update . empty ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponse Type . ERROR Ġ-> Ġflow Ġ{ Ġthrow ĠSocket TimeoutException ( ERROR _ MSG ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġvar Ġflow Location Updates : ĠFlow < Location Update > Ġ= Ġflow Of ( Dummy Data . location Update ) ĊĊĠĠĠ Ġoverride Ġfun Ġfetch Location Updates (): ĠFlow < Location Update > Ġ= Ġflow Location Updates Ċ Ċ } Ċ Ċ internal Ġenum Ġclass ĠResponse Type Ġ{ ĊĠĠĠ ĠDATA , ĊĠĠĠ ĠEMPTY , ĊĠĠĠ ĠERROR Ċ } Ċ