diff --git a/data/src/main/java/com/mashup/twotoo/di/NetworkModule.kt b/data/src/main/java/com/mashup/twotoo/di/NetworkModule.kt index a3675f23..f22e9fbe 100644 --- a/data/src/main/java/com/mashup/twotoo/di/NetworkModule.kt +++ b/data/src/main/java/com/mashup/twotoo/di/NetworkModule.kt @@ -27,7 +27,7 @@ class NetworkModule { @Singleton fun provideOkHttpClient( httpLoggingInterceptor: HttpLoggingInterceptor, - getPreferenceUserInfoUseCase: GetPreferenceUserInfoUseCase + getPreferenceUserInfoUseCase: GetPreferenceUserInfoUseCase, ): OkHttpClient { val okHttpClientBuilder = OkHttpClient.Builder() okHttpClientBuilder.apply { diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/Garden.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/Garden.kt index 7a8a9467..81cc289d 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/Garden.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/Garden.kt @@ -107,7 +107,6 @@ fun GardenScreen( isStartAnimation = isStartAnimation, challengeCardInfoUiModel = challengeInfo, navigateToGarden = navigateToGarden, - ) } } diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt index 89cc9162..88bca7de 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.Text import androidx.compose.runtime.* @@ -98,7 +97,11 @@ private fun ChallengeInfo(challengeCardInfoUiModel: ChallengeCardInfoUiModel) { ) { Text( text = stringResource( - id = R.string.challengeAttempts, + id = if (challengeCardInfoUiModel.viewState == "InProgress") { + R.string.inProgressChallengeAttempts + } else { + R.string.challengeAttempts + }, challengeCardInfoUiModel.attempts, ), color = TwoTooTheme.color.mainPink, diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenViewModel.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenViewModel.kt index db1bbe16..a21509c2 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenViewModel.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenViewModel.kt @@ -11,10 +11,10 @@ import org.orbitmvi.orbit.syntax.simple.intent import org.orbitmvi.orbit.syntax.simple.postSideEffect import org.orbitmvi.orbit.syntax.simple.reduce import org.orbitmvi.orbit.viewmodel.container -import usecase.challenge.GetAllChallengeUseCase +import usecase.challenge.GetChallengeHistoriesUseCase class GardenViewModel( - private val getAllChallengeUseCase: GetAllChallengeUseCase, + private val getChallengeHistoriesUseCase: GetChallengeHistoriesUseCase, ) : ContainerHost, ViewModel() { override val container: Container = container(GardenState()) @@ -23,9 +23,9 @@ class GardenViewModel( state.copy(loadingIndicatorState = true) } delay(300) - getAllChallengeUseCase().onSuccess { challenges -> - val challengeCardInfos = challenges.filter { it.isFinished }.mapIndexed { index, challengeResponseDomainModel -> - challengeResponseDomainModel.toUiModel(index) + getChallengeHistoriesUseCase().onSuccess { challenges -> + val challengeCardInfos = challenges.mapIndexed { index, challengeResponseDomainModel -> + challengeResponseDomainModel.toUiModel(index = index) }.run { reversed() } diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/di/GardenModule.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/di/GardenModule.kt index 3430cd4a..15e8e125 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/di/GardenModule.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/di/GardenModule.kt @@ -3,7 +3,7 @@ package com.mashup.twotoo.presenter.garden.di import com.mashup.twotoo.presenter.garden.GardenViewModel import dagger.Module import dagger.Provides -import usecase.challenge.GetAllChallengeUseCase +import usecase.challenge.GetChallengeHistoriesUseCase import javax.inject.Scope @Module @@ -11,9 +11,9 @@ class GardenModule { @Provides @GardenScope fun provideViewModel( - getAllChallengeUseCase: GetAllChallengeUseCase, + getChallengeHistoriesUseCase: GetChallengeHistoriesUseCase, ): GardenViewModel { - return GardenViewModel(getAllChallengeUseCase = getAllChallengeUseCase) + return GardenViewModel(getChallengeHistoriesUseCase = getChallengeHistoriesUseCase) } }