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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- KYC screen (cu-16): a static, full-screen identity-verification flow
reached from Profile and the wallet withdraw tab. The front and back ID
slots simulate an upload (Empty -> Uploading -> Uploaded) with a mock
DNI preview, the progress meter and submit gate track both photos, and
Submit advances to the review banner. The review outcomes (Verified,
Suspended, Error) are exercised through @Preview until the KYC
repository drives them. Replaces the KYC placeholder in the nav graph.
- Round detail screen (cu-11): a static, full-screen view reached from
the history list with the result banner, the three-up stats grid, the
crash position bar, the round timeline, a collapsible provably-fair
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.plainstudio.stackcasino.feature.kyc

import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onAllNodesWithText
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.plainstudio.stackcasino.ui.theme.StackcasinoTheme
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class KycScreenTest {
@get:Rule
val composeRule = createComposeRule()

private fun setForm(
front: SlotStatus,
back: SlotStatus,
onBack: () -> Unit = {},
) {
composeRule.setContent {
StackcasinoTheme {
KycScreenContent(
state = KycUiState.Form(front, back),
onBack = onBack,
onPickFront = {},
onReplaceFront = {},
onPickBack = {},
onReplaceBack = {},
onSubmit = {},
)
}
}
}

@Test
fun empty_form_shows_both_dropzones_and_the_submit_hint() {
setForm(SlotStatus.Empty, SlotStatus.Empty)

composeRule.onNodeWithText("Upload front of ID").assertIsDisplayed()
composeRule.onNodeWithText("Upload back of ID").assertIsDisplayed()
composeRule.onNodeWithText("Upload both photos to continue").assertIsDisplayed()
}

@Test
fun both_uploaded_drops_the_submit_hint() {
setForm(SlotStatus.Uploaded, SlotStatus.Uploaded)

composeRule.onNodeWithText("Submit for Verification").assertIsDisplayed()
composeRule.onAllNodesWithText("Upload both photos to continue").assertCountEquals(0)
}

@Test
fun pending_state_shows_only_the_review_banner() {
composeRule.setContent {
StackcasinoTheme {
KycScreenContent(
state = KycUiState.Pending,
onBack = {},
onPickFront = {},
onReplaceFront = {},
onPickBack = {},
onReplaceBack = {},
onSubmit = {},
)
}
}

composeRule.onNodeWithText("Verification Under Review").assertIsDisplayed()
composeRule.onAllNodesWithText("Upload front of ID").assertCountEquals(0)
}

@Test
fun back_button_invokes_the_callback() {
var backPressed = false
setForm(SlotStatus.Empty, SlotStatus.Empty, onBack = { backPressed = true })

composeRule.onNodeWithContentDescription("Back").performClick()

assertTrue(backPressed)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
package com.plainstudio.stackcasino.feature.kyc

import androidx.compose.foundation.background
import androidx.compose.foundation.border
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.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.CheckCircle
import androidx.compose.material.icons.outlined.ErrorOutline
import androidx.compose.material.icons.outlined.Schedule
import androidx.compose.material.icons.outlined.WarningAmber
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.plainstudio.stackcasino.ui.theme.AccentViolet
import com.plainstudio.stackcasino.ui.theme.SemanticDanger
import com.plainstudio.stackcasino.ui.theme.SemanticOk
import com.plainstudio.stackcasino.ui.theme.SemanticWarn
import com.plainstudio.stackcasino.ui.theme.TextMedium

/**
* Review-outcome banners. Each collapses the KYC screen to a single
* tinted status card (the mockup hides the upload form in these states).
* The actions are visual stubs until the KYC repository ships.
*/
@Composable
internal fun KycPendingBanner() {
KycBanner(
accent = SemanticWarn,
icon = Icons.Outlined.Schedule,
title = "Verification Under Review",
message =
"Submitted 4/14/2026 · 9:22 AM. Our team typically reviews submissions within " +
"24 hours. You'll get a push notification when it's resolved.",
)
}

@Composable
internal fun KycVerifiedBanner() {
KycBanner(
accent = SemanticOk,
icon = Icons.Outlined.CheckCircle,
title = "Identity Verified",
message = "Your account has full withdrawal access. Approved 4/15/2026 · 11:08 AM.",
)
}

@Composable
internal fun KycSuspendedBanner() {
KycBanner(
accent = SemanticDanger,
icon = Icons.Outlined.ErrorOutline,
title = "Verification Rejected",
message = "Photos were blurry or the document edges were cropped. Contact support to re-submit.",
actionLabel = "Contact Support",
)
}

@Composable
internal fun KycErrorBanner() {
KycBanner(
accent = SemanticDanger,
icon = Icons.Outlined.WarningAmber,
title = "Upload Failed",
message = "Network error during upload to Firebase Storage. Check your connection and try again.",
actionLabel = "Retry Upload",
)
}

@Composable
private fun KycBanner(
accent: Color,
icon: ImageVector,
title: String,
message: String,
actionLabel: String? = null,
) {
Row(
modifier =
Modifier
.fillMaxWidth()
.background(accent.copy(alpha = BANNER_TINT_ALPHA))
.border(width = 1.dp, color = accent.copy(alpha = BANNER_BORDER_ALPHA))
.padding(CardPadding),
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
Icon(
imageVector = icon,
contentDescription = null,
tint = accent,
modifier = Modifier.size(BannerIconSize).padding(top = 2.dp),
)
Column(modifier = Modifier.weight(1f)) {
Text(text = title, color = accent, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
Spacer(modifier = Modifier.height(4.dp))
Text(text = message, color = TextMedium, fontSize = 12.sp, lineHeight = 18.sp)
if (actionLabel != null) {
Spacer(modifier = Modifier.height(8.dp))
Text(
text = actionLabel,
color = AccentViolet,
fontSize = 11.sp,
fontWeight = FontWeight.SemiBold,
letterSpacing = TrackedLetterSpacing,
modifier = Modifier.clickable { /* support / retry ships with the KYC repository */ },
)
}
}
}
}

private const val BANNER_TINT_ALPHA = 0.05f
private const val BANNER_BORDER_ALPHA = 0.50f
private val BannerIconSize = 18.dp
Loading
Loading