Skip to content

Commit

Permalink
#86 fix : 근처 음식점 마커 갯수 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
BENDENG1 committed Dec 13, 2023
1 parent 6a8c569 commit 18c7419
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ interface RestaurantApi {
//위치기반 맛집 리스트
@GET("api/restaurant/all")
suspend fun nearRestaurantList(
@Query("limit") limit : Int?,
@Query("radius") radius: String,
@Query("longitude") longitude: String,
@Query("latitude") latitude: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import com.avengers.nibobnebob.data.model.response.WishRestaurantResponse.Compan
import com.avengers.nibobnebob.data.model.runRemote
import com.avengers.nibobnebob.data.remote.RestaurantApi
import com.avengers.nibobnebob.domain.model.MyRestaurantData
import com.avengers.nibobnebob.domain.model.RecommendRestaurantData
import com.avengers.nibobnebob.domain.model.RestaurantDetailData
import com.avengers.nibobnebob.domain.model.RestaurantIsWishData
import com.avengers.nibobnebob.domain.model.RestaurantItemsData
import com.avengers.nibobnebob.domain.model.ReviewSortData
import com.avengers.nibobnebob.domain.model.SearchRestaurantData
import com.avengers.nibobnebob.domain.model.WishRestaurantData
import com.avengers.nibobnebob.domain.model.base.BaseState
import com.avengers.nibobnebob.domain.model.RecommendRestaurantData
import com.avengers.nibobnebob.domain.model.base.StatusCode
import com.avengers.nibobnebob.domain.repository.RestaurantRepository
import kotlinx.coroutines.flow.Flow
Expand Down Expand Up @@ -268,10 +268,11 @@ class RestaurantRepositoryImpl @Inject constructor(
override fun nearRestaurantList(
radius: String,
longitude: String,
latitude: String
latitude: String,
limit: Int?
): Flow<BaseState<List<RestaurantItemsData>>> = flow {

when (val result = runRemote { api.nearRestaurantList(radius, longitude, latitude) }) {
when (val result =
runRemote { api.nearRestaurantList(limit, radius, longitude, latitude) }) {
is BaseState.Success -> {
result.data.body?.let { body ->
emit(BaseState.Success(body.map { it.toDomainModel() }))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ interface RestaurantRepository {
radius: String,
longitude: String,
latitude: String,
limit: Int?
): Flow<BaseState<List<RestaurantItemsData>>>

fun likeReview(reviewId: Int): Flow<BaseState<Unit>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ class HomeViewModel @Inject constructor(
restaurantRepository.nearRestaurantList(
radius = uiState.value.cameraRadius.toString(),
longitude = uiState.value.cameraLongitude.toString(),
latitude = uiState.value.cameraLatitude.toString()
latitude = uiState.value.cameraLatitude.toString(),
limit = if(uiState.value.cameraRadius < 500) 100 else 40
//이게 null일때 갯수제한이여야하는데.. 반대로 되어있어 200개 임시로 적음
).onStart {
_events.emit(HomeEvents.ShowLoading)
}.onEach {
Expand Down

0 comments on commit 18c7419

Please sign in to comment.