Skip to content

Commit 9e7c698

Browse files
authored
Merge pull request #203 from YAPP-Github/fix/#202-map_zoom_level_viewmodel
[fix] #202 브랜드 마커 선택 시 줌 레벨 MapViewModel에 적용
2 parents 801e79b + c651801 commit 9e7c698

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

  • feature/map/impl/src/main/java/com/neki/android/feature/map/impl

feature/map/impl/src/main/java/com/neki/android/feature/map/impl/MapViewModel.kt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,22 @@ class MapViewModel @Inject constructor(
131131
LocationHelper.getCurrentLocation(context)
132132
.onSuccess { location ->
133133
reduce { copy(isCameraOnCurrentLocation = true, isVisibleRefreshButton = false) }
134-
postSideEffect(MapEffect.MoveCameraToPosition(location, isRequiredLoadPhotoBooths = true))
134+
postSideEffect(
135+
MapEffect.MoveCameraToPosition(
136+
locLatLng = location,
137+
isRequiredLoadPhotoBooths = true,
138+
zoomLevel = MapConst.MARKER_SELECTED_ZOOM_LEVEL,
139+
),
140+
)
135141
}
136142
.onFailure { e ->
137143
Timber.e(e)
138144
// 위치 조회 실패 시 강남역으로 카메라 이동
139145
postSideEffect(
140146
MapEffect.MoveCameraToPosition(
141-
LocLatLng(MapConst.DEFAULT_LATITUDE, MapConst.DEFAULT_LONGITUDE),
147+
locLatLng = LocLatLng(MapConst.DEFAULT_LATITUDE, MapConst.DEFAULT_LONGITUDE),
142148
isRequiredLoadPhotoBooths = true,
149+
zoomLevel = MapConst.MARKER_SELECTED_ZOOM_LEVEL,
143150
),
144151
)
145152
}
@@ -182,8 +189,9 @@ class MapViewModel @Inject constructor(
182189
reduce { copy(isCameraOnCurrentLocation = true, isVisibleRefreshButton = false) }
183190
postSideEffect(
184191
MapEffect.MoveCameraToPosition(
185-
LocLatLng(state.currentLocLatLng.latitude, state.currentLocLatLng.longitude),
192+
locLatLng = LocLatLng(state.currentLocLatLng.latitude, state.currentLocLatLng.longitude),
186193
isRequiredLoadPhotoBooths = true,
194+
zoomLevel = MapConst.MARKER_SELECTED_ZOOM_LEVEL,
187195
),
188196
)
189197
}
@@ -237,6 +245,7 @@ class MapViewModel @Inject constructor(
237245
brandName = photoBooth.brandName,
238246
),
239247
)
248+
240249
reduce {
241250
val isAlreadyInMarkers = mapMarkers.any {
242251
it.latitude == photoBooth.latitude && it.longitude == photoBooth.longitude
@@ -253,7 +262,13 @@ class MapViewModel @Inject constructor(
253262
mapMarkers = updatedMarkers.toImmutableList(),
254263
)
255264
}
256-
postSideEffect(MapEffect.MoveCameraToPosition(LocLatLng(photoBooth.latitude, photoBooth.longitude)))
265+
266+
postSideEffect(
267+
MapEffect.MoveCameraToPosition(
268+
locLatLng = LocLatLng(photoBooth.latitude, photoBooth.longitude),
269+
zoomLevel = MapConst.MARKER_SELECTED_ZOOM_LEVEL,
270+
),
271+
)
257272
}
258273

259274
private fun handleClickDirectionItem(
@@ -320,14 +335,14 @@ class MapViewModel @Inject constructor(
320335
mapMarkers = updatedMarkers.toImmutableList(),
321336
)
322337
}
323-
postSideEffect(MapEffect.MoveCameraToPosition(locLatLng))
338+
postSideEffect(MapEffect.MoveCameraToPosition(locLatLng = locLatLng, zoomLevel = MapConst.MARKER_SELECTED_ZOOM_LEVEL))
324339
}
325340

326341
private fun handleClickPhotoBoothCard(
327342
locLatLng: LocLatLng,
328343
postSideEffect: (MapEffect) -> Unit,
329344
) {
330-
postSideEffect(MapEffect.MoveCameraToPosition(locLatLng))
345+
postSideEffect(MapEffect.MoveCameraToPosition(locLatLng = locLatLng, zoomLevel = MapConst.MARKER_SELECTED_ZOOM_LEVEL))
331346
}
332347

333348
private fun fetchInitialData(reduce: (MapState.() -> MapState) -> Unit) {

0 commit comments

Comments
 (0)