-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/jaino/#85 #103
Feature/jaino/#85 #103
Changes from 11 commits
06ff210
272b902
5860a97
6d6b391
aab285c
b4fd607
4ad4f4a
c9834e9
aeb5698
c4dd5ce
41e811a
53639d2
ea18423
da4b8ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M7.954,0C5.846,0.003 3.824,0.842 2.333,2.333C0.842,3.824 0.003,5.846 0,7.954C0.003,10.063 0.842,12.085 2.333,13.576C3.824,15.067 5.846,15.906 7.954,15.909C9.292,15.909 10.552,15.569 11.659,14.981L20.458,23.78C20.599,23.921 20.789,24 20.988,24C21.187,24 21.378,23.921 21.518,23.78L23.78,21.515C23.921,21.375 24,21.184 24,20.985C24,20.786 23.921,20.596 23.78,20.455L14.982,11.659C15.588,10.519 15.906,9.246 15.906,7.954C15.903,5.846 15.065,3.825 13.574,2.333C12.084,0.842 10.063,0.003 7.954,0ZM7.954,1.5C11.527,1.5 14.404,4.38 14.404,7.954C14.406,8.802 14.24,9.642 13.917,10.425C13.593,11.209 13.118,11.921 12.519,12.521C11.92,13.12 11.208,13.595 10.425,13.92C9.642,14.243 8.802,14.41 7.954,14.409C7.106,14.41 6.266,14.244 5.483,13.92C4.699,13.596 3.987,13.121 3.387,12.521C2.788,11.922 2.312,11.21 1.988,10.426C1.665,9.642 1.499,8.802 1.5,7.954C1.499,7.106 1.665,6.266 1.988,5.483C2.312,4.699 2.788,3.987 3.387,3.387C3.987,2.788 4.699,2.312 5.483,1.988C6.266,1.664 7.106,1.499 7.954,1.5ZM10.795,4.905C10.686,4.904 10.578,4.927 10.479,4.972C10.38,5.017 10.291,5.082 10.219,5.164L6.427,9.477L4.462,8.253C3.601,7.668 2.766,9.009 3.667,9.525L6.172,11.085C6.323,11.179 6.503,11.216 6.679,11.19C6.855,11.164 7.017,11.076 7.134,10.942L11.347,6.151C11.444,6.044 11.507,5.911 11.53,5.768C11.552,5.626 11.534,5.48 11.475,5.347C11.417,5.215 11.322,5.103 11.201,5.024C11.081,4.944 10.94,4.902 10.795,4.9V4.905ZM14.2,12.998L22.189,20.985L20.989,22.189L12.999,14.2L14.2,12.998Z" | ||
android:fillColor="#202022"/> | ||
</vector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,48 +2,45 @@ package com.wap.wapp.feature.survey.check | |
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.wap.wapp.core.domain.usecase.survey.GetSurveyUseCase | ||
import com.wap.wapp.core.domain.usecase.survey.GetSurveyListUseCase | ||
import com.wap.wapp.core.model.survey.Survey | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.SharedFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
import kotlinx.coroutines.flow.asSharedFlow | ||
import kotlinx.coroutines.flow.asStateFlow | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class SurveyCheckViewModel @Inject constructor( | ||
private val getSurveyUseCase: GetSurveyUseCase, | ||
private val getSurveyListUseCase: GetSurveyListUseCase, | ||
) : ViewModel() { | ||
private val _surveyCheckUiEvent: MutableSharedFlow<SurveyUiEvent> = MutableSharedFlow() | ||
val surveyCheckUiEvent: SharedFlow<SurveyUiEvent> = _surveyCheckUiEvent.asSharedFlow() | ||
private val _surveyListUiState: MutableStateFlow<SurveyListUiState> = | ||
MutableStateFlow(SurveyListUiState.Init) | ||
val surveyListUiState = _surveyListUiState.asStateFlow() | ||
|
||
private val _surveyUiState: MutableStateFlow<SurveyUiState> = | ||
MutableStateFlow(SurveyUiState.Init) | ||
val surveyUiState: StateFlow<SurveyUiState> = _surveyUiState.asStateFlow() | ||
private val _errorFlow: MutableSharedFlow<Throwable> = MutableSharedFlow() | ||
val errorFlow = _errorFlow.asSharedFlow() | ||
|
||
fun getSurvey(surveyId: String) { | ||
init { | ||
getSurveyList() | ||
} | ||
|
||
private fun getSurveyList() { | ||
viewModelScope.launch { | ||
getSurveyUseCase(surveyId) | ||
.onSuccess { survey -> | ||
_surveyUiState.value = SurveyUiState.Success(survey) | ||
getSurveyListUseCase() | ||
.onSuccess { surveyList -> | ||
_surveyListUiState.value = SurveyListUiState.Success(surveyList) | ||
} | ||
.onFailure { throwable -> | ||
_surveyCheckUiEvent.emit(SurveyUiEvent.Failure(throwable)) | ||
_errorFlow.emit(throwable) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ค์ฝํ ํ๋ ์ ๊ฑฐํ ์ ์์ ๊ฒ ๊ฐ์์. getSurveyListUseCase().onSuccess { surveyList -> // <- ์์ชฝ
_surveyListUiState.value = SurveyListUiState.Success(surveyList)
} ํ๋ฉด ๊ฐํํด์ผํ๋ ๋๋น์ธ๊ฐ์?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ํน์ ์ด๋ค ์ค์ฝํ ๋ง์ํ์ ๊ฑด๊ฐ์ ,, ? onSuccess ๊ฐํ ๋ง์ํ์ ๊ฑด๊ฐ์ ?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์บฌ์บฌ ํด๋น ์ปจ๋ฒค์ ์ ์ฝ๋์๋ ์ด์ด์ ธ ์๊ธดํ๋ฐ, ์ฌ์ค ํฐ ์๋ฏธ๋ ๊ฐํ์ด ํ์ํ ๊ฒฝ์ฐ, ๋ฌด์กฐ๊ฑด ํ์ค์ ํ ์ฒด์ธ๋ง ์ค์ ํ๋๋ก ํ๋๊ฒ ์ฃผ ์๋ฏธ๋ผ๊ณ ์๊ฐํด์ ๊ฐ์ธ์ ์ผ๋ก ๋ฐ๋ก onSuccess๋ฅผ ๋ถ์ด๋๊ฒ ๊ฐ๋
์ฑ๋ ์ข์ง์๊ณ , There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ํ ์ ๋ถ๋ถ์ ๋ํด์๋ ๊ตณ์ด ์ฒ ์ ํ ์งํค์ง ์์๋ ๋๋ ์ปจ๋ฒค์ ์ผ๊น์ ?.? ์ฌ์ค ์ง๊ธ๋ ์์ฌ์๊ธด ํด์ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ์ ๋ ์ ์ปจ๋ฒค์ ์ ์๊ณ ์ฐ๊ณ ์๊ณ , ์ด๊ธด ์ฌ๋ก๋ ์ ๊ฐ ์๊ฐ๋๋ ๊ฒ์ค์๋ ์์ด์ ! ํด๋น ์ปจ๋ฒค์ ์ด ๋ง ๊ทธ๋๋ก ์ฒด์ด๋์ ํ ๋ ํ ์ค๋ก ์๋๋ฉด ๋ฌด์กฐ๊ฑด ๊ฐํํ๋ผ. ๊ฐ ์ฃผ ๋ชฉ์ ์ด๋ผ useCase().onSuceess() useCase() |
||
} | ||
} | ||
|
||
sealed class SurveyUiState { | ||
data object Init : SurveyUiState() | ||
|
||
data class Success(val survey: Survey) : SurveyUiState() | ||
} | ||
|
||
sealed class SurveyUiEvent { | ||
data class Failure(val throwable: Throwable) : SurveyUiEvent() | ||
sealed class SurveyListUiState { | ||
data object Init : SurveyListUiState() | ||
data class Success(val surveyList: List<Survey>) : SurveyListUiState() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.wap.wapp.feature.survey.check | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.wap.designsystem.WappTheme | ||
import com.wap.wapp.core.model.survey.Survey | ||
|
||
@Composable | ||
internal fun SurveyItemCard( | ||
onCardClicked: (String) -> Unit, | ||
survey: Survey, | ||
) { | ||
Card( | ||
colors = CardDefaults.cardColors( | ||
containerColor = WappTheme.colors.black25, | ||
), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.clickable { onCardClicked(survey.surveyId) }, | ||
) { | ||
Column( | ||
verticalArrangement = Arrangement.spacedBy(16.dp), | ||
modifier = Modifier.padding(16.dp), | ||
) { | ||
Row( | ||
horizontalArrangement = Arrangement.End, | ||
modifier = Modifier.fillMaxWidth(), | ||
) { | ||
Text( | ||
text = survey.title, | ||
modifier = Modifier.weight(1f), | ||
maxLines = 1, | ||
color = WappTheme.colors.white, | ||
style = WappTheme.typography.titleBold, | ||
) | ||
|
||
Text( | ||
text = survey.eventName, | ||
color = WappTheme.colors.grayA2, | ||
style = WappTheme.typography.captionMedium, | ||
) | ||
} | ||
|
||
Text( | ||
text = survey.userName, | ||
color = WappTheme.colors.grayBD, | ||
style = WappTheme.typography.contentMedium, | ||
) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์งํธ์ ์ฌ๊ธฐ by๋ฅผ ์๊ฑฐํ๊ณ ๋ค์ value๋ฅผ ๋ถ์ธ ์ด์ ๊ฐ ์์๊น์?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด๊ฒ ํ์ผ ์ด๋ฆ์ ๋ณ๊ฒฝํ๊ณ , ์๋ก์ด ํ์ผ์ ์ด์ ํ์ผ ์ด๋ฆ์ผ๋ก ๋ณ๊ฒฝํ๋๋,
์๋ก ์ถ๊ฐ๋ ๋ด์ฉ์ธ๋ฐ, ๋ณ๊ฒฝ์ฌํญ์ผ๋ก ๋์ค๋๊ตฐ์ ์บฌ์บฌ ,,
๋ฐ๋ก ์๊ฑฐํ๊ฒ ์๋๋ผ, ์๋ก ๊ตฌํํ ์ฌํญ์ ๋๋ค ์บฌ์บฌ,,, ํํํํํํ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeongjaino
์ํ ๊ทธ๋ฐ๊ฑฐ๋ผ๋ฉด value๋ฅผ ์๊ฑฐํ๊ณ by๋ง ๋ถ์ฌ์ค๋ ๋ ๊ฒ ๊ฐ์์!