feat: add details button to receive
This commit is contained in:
@@ -59,7 +59,10 @@ import com.bitcointxoko.gudariwallet.util.fiatLabel
|
|||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ReceiveScreen(vm: WalletViewModel) {
|
fun ReceiveScreen(
|
||||||
|
vm: WalletViewModel,
|
||||||
|
onNavigateToPaymentDetail : (checkingId: String) -> Unit
|
||||||
|
) {
|
||||||
val receiveState by vm.receiveState.collectAsStateWithLifecycle()
|
val receiveState by vm.receiveState.collectAsStateWithLifecycle()
|
||||||
val lightningAddress by vm.lightningAddress.collectAsStateWithLifecycle()
|
val lightningAddress by vm.lightningAddress.collectAsStateWithLifecycle()
|
||||||
val fiatRate by vm.fiatSatsPerUnit.collectAsStateWithLifecycle()
|
val fiatRate by vm.fiatSatsPerUnit.collectAsStateWithLifecycle()
|
||||||
@@ -141,7 +144,8 @@ fun ReceiveScreen(vm: WalletViewModel) {
|
|||||||
memo = state.memo,
|
memo = state.memo,
|
||||||
fiatRate = fiatRate,
|
fiatRate = fiatRate,
|
||||||
fiatCurrency = fiatCurrency,
|
fiatCurrency = fiatCurrency,
|
||||||
onDone = { vm.resetReceiveState() }
|
onDone = { vm.resetReceiveState() },
|
||||||
|
onDetails = { onNavigateToPaymentDetail(state.checkingId) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,7 +659,8 @@ private fun ReceiveSuccessContent(
|
|||||||
memo : String?,
|
memo : String?,
|
||||||
fiatRate : Double?,
|
fiatRate : Double?,
|
||||||
fiatCurrency : String?,
|
fiatCurrency : String?,
|
||||||
onDone : () -> Unit
|
onDone : () -> Unit,
|
||||||
|
onDetails : () -> Unit
|
||||||
) {
|
) {
|
||||||
val fiatLabel = fiatLabel(amountSats, fiatRate, fiatCurrency)
|
val fiatLabel = fiatLabel(amountSats, fiatRate, fiatCurrency)
|
||||||
|
|
||||||
@@ -680,7 +685,11 @@ private fun ReceiveSuccessContent(
|
|||||||
Text(memo, style = MaterialTheme.typography.bodyMedium)
|
Text(memo, style = MaterialTheme.typography.bodyMedium)
|
||||||
}
|
}
|
||||||
Spacer(Modifier.height(32.dp))
|
Spacer(Modifier.height(32.dp))
|
||||||
Button(onClick = onDone, modifier = Modifier.fillMaxWidth()) {
|
Button(onClick = onDetails, modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Text("Details")
|
||||||
|
}
|
||||||
|
Spacer(Modifier.height(32.dp))
|
||||||
|
TextButton(onClick = onDone, modifier = Modifier.fillMaxWidth()) {
|
||||||
Text("Done")
|
Text("Done")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ sealed class ReceiveState {
|
|||||||
) : ReceiveState()
|
) : ReceiveState()
|
||||||
data class PaymentReceived(
|
data class PaymentReceived(
|
||||||
val amountSats: Long,
|
val amountSats: Long,
|
||||||
val memo : String?
|
val memo : String?,
|
||||||
|
val checkingId : String
|
||||||
) : ReceiveState()
|
) : ReceiveState()
|
||||||
data class Error(val message: String) : ReceiveState()
|
data class Error(val message: String) : ReceiveState()
|
||||||
data class LnurlWithdrawReady(
|
data class LnurlWithdrawReady(
|
||||||
|
|||||||
@@ -265,7 +265,12 @@ fun WalletScreen(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
composable(TabItem.Receive.route) { ReceiveScreen(vm) }
|
composable(TabItem.Receive.route) { ReceiveScreen(
|
||||||
|
vm,
|
||||||
|
onNavigateToPaymentDetail = { checkingId ->
|
||||||
|
navController.navigate("payment_detail/$checkingId")
|
||||||
|
}
|
||||||
|
)}
|
||||||
composable(TabItem.Send.route) { SendScreen(vm) }
|
composable(TabItem.Send.route) { SendScreen(vm) }
|
||||||
|
|
||||||
// Scanner — full screen, no bottom chrome
|
// Scanner — full screen, no bottom chrome
|
||||||
|
|||||||
@@ -342,7 +342,8 @@ class WalletViewModel(
|
|||||||
Log.d(TAG, "BALANCE [WS RECEIVE] Marking invoice ${rs.paymentHash.take(8)}… as received")
|
Log.d(TAG, "BALANCE [WS RECEIVE] Marking invoice ${rs.paymentHash.take(8)}… as received")
|
||||||
_receiveState.value = ReceiveState.PaymentReceived(
|
_receiveState.value = ReceiveState.PaymentReceived(
|
||||||
amountSats = event.amountSats,
|
amountSats = event.amountSats,
|
||||||
memo = event.memo
|
memo = event.memo,
|
||||||
|
checkingId = rs.paymentHash
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user