Skip to content

Commit be4b113

Browse files
committed
refactor : this@MissionViewModel 사용해서 livedata에 invoke 결과 바로 넣어주기
1 parent ae98510 commit be4b113

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

presentation/src/main/java/com/stop/ui/mission/MissionViewModel.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ class MissionViewModel @Inject constructor(
107107
private fun getBusNowLocation() {
108108
viewModelScope.launch {
109109
while (TIME_TEST < 60) {
110-
getBusNowLocationUseCase(TEST_BUS_540_ID).apply {
111-
_busNowLocationInfo.value = this
112-
}
110+
this@MissionViewModel._busNowLocationInfo.value = getBusNowLocationUseCase(TEST_BUS_540_ID)
113111
delay(5000)
114112
TIME_TEST += 1
115113
}
@@ -134,7 +132,7 @@ class MissionViewModel @Inject constructor(
134132
private fun getSubwayRoute() {
135133
viewModelScope.launch {
136134
val startLocation = getNowStationLocation()
137-
getSubwayRouteUseCase(
135+
this@MissionViewModel._subwayRoute.value = getSubwayRouteUseCase(
138136
RouteRequest(
139137
startLocation.longitude,
140138
startLocation.latitude,
@@ -144,9 +142,7 @@ class MissionViewModel @Inject constructor(
144142
TEST_SUBWAY_NUMER.toString() + LINE,
145143
startSubwayStation.dropLast(1), //"역" 버리기
146144
TEST_END_SUBWAY_STATION
147-
).apply {
148-
_subwayRoute.value = this
149-
}
145+
)
150146
}
151147
}
152148

0 commit comments

Comments
 (0)