Skip to content

Instantly share code, notes, and snippets.

@NinoDLC
Created November 10, 2021 13:31
Show Gist options
  • Save NinoDLC/5afcf3ec9d77c6473f0598707c6a4cbf to your computer and use it in GitHub Desktop.
Save NinoDLC/5afcf3ec9d77c6473f0598707c6a4cbf to your computer and use it in GitHub Desktop.
package fr.delcey.pokedexfullflow
import android.location.Location
import androidx.lifecycle.LiveData
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlin.random.Random
class AllInOneRepository {
fun getLocationFlow(): Flow<Location> {
return flowOf()
}
fun getNearbyRestaurants(latitude: Float, longitude: Float): Flow<List<Restaurant>> {
return flowOf()
}
data class Restaurant(
val placeId: String,
val name: String,
val restaurantLatitude: Float,
val restaurantLongitude: Float,
val rating: Float // [1, 5]
)
suspend fun getGeocoderInformation(
latitude1: Float, longitude1: Float,
latitude2: Float, longitude2: Float,
) : Int {
delay(200)
return Random.nextInt(500)
}
// val liveData : LiveData<List<RestaurantViewState>>
// data class RestaurantViewState(
// val placeId: String,
// val name: String,
// val distance: String,
// val starRating: Int
// )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment