Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal fun PenaltiesResponse?.toDomain(): ChallengePenalties =
watcher = this?.watcher ?: false,
)

/** 인증 `{ type, method, detail, requiredPermissions }`. */
/** 인증 `{ type, method, detail, requiredPermissions, guide }`. */
@Serializable
data class VerificationResponse(
@SerialName("type")
Expand All @@ -67,6 +67,8 @@ data class VerificationResponse(
val detail: String? = null,
@SerialName("requiredPermissions")
val requiredPermissions: List<String>? = null,
@SerialName("guide")
val guide: String? = null,
)

/** 미지의 method 는 [VerificationMethod.SELF_CHECK] 로 떨어뜨린다 */
Expand All @@ -79,6 +81,7 @@ internal fun VerificationResponse?.toDomain(): VerificationConfig {
method = method,
detail = this?.detail,
requiredPermissions = this?.requiredPermissions.orEmpty(),
guide = this?.guide,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,17 @@ class ChallengeDetailMappingTest {
assertNull(ChallengeDetailResponse(challengeId = "c1", weeklyCount = 0).toDomain().weeklyCount)
assertNull(ChallengeDetailResponse(challengeId = "c1", weeklyCount = 8).toDomain().weeklyCount)
}

@Test
fun `인증 방법 안내를 그대로 옮긴다`() {
val response =
ChallengeDetailResponse(challengeId = "c1", verification = VerificationResponse(guide = "매일 10,000걸음 이상 걸으면 자동 인증됩니다."))
assertEquals("매일 10,000걸음 이상 걸으면 자동 인증됩니다.", response.toDomain().verification.guide)
}

@Test
fun `인증 방법 안내가 아직 없으면 비워 둔다`() {
// 서버가 채우는 중이다. 화면이 「아직 입력중입니다.」로 가른다.
assertNull(ChallengeDetailResponse(challengeId = "c1", verification = VerificationResponse()).toDomain().verification.guide)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ data class VerificationConfig(
// 표시 문구(예: "기상 06:00 ±10분 내 10걸음").
val detail: String? = null,
val requiredPermissions: List<String> = emptyList(),
// 인증 방법 안내. 생성 직후·빈도·목표값·인증 방식 변경 직후에는 서버가 채우는 중이라 null 이다.
val guide: String? = null,
)

/** 목표값 입력 종류 */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ruleup.challenge.presentation.common

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.ruleup.designsystem.theme.RuleUpTheme

/** 인증 방법 안내(서버가 준 verification.guide). 서버가 아직 채우는 중이면 그렇다고 알린다. */
@Composable
internal fun VerificationGuideText(
guide: String?,
modifier: Modifier = Modifier,
) {
Text(
text = guide ?: "아직 입력중입니다.",
color = if (guide != null) RuleUpTheme.colors.textSlate else RuleUpTheme.colors.textMuted,
style = RuleUpTheme.typography.body,
modifier = modifier,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.ruleup.challenge.domain.entity.ChallengeDetail
import com.ruleup.challenge.domain.entity.ChallengeLimits
import com.ruleup.challenge.domain.entity.JoinNote
import com.ruleup.challenge.presentation.common.RequiredPermissionList
import com.ruleup.challenge.presentation.common.VerificationGuideText
import com.ruleup.challenge.presentation.common.capacityLabel
import com.ruleup.challenge.presentation.create.label
import com.ruleup.designsystem.component.RuleUpCard
Expand Down Expand Up @@ -108,6 +109,7 @@ internal fun DetailInfoPage(
detail.verification.detail?.let {
Text(text = it, color = RuleUpTheme.colors.textSlate, style = RuleUpTheme.typography.body)
}
VerificationGuideText(guide = detail.verification.guide)
// 가입 전에 어떤 권한을 내줘야 하는지 알게 한다
RequiredPermissionList(tokens = requiredPermissions, snapshot = permissions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.ruleup.challenge.domain.entity.ChallengeRoom
import com.ruleup.challenge.domain.entity.OwnerType
import com.ruleup.challenge.domain.entity.TodayVerificationStatus
import com.ruleup.challenge.presentation.common.RequiredPermissionList
import com.ruleup.challenge.presentation.common.VerificationGuideText
import com.ruleup.challenge.presentation.common.capacityLabel
import com.ruleup.designsystem.component.RuleUpCard
import com.ruleup.designsystem.component.StatusChip
Expand Down Expand Up @@ -423,6 +424,7 @@ internal fun VerificationRuleCard(
color = RuleUpTheme.colors.textSlate,
style = RuleUpTheme.typography.body,
)
VerificationGuideText(guide = detail.verification.guide)
RequiredPermissionList(tokens = requiredPermissions, snapshot = permissions)
}
}
Expand Down
Loading