Skip to content

Commit 863df7a

Browse files
committed
refactoring : GeoLocation UseCase invoke로 변경
1 parent 3822228 commit 863df7a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

domain/src/main/java/com/stop/domain/usecase/geoLocation/GeoLocationUseCase.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import com.stop.domain.model.geoLocation.GeoLocationInfo
44

55
interface GeoLocationUseCase {
66

7-
suspend fun getGeoLocationInfo(
7+
suspend operator fun invoke(
88
lat: Double,
99
lon: Double
1010
): GeoLocationInfo
11+
1112
}

domain/src/main/java/com/stop/domain/usecase/geoLocation/GeoLocationUseCaseImpl.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import javax.inject.Inject
1010
class GeoLocationUseCaseImpl @Inject constructor(
1111
private val routeRepository: RouteRepository
1212
) : GeoLocationUseCase {
13-
override suspend fun getGeoLocationInfo(lat: Double, lon: Double): GeoLocationInfo {
13+
14+
override suspend operator fun invoke(lat: Double, lon: Double): GeoLocationInfo {
1415
val result = routeRepository.reverseGeocoding(
1516
Coordinate(lat.toString(), lon.toString()),
1617
AddressType.FULL_ADDRESS
@@ -32,4 +33,5 @@ class GeoLocationUseCaseImpl @Inject constructor(
3233
result.fullAddress.split(",").drop(1).first()
3334
}
3435
}
36+
3537
}

presentation/src/main/java/com/stop/ui/placesearch/PlaceSearchViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class PlaceSearchViewModel @Inject constructor(
112112
fun getGeoLocationInfo(latitude: Double, longitude: Double, isClickedFromPlaceSearch: Boolean) {
113113
viewModelScope.launch {
114114
try {
115-
val geoLocationInfo = geoLocationUseCase.getGeoLocationInfo(latitude, longitude)
115+
val geoLocationInfo = geoLocationUseCase(latitude, longitude)
116116

117117
_geoLocation.value = if (isClickedFromPlaceSearch) {
118118
geoLocationInfo.toClickedGeoLocationInfo(clickedPlaceName)

0 commit comments

Comments
 (0)