Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ val green3 = Color(0xFF9AD342)
val shadow = Color(0xFF9098A7).copy(alpha = 0.12f)

val gradation = Color(0xFFFFFDFD)
val gradation2 = Color(0xFFFAE0E6)
val gradation2 = Color(0xFFFFE0E0)

val graStart = Color(0xFFFFF7f7)
val graStart = Color(0xFFFFEBEB)
val graEnd = Color(0xFFFFFDFD)

val bottomSheetScrimColor = Color(0x1A464C52)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,22 @@ class ChallengeMissionProgressViewModel @Inject constructor(
}

private fun ChallengeMissionProgressResponseModel.toUiState(): ChallengeMissionProgressUiState {
val cherryType = CherryType.entries.first { it.step == cherryLevel }
val stepForUi = when (cherryLevel) {
0, 1 -> 1
else -> cherryLevel
}

val cherryType = CherryType.entries.firstOrNull { it.step == stepForUi }
?: CherryType.MONGRONG

Comment on lines +101 to +110
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โš ๏ธ Potential issue | ๐ŸŸ  Major

๊ฒŒ์ด์ง€ ๋‹จ๊ณ„์™€ ์ฒด๋ฆฌ ํƒ€์ž… ๊ณ„์‚ฐ์ด ์„œ๋กœ ๋ถˆ์ผ์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

gaugeStep๋Š” ํด๋žจํ”„๋˜์ง€๋งŒ stepForCherry๋Š” ์›๋ณธ cherryLevel์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋ฒ”์œ„๋ฅผ ๋ฒ—์–ด๋‚œ ๊ฐ’์ด ์˜ค๋ฉด ๊ฒŒ์ด์ง€๋Š” ์ตœ๋Œ€์ธ๋ฐ ์ฒด๋ฆฌ ํƒ€์ž…์€ ๊ธฐ๋ณธ๊ฐ’(MONGRONG)์œผ๋กœ ๋–จ์–ด์ ธ UI๊ฐ€ ์—‡๊ฐˆ๋ฆด ์ˆ˜ ์žˆ์–ด์š”. ๋™์ผํ•œ ๊ธฐ์ค€(ํด๋žจํ”„๋œ ๊ฐ’)์œผ๋กœ ์ •๋ ฌํ•˜๋Š” ํŽธ์ด ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ› ๏ธ ์ œ์•ˆ ์ˆ˜์ •
-    val gaugeStep = cherryLevel.coerceIn(0, 4)
-
-    val stepForCherry = when (cherryLevel) {
+    val gaugeStep = cherryLevel.coerceIn(0, 4)
+
+    val stepForCherry = when (gaugeStep) {
         0, 1 -> 1
-        else -> cherryLevel
+        else -> gaugeStep
     }
๐Ÿค– Prompt for AI Agents
In
`@app/src/main/java/com/cherrish/android/presentation/challenge/missionprogress/ChallengeMissionProgressViewModel.kt`
around lines 101 - 110, The bug is that stepForCherry uses the raw cherryLevel
while gaugeStep is clamped, causing mismatched UI; change stepForCherry to base
itself on the clamped gaugeStep (use gaugeStep instead of cherryLevel) so both
gaugeStep and CherryType lookup (CherryType.entries.firstOrNull { it.step ==
stepForCherry } ?: CherryType.MONGRONG) use the same bounded value; ensure the
comparison uses the same numeric range and types as gaugeStep to avoid falling
back to MONGRONG unexpectedly.

val isMaxLevel = cherryType == CherryType.KKUKKU

val remainingText = if (isMaxLevel) {
"์ฑŒ๋ฆฐ์ง€ ์™„๋ฃŒ๊นŒ์ง€ ${remainingRoutinesToNextLevel}๊ฐœ์˜ ๋ฏธ์…˜์„ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•ด์š”!"
} else {
"์ฒด๋ฆฌ๊ฐ€ ํฌ๋ ค๋ฉด ${remainingRoutinesToNextLevel}๊ฐœ์˜ ๋ฏธ์…˜์„ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•ด์š”!"
}

val completeButtonText = if (isMaxLevel) {
"์ฑŒ๋ฆฐ์ง€ ์™„๋ฃŒํ•˜๊ธฐ"
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ private fun ChallengeStartScreen(
.fillMaxSize()
.background(CherrishTheme.colors.gray0)
.padding(paddingValues)
.padding(horizontal = 17.dp)

.padding(horizontal = 17.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Spacer(modifier = Modifier.weight(98f))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import com.cherrish.android.core.designsystem.theme.graStart
import com.cherrish.android.presentation.home.component.ChallengeSection
import com.cherrish.android.presentation.home.component.PlanBoxSection
import com.cherrish.android.presentation.home.component.UpcomingPlanSection
import java.time.LocalDate
import kotlinx.collections.immutable.persistentListOf
import java.time.LocalDate

@Composable
fun HomeRoute(
Expand All @@ -43,6 +43,7 @@ fun HomeRoute(
is HomeSideEffect.NavigateToChallenge -> {
navigateToChallenge()
}

is HomeSideEffect.NavigateToCalendar -> {
navigateToCalendar(sideEffect.date)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,26 @@ class HomeViewModel @Inject constructor(
_uiState.update { UiState.Loading }

homeRepository.getMainDashboard().onSuccess { response ->
val level = response.cherryLevel
val safeIndex = level.coerceIn(
1,
CherrishGaugeType.entries.lastIndex
)
_uiState.update {
UiState.Success(
HomeUiState(
currentStep = response.cherryLevel,
currentStep = level,
gauges = CherrishGaugeType.entries.toImmutableList(),
challengeRate = response.challengeRate,
challengeName = response.challengeName,
todayDate = response.toTodayDateString(),
plans = response.recentProcedures.toImmutableList(),
upcomingPlans = response.upcomingProcedures.toImmutableList(),
selectedIndex = (response.cherryLevel - 1)
.coerceIn(0, CherrishGaugeType.entries.size - 1)
selectedIndex = safeIndex
)
Comment on lines +43 to 59
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โš ๏ธ Potential issue | ๐ŸŸ  Major

LEVEL0 ํฌํ•จ ์‹œ ์ƒํƒœ ๋ถˆ์ผ์น˜ ๊ฐ€๋Šฅ์„ฑ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ˜„์žฌ safeIndex๊ฐ€ ์ตœ์†Œ 1๋กœ ๊ณ ์ •๋˜์–ด level=0์ผ ๋•Œ selectedIndex๊ฐ€ 1๋กœ ์น˜์šฐ์น˜๊ณ , currentStep์€ 0์œผ๋กœ ๋‚จ์•„ UI ์ƒํƒœ๊ฐ€ ์–ด๊ธ‹๋‚  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‘˜ ๋‹ค ๊ฐ™์€ ์•ˆ์ „ ๋ฒ”์œ„๋ฅผ ๊ณต์œ ํ•˜๋„๋ก ์ •๋ฆฌํ•˜๋Š” ๊ฒŒ ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ”ง ์ œ์•ˆ ์ˆ˜์ •
-                val level = response.cherryLevel
-                val safeIndex = level.coerceIn(
-                    1,
-                    CherrishGaugeType.entries.lastIndex
-                )
+                val level = response.cherryLevel
+                val safeLevel = level.coerceIn(
+                    0,
+                    CherrishGaugeType.entries.lastIndex
+                )
 ...
-                            currentStep = level,
+                            currentStep = safeLevel,
 ...
-                            selectedIndex = safeIndex
+                            selectedIndex = safeLevel
๐Ÿค– Prompt for AI Agents
In `@app/src/main/java/com/cherrish/android/presentation/home/HomeViewModel.kt`
around lines 43 - 59, The current code clamps selectedIndex to at least 1
(safeIndex) but leaves currentStep using the raw response.cherryLevel, causing
UI mismatch when level == 0; inside the _uiState.update ->
UiState.Success(HomeUiState(...)) block, compute a single clamped value (e.g.,
safeLevel) from response.cherryLevel using coerceIn(1,
CherrishGaugeType.entries.lastIndex) and use that same safeLevel for both
currentStep and selectedIndex (replace references to level/currentStep or
safeIndex accordingly) so both fields share the identical safe range.

)
}
}.onLogFailure {}
}.onLogFailure { }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ fun ChallengeSection(
gauges: ImmutableList<CherrishGaugeType>,
modifier: Modifier = Modifier,
currentStep: Int = 0,
@DrawableRes imageRes: Int? = R.drawable.img_challenge_lv2,
@DrawableRes imageRes: Int? = R.drawable.img_challenge_lv1,
onChallengeStartClick: () -> Unit = {},
challengeName: String? = "์›ฐ๋‹ˆ์Šค โ€ข ๋งˆ์Œ์ฑ™๊น€",
challengeRate: Int = 0
) {
val hasChallenge = !challengeName.isNullOrBlank()

Box(
modifier = modifier.fillMaxWidth()
) {
if (currentStep != 0 && imageRes != null) {
if (hasChallenge && imageRes != null) {
Image(
painter = painterResource(id = imageRes),
contentDescription = null,
Expand All @@ -71,9 +73,9 @@ fun ChallengeSection(

Spacer(modifier = Modifier.height(10.dp))

if (currentStep == 0) {
if (!hasChallenge) {
NoChallenge(
currentStep = currentStep,
currentStep = 0,
gauges = gauges,
onChallengeStartClick = onChallengeStartClick
)
Expand All @@ -97,7 +99,7 @@ private fun Challenge(
challengeRate: Int,
modifier: Modifier = Modifier
) {
val safeStep = currentStep.coerceIn(1, gauges.size)
val safeStep = currentStep.coerceIn(0, gauges.lastIndex)

Column(
modifier = modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import com.cherrish.android.R

enum class CherrishGaugeType(
val step: Int,
@DrawableRes val image: Int?
@DrawableRes val image: Int
) {
LEVEL0(step = 0, image = null),
LEVEL0(step = 0, image = R.drawable.img_home_lv1),
LEVEL1(step = 1, image = R.drawable.img_home_lv1),
LEVEL2(step = 2, image = R.drawable.img_home_lv2),
LEVEL3(step = 3, image = R.drawable.img_home_lv3),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private fun MyPageScreen(
Text(
text = "์•—! ์•„์ง ์ค€๋น„์ค‘์ด์—์š”.",
color = CherrishTheme.colors.gray600,
style = CherrishTheme.typography.body1M14,
modifier = Modifier.padding(top = 20.dp)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -33,7 +34,9 @@ fun MyPageHeader(
Image(
painter = painterResource(id = profileIcon),
contentDescription = null,
modifier = Modifier.clip(CircleShape)
modifier = Modifier
.size(48.dp)
.clip(CircleShape)
)

Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ class SplashViewModel @Inject constructor(
viewModelScope.launch {
val id = tokenManager.getId()
_sideEffect.emit(
if (id != null) {
SplashSideEffect.NavigateToHome
} else {
SplashSideEffect.NavigateToOnboarding
}
SplashSideEffect.NavigateToOnboarding
// if (id != null) {
// SplashSideEffect.NavigateToHome
// } else {
// SplashSideEffect.NavigateToOnboarding
// }
)
}
}
Expand Down
Loading