Skip to content

Commit 4ca45e0

Browse files
committed
refactor: ViewModel에서 IO Thread가 아닌 기본 Thread로 Coroutine scope 실행
1 parent 345e691 commit 4ca45e0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

presentation/src/main/java/com/stop/ui/route/RouteViewModel.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import com.stop.model.ErrorType
1212
import com.stop.model.Event
1313
import com.stop.model.route.Place
1414
import dagger.hilt.android.lifecycle.HiltViewModel
15-
import kotlinx.coroutines.Dispatchers
1615
import kotlinx.coroutines.launch
1716
import javax.inject.Inject
1817

@@ -62,15 +61,15 @@ class RouteViewModel @Inject constructor(
6261
endY = destinationValue.coordinate.latitude,
6362
)
6463

65-
viewModelScope.launch(Dispatchers.IO) {
66-
this@RouteViewModel._routeResponse.postValue(getRouteUseCase(routeRequest))
64+
viewModelScope.launch {
65+
this@RouteViewModel._routeResponse.value = getRouteUseCase(routeRequest)
6766
}
6867
}
6968

7069
fun calculateLastTransportTime(itinerary: Itinerary) {
7170
checkClickedItinerary(itinerary)
72-
viewModelScope.launch(Dispatchers.IO) {
73-
this@RouteViewModel._lastTimeResponse.postValue(getLastTransportTimeUseCase(itinerary))
71+
viewModelScope.launch {
72+
this@RouteViewModel._lastTimeResponse.value = getLastTransportTimeUseCase(itinerary)
7473
}
7574
}
7675

0 commit comments

Comments
 (0)