From 3639ef41f431f1888461a721236444abd5b466ed Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sun, 18 Feb 2024 16:24:10 +0900 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20#130=20:=20survey=20Detail=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A1=9C=EB=94=A9=20Lottie=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/check/detail/SurveyDetailScreen.kt | 16 +++++++++------- .../survey/check/detail/SurveyDetailViewModel.kt | 5 ++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt index aac8f07e..34aae521 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt @@ -2,6 +2,7 @@ package com.wap.wapp.feature.survey.check.detail import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState @@ -18,6 +19,7 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.wap.designsystem.WappTheme +import com.wap.designsystem.component.CircleLoader import com.wap.designsystem.component.WappButton import com.wap.wapp.core.commmon.extensions.toSupportingText import com.wap.wapp.core.model.survey.QuestionType @@ -92,7 +94,11 @@ internal fun SurveyDetailScreen( verticalArrangement = Arrangement.spacedBy(32.dp), ) { when (surveyUiState) { - is SurveyDetailViewModel.SurveyUiState.Init -> {} + is SurveyDetailViewModel.SurveyUiState.Loading -> { + Spacer(modifier = Modifier.weight(1f)) + CircleLoader(modifier = Modifier.fillMaxSize()) + Spacer(modifier = Modifier.weight(1f)) + } is SurveyDetailViewModel.SurveyUiState.Success -> { SurveyInformationCard( @@ -107,13 +113,9 @@ internal fun SurveyDetailScreen( ) { surveyUiState.survey.surveyAnswerList.forEach { surveyAnswer -> when (surveyAnswer.questionType) { - QuestionType.OBJECTIVE -> { - ObjectiveQuestionCard(surveyAnswer) - } + QuestionType.OBJECTIVE -> ObjectiveQuestionCard(surveyAnswer) - QuestionType.SUBJECTIVE -> { - SubjectiveQuestionCard(surveyAnswer) - } + QuestionType.SUBJECTIVE -> SubjectiveQuestionCard(surveyAnswer) } } } diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt index 065e8370..f3198e96 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt @@ -22,7 +22,7 @@ class SurveyDetailViewModel @Inject constructor( val errorFlow: SharedFlow = _errorFlow.asSharedFlow() private val _surveyUiState: MutableStateFlow = - MutableStateFlow(SurveyUiState.Init) + MutableStateFlow(SurveyUiState.Loading) val surveyUiState: StateFlow = _surveyUiState.asStateFlow() fun getSurvey(surveyId: String) { @@ -38,8 +38,7 @@ class SurveyDetailViewModel @Inject constructor( } sealed class SurveyUiState { - data object Init : SurveyUiState() - + data object Loading : SurveyUiState() data class Success(val survey: Survey) : SurveyUiState() } }