Skip to content

Commit

Permalink
feat: 공모 참여 시 프로그래스 바 보이는 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Namyunsuk committed Oct 23, 2024
1 parent f9307c5 commit e1cc4c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class OfferingDetailViewModel
private val _isOfferingDetailLoading: MutableLiveData<Boolean> = MutableLiveData(false)
val isOfferingDetailLoading: LiveData<Boolean> get() = _isOfferingDetailLoading

private val _isParticipationLoading: MutableLiveData<Boolean> = MutableLiveData(false)
val isParticipationLoading: LiveData<Boolean> get() = _isParticipationLoading

init {
loadOffering()
}
Expand Down Expand Up @@ -148,6 +151,7 @@ class OfferingDetailViewModel

override fun participate() {
viewModelScope.launch {
_isParticipationLoading.value = true
when (val result = offeringDetailRepository.saveParticipation(offeringId)) {
is Result.Error ->
when (result.error) {
Expand All @@ -172,6 +176,7 @@ class OfferingDetailViewModel
}

is Result.Success -> {
_isParticipationLoading.value = false
_isParticipated.value = true
_commentDetailEvent.setValue(offeringDetail.value?.title ?: DEFAULT_TITLE)
_updatedOfferingId.value = offeringId
Expand Down Expand Up @@ -260,6 +265,7 @@ class OfferingDetailViewModel
}

override fun onClickConfirm() {
_alertCancelEvent.setValue(Unit)
participate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateTint="@color/main_color"
app:isVisible="@{vm.isParticipationLoading}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down

0 comments on commit e1cc4c3

Please sign in to comment.