Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit a80ad86

Browse files
committed
chore: organize error codes from gen types
1 parent 2daf6cf commit a80ad86

File tree

9 files changed

+493
-121
lines changed

9 files changed

+493
-121
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"runtimeExecutable": "bash",
6464
"runtimeArgs": [
6565
"-lc",
66-
"./gradlew :openiap:test --no-daemon"
66+
"./gradlew :openiap:testDebugUnitTest --no-daemon"
6767
],
6868
"console": "integratedTerminal"
6969
}

Example/src/main/java/dev/hyo/martie/screens/PurchaseFlowScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ fun PurchaseFlowScreen(
196196
PurchaseResultCard(
197197
message = result.message,
198198
status = result.status,
199-
onDismiss = { iapStore.clearStatusMessage() }
199+
onDismiss = { iapStore.clearStatusMessage() },
200+
code = result.code
200201
)
201202
if (result.status == PurchaseResultStatus.Success) {
202203
Row(

Example/src/main/java/dev/hyo/martie/screens/SubscriptionFlowScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ fun SubscriptionFlowScreen(
247247
PurchaseResultCard(
248248
message = result.message,
249249
status = result.status,
250-
onDismiss = { iapStore.clearStatusMessage() }
250+
onDismiss = { iapStore.clearStatusMessage() },
251+
code = result.code
251252
)
252253
}
253254
}

Example/src/main/java/dev/hyo/martie/screens/uis/PurchaseResultCard.kt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import dev.hyo.openiap.store.PurchaseResultStatus
1818
fun PurchaseResultCard(
1919
message: String,
2020
status: PurchaseResultStatus,
21-
onDismiss: () -> Unit
21+
onDismiss: () -> Unit,
22+
code: String? = null
2223
) {
2324
val (background, contentColor, icon) = when (status) {
2425
PurchaseResultStatus.Success -> Triple(AppColors.success.copy(alpha = 0.1f), AppColors.success, Icons.Default.CheckCircle)
@@ -45,11 +46,20 @@ fun PurchaseResultCard(
4546
horizontalArrangement = Arrangement.spacedBy(12.dp)
4647
) {
4748
Icon(icon, contentDescription = null, tint = contentColor, modifier = Modifier.size(24.dp))
48-
Text(
49-
message,
50-
style = MaterialTheme.typography.bodyMedium,
51-
color = contentColor
52-
)
49+
Column {
50+
if (code != null && (status == PurchaseResultStatus.Error || status == PurchaseResultStatus.Info)) {
51+
Text(
52+
"Code: $code",
53+
style = MaterialTheme.typography.bodySmall,
54+
color = contentColor.copy(alpha = 0.8f)
55+
)
56+
}
57+
Text(
58+
message,
59+
style = MaterialTheme.typography.bodyMedium,
60+
color = contentColor
61+
)
62+
}
5363
}
5464
IconButton(onClick = onDismiss) {
5565
Icon(

0 commit comments

Comments
 (0)