Skip to content

Commit a21166a

Browse files
authored
Merge pull request #390 from Runnect/feature/fix-draw-loading-bar
fix: 코스 그리기 저장 시 로딩바 미표시 버그 수정
2 parents 20a774c + a97deb0 commit a21166a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

app/src/main/java/com/runnect/runnect/presentation/draw/DrawViewModel.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import com.runnect.runnect.presentation.state.UiState
1313
import com.runnect.runnect.util.extension.collectResult
1414
import com.runnect.runnect.util.multipart.ContentUriRequestBody
1515
import dagger.hilt.android.lifecycle.HiltViewModel
16-
import kotlinx.coroutines.flow.onStart
1716
import timber.log.Timber
1817
import javax.inject.Inject
1918
import kotlin.math.acos
@@ -85,6 +84,7 @@ class DrawViewModel @Inject constructor(
8584
}
8685

8786
fun uploadCourse() {
87+
_drawState.value = UiState.Loading
8888
launchWithHandler {
8989
courseRepository.uploadCourse(
9090
image = _image.value!!.toFormData(),
@@ -95,9 +95,7 @@ class DrawViewModel @Inject constructor(
9595
departureAddress = departureAddress,
9696
departureName = departureName
9797
).toRequestBody()
98-
).onStart {
99-
_drawState.value = UiState.Loading
100-
}.collectResult(
98+
).collectResult(
10199
onSuccess = {
102100
uploadCourseId = it
103101
_drawState.value = UiState.Success

0 commit comments

Comments
 (0)