feat: make PaymentRecord immutable and add keys to HistoryScreen

This commit is contained in:
2026-06-08 17:07:20 +02:00
parent a232d4bfde
commit 6bd42b61cc
2 changed files with 8 additions and 2 deletions
@@ -1,5 +1,6 @@
package com.bitcointxoko.gudariwallet.api package com.bitcointxoko.gudariwallet.api
import androidx.compose.runtime.Immutable
import com.google.gson.TypeAdapter import com.google.gson.TypeAdapter
import com.google.gson.annotations.JsonAdapter import com.google.gson.annotations.JsonAdapter
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
@@ -156,6 +157,7 @@ data class LnurlpLink(
// ── Payment history ─────────────────────────────────────────────────────────── // ── Payment history ───────────────────────────────────────────────────────────
@Immutable
data class PaymentRecord( data class PaymentRecord(
@SerializedName("payment_hash") val paymentHash: String, @SerializedName("payment_hash") val paymentHash: String,
@SerializedName("checking_id") val checkingId: String, @SerializedName("checking_id") val checkingId: String,
@@ -204,6 +206,8 @@ data class PaymentRecord(
} }
} }
@Immutable
data class PaymentExtra( data class PaymentExtra(
@SerializedName("tag") val tag: String?, @SerializedName("tag") val tag: String?,
@JsonAdapter(FlexibleStringAdapter::class) @JsonAdapter(FlexibleStringAdapter::class)
@@ -214,6 +218,7 @@ data class PaymentExtra(
@SerializedName("expires_at") val expiresAt: String? @SerializedName("expires_at") val expiresAt: String?
) )
@Immutable
data class SuccessAction( data class SuccessAction(
@SerializedName("tag") val tag: String?, @SerializedName("tag") val tag: String?,
@SerializedName("message") val message: String?, @SerializedName("message") val message: String?,
@@ -226,7 +226,8 @@ fun HistoryScreen(
) { ) {
items( items(
items = s.payments, items = s.payments,
key = { it.paymentHash } key = { it.paymentHash },
contentType = { "payment" }
) { payment -> ) { payment ->
PaymentRow( PaymentRow(
payment = payment, payment = payment,
@@ -240,7 +241,7 @@ fun HistoryScreen(
) )
} }
if (s.canLoadMore) { if (s.canLoadMore) {
item { item(contentType = "loader") {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()