gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] branch master updated (3ab1c7d -> 67e70a3)


From: gnunet
Subject: [taler-taler-android] branch master updated (3ab1c7d -> 67e70a3)
Date: Tue, 21 Mar 2023 17:28:57 +0100

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a change to branch master
in repository taler-android.

    from 3ab1c7d  [wallet] use a default expiry constant
     new b1a1149  [wallet] Expand JSON error in XML transaction detail fragments
     new c98d7db  [wallet] slight tweaks to showing errors in XML transactions
     new 1a230b0  [wallet] Expand JSON error in Compose transaction detail 
fragments
     new 67e70a3  [wallet] slight tweaks to showing errors in compose 
transactions

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../wallet/deposit/TransactionDepositComposable.kt |  11 ++-
 .../taler/wallet/peer/TransactionPeerPullCredit.kt |   5 +-
 .../taler/wallet/peer/TransactionPeerPullDebit.kt  |   5 +-
 .../taler/wallet/peer/TransactionPeerPushCredit.kt |   5 +-
 .../taler/wallet/peer/TransactionPeerPushDebit.kt  |   5 +-
 .../transactions/ErrorTransactionComposable.kt     | 109 +++++++++++++++++++++
 .../transactions/TransactionDepositFragment.kt     |   2 +-
 .../transactions/TransactionDetailFragment.kt      |  32 ++++++
 .../transactions/TransactionPaymentFragment.kt     |   7 ++
 .../wallet/transactions/TransactionPeerFragment.kt |   7 +-
 .../transactions/TransactionRefreshFragment.kt     |   7 ++
 .../transactions/TransactionRefundFragment.kt      |   7 ++
 .../wallet/transactions/TransactionTipFragment.kt  |  12 ++-
 .../transactions/TransactionWithdrawalFragment.kt  |   6 ++
 .../res/layout/fragment_transaction_payment.xml    |  19 +++-
 .../res/layout/fragment_transaction_withdrawal.xml |  19 +++-
 16 files changed, 244 insertions(+), 14 deletions(-)
 create mode 100644 
wallet/src/main/java/net/taler/wallet/transactions/ErrorTransactionComposable.kt

diff --git 
a/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt 
b/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt
index a06fed4..3d59b35 100644
--- 
a/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt
@@ -35,14 +35,17 @@ import net.taler.common.Amount
 import net.taler.common.Timestamp
 import net.taler.common.toAbsoluteTime
 import net.taler.wallet.R
+import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED
+import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.transactions.AmountType
 import net.taler.wallet.transactions.DeleteTransactionComposable
+import net.taler.wallet.transactions.ErrorTransactionButton
 import net.taler.wallet.transactions.ExtendedStatus.Pending
 import net.taler.wallet.transactions.TransactionAmountComposable
 import net.taler.wallet.transactions.TransactionDeposit
 
 @Composable
-fun TransactionDepositComposable(t: TransactionDeposit, onDelete: () -> Unit) {
+fun TransactionDepositComposable(t: TransactionDeposit, devMode: Boolean?, 
onDelete: () -> Unit) {
     val scrollState = rememberScrollState()
     Column(
         modifier = Modifier
@@ -75,6 +78,9 @@ fun TransactionDepositComposable(t: TransactionDeposit, 
onDelete: () -> Unit) {
             )
         }
         DeleteTransactionComposable(onDelete)
+        if (devMode == true && t.error != null) {
+            ErrorTransactionButton(error = t.error)
+        }
     }
 }
 
@@ -89,8 +95,9 @@ fun TransactionDepositComposablePreview() {
         amountRaw = Amount.fromDouble("TESTKUDOS", 42.1337),
         amountEffective = Amount.fromDouble("TESTKUDOS", 42.23),
         targetPaytoUri = "https://exchange.example.org/peer/pull/credit";,
+        error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED),
     )
     Surface {
-        TransactionDepositComposable(t) {}
+        TransactionDepositComposable(t, true) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt 
b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt
index 0687b0f..d6b798c 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt
@@ -29,6 +29,8 @@ import androidx.compose.ui.unit.dp
 import net.taler.common.Amount
 import net.taler.common.Timestamp
 import net.taler.wallet.R
+import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED
+import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.compose.QrCodeUriComposable
 import net.taler.wallet.transactions.AmountType
 import net.taler.wallet.transactions.ExtendedStatus.Pending
@@ -92,8 +94,9 @@ fun TransactionPeerPullCreditPreview() {
             summary = "test invoice",
         ),
         talerUri = "https://exchange.example.org/peer/pull/credit";,
+        error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED),
     )
     Surface {
-        TransactionPeerComposable(t) {}
+        TransactionPeerComposable(t, true) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt 
b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt
index 3325776..1bbc223 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt
@@ -23,6 +23,8 @@ import androidx.compose.ui.tooling.preview.Preview
 import net.taler.common.Amount
 import net.taler.common.Timestamp
 import net.taler.wallet.R
+import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED
+import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.transactions.AmountType
 import net.taler.wallet.transactions.ExtendedStatus.Pending
 import net.taler.wallet.transactions.PeerInfoShort
@@ -71,8 +73,9 @@ fun TransactionPeerPullDebitPreview() {
             expiration = Timestamp.fromMillis(System.currentTimeMillis() + 60 
* 60 * 1000),
             summary = "test invoice",
         ),
+        error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED),
     )
     Surface {
-        TransactionPeerComposable(t) {}
+        TransactionPeerComposable(t, true) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt 
b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt
index e6fd002..d6f4cab 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt
@@ -23,6 +23,8 @@ import androidx.compose.ui.tooling.preview.Preview
 import net.taler.common.Amount
 import net.taler.common.Timestamp
 import net.taler.wallet.R
+import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED
+import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.transactions.AmountType
 import net.taler.wallet.transactions.ExtendedStatus.Pending
 import net.taler.wallet.transactions.PeerInfoShort
@@ -71,8 +73,9 @@ fun TransactionPeerPushCreditPreview() {
             expiration = Timestamp.fromMillis(System.currentTimeMillis() + 60 
* 60 * 1000),
             summary = "test invoice",
         ),
+        error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED),
     )
     Surface {
-        TransactionPeerComposable(t) {}
+        TransactionPeerComposable(t, true) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt 
b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt
index 56b3626..b8e8ff4 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt
@@ -29,6 +29,8 @@ import androidx.compose.ui.unit.dp
 import net.taler.common.Amount
 import net.taler.common.Timestamp
 import net.taler.wallet.R
+import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED
+import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.compose.QrCodeUriComposable
 import net.taler.wallet.transactions.AmountType
 import net.taler.wallet.transactions.ExtendedStatus.Pending
@@ -90,8 +92,9 @@ fun TransactionPeerPushDebitPreview() {
             summary = "test invoice",
         ),
         talerUri = "https://exchange.example.org/peer/pull/credit";,
+        error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED),
     )
     Surface {
-        TransactionPeerComposable(t) {}
+        TransactionPeerComposable(t, true) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/ErrorTransactionComposable.kt
 
b/wallet/src/main/java/net/taler/wallet/transactions/ErrorTransactionComposable.kt
new file mode 100644
index 0000000..3cbc9e1
--- /dev/null
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/ErrorTransactionComposable.kt
@@ -0,0 +1,109 @@
+/*
+ * This file is part of GNU Taler
+ * (C) 2023 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under 
the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
+ * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+
+package net.taler.wallet.transactions
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.size
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Error
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontFamily
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
+import net.taler.wallet.R
+import net.taler.wallet.backend.TalerErrorInfo
+import net.taler.wallet.compose.copyToClipBoard
+
+@Composable
+fun ErrorTransactionButton(
+    modifier: Modifier = Modifier,
+    error: TalerErrorInfo,
+) {
+    val showDialog = remember { mutableStateOf(false) }
+
+    if (showDialog.value) {
+        @Suppress("OPT_IN_USAGE")
+        val json = Json {
+            prettyPrint = true
+            prettyPrintIndent = "  "
+        }
+        val message = json.encodeToString(error)
+        AlertDialog(
+            onDismissRequest = {
+                showDialog.value = false
+            },
+            title = {
+                Text(stringResource(R.string.nav_error))
+            },
+            text = {
+                Column {
+                    Text(
+                        fontFamily = FontFamily.Monospace,
+                        text = message,
+                    )
+                }
+            },
+            dismissButton = {
+                TextButton(onClick = {
+                    showDialog.value = false
+                }) {
+                    Text(stringResource(R.string.close))
+                }
+            },
+            confirmButton = {
+                val context = LocalContext.current
+                TextButton(onClick = {
+                    copyToClipBoard(context, 
context.getString(R.string.nav_error), message)
+                }) {
+                    Text(stringResource(R.string.copy))
+                }
+            })
+    }
+
+    Button(
+        modifier = modifier,
+        colors = ButtonDefaults.buttonColors(
+            contentColor = MaterialTheme.colorScheme.onError,
+            containerColor = MaterialTheme.colorScheme.error,
+        ),
+        onClick = {
+            showDialog.value = true
+        }
+    ) {
+        val label = stringResource(R.string.nav_error)
+        Icon(
+            imageVector = Icons.Default.Error,
+            contentDescription = label,
+            modifier = Modifier.size(ButtonDefaults.IconSize),
+        )
+        Spacer(Modifier.size(ButtonDefaults.IconSpacing))
+        Text(label)
+    }
+}
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDepositFragment.kt
 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDepositFragment.kt
index dd09b4c..3fd37ce 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDepositFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDepositFragment.kt
@@ -35,7 +35,7 @@ class TransactionDepositFragment : 
TransactionDetailFragment() {
         setContent {
             TalerSurface {
                 val t = 
transactionManager.selectedTransaction.observeAsState().value
-                if (t is TransactionDeposit) TransactionDepositComposable(t) {
+                if (t is TransactionDeposit) TransactionDepositComposable(t, 
devMode.value) {
                     onDeleteButtonClicked(t)
                 }
             }
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
index 1905a05..d37728f 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
@@ -28,9 +28,12 @@ import androidx.fragment.app.Fragment
 import androidx.fragment.app.activityViewModels
 import androidx.navigation.fragment.findNavController
 import com.google.android.material.dialog.MaterialAlertDialogBuilder
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
 import net.taler.common.Amount
 import net.taler.wallet.MainViewModel
 import net.taler.wallet.R
+import net.taler.wallet.compose.copyToClipBoard
 import net.taler.wallet.getAttrColor
 import net.taler.wallet.launchInAppBrowser
 
@@ -38,6 +41,7 @@ abstract class TransactionDetailFragment : Fragment() {
 
     private val model: MainViewModel by activityViewModels()
     val transactionManager by lazy { model.transactionManager }
+    val devMode by lazy { model.devMode }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -98,8 +102,10 @@ abstract class TransactionDetailFragment : Fragment() {
 
     @StringRes
     protected open val deleteDialogTitle = R.string.transactions_delete
+
     @StringRes
     protected open val deleteDialogMessage = 
R.string.transactions_delete_dialog_message
+
     @StringRes
     protected open val deleteDialogButton = R.string.transactions_delete
 
@@ -122,4 +128,30 @@ abstract class TransactionDetailFragment : Fragment() {
         findNavController().popBackStack()
     }
 
+    protected fun onShowErrorButtonClicked(t: Transaction) {
+        val err = t.error
+        require(err != null) { "Transaction had no error." }
+
+        @Suppress("OPT_IN_USAGE")
+        val json = Json {
+            prettyPrint = true
+            prettyPrintIndent = "  "
+        }
+        val message = json.encodeToString(err)
+        MaterialAlertDialogBuilder(requireContext(), 
R.style.MaterialAlertDialog_Material3)
+            .setTitle(getString(R.string.nav_error))
+            .setMessage(message)
+            .setNeutralButton(R.string.close) { dialog, _ ->
+                dialog.cancel()
+            }
+            .setPositiveButton(R.string.copy) { _, _ ->
+                copyToClipBoard(
+                    requireContext(),
+                    getString(R.string.nav_error),
+                    message,
+                )
+            }
+            .show()
+    }
+
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionPaymentFragment.kt
 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionPaymentFragment.kt
index ec18c98..068a41e 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionPaymentFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionPaymentFragment.kt
@@ -19,6 +19,7 @@ package net.taler.wallet.transactions
 import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
+import android.view.View.VISIBLE
 import android.view.ViewGroup
 import net.taler.common.toAbsoluteTime
 import net.taler.wallet.databinding.FragmentTransactionPaymentBinding
@@ -55,6 +56,12 @@ class TransactionPaymentFragment : 
TransactionDetailFragment() {
             ui.deleteButton.setOnClickListener {
                 onDeleteButtonClicked(t)
             }
+            if (devMode.value == true && t.error != null) {
+                ui.showErrorButton.visibility = VISIBLE
+                ui.showErrorButton.setOnClickListener {
+                    onShowErrorButtonClicked(t)
+                }
+            }
         }
     }
 
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionPeerFragment.kt 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionPeerFragment.kt
index 3d99774..297c937 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionPeerFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionPeerFragment.kt
@@ -56,7 +56,7 @@ class TransactionPeerFragment : TransactionDetailFragment() {
         setContent {
             TalerSurface {
                 val t = 
transactionManager.selectedTransaction.observeAsState(null).value
-                if (t != null) TransactionPeerComposable(t) {
+                if (t != null) TransactionPeerComposable(t, devMode.value) {
                     onDeleteButtonClicked(t)
                 }
             }
@@ -65,7 +65,7 @@ class TransactionPeerFragment : TransactionDetailFragment() {
 }
 
 @Composable
-fun TransactionPeerComposable(t: Transaction, onDelete: () -> Unit) {
+fun TransactionPeerComposable(t: Transaction, devMode: Boolean?, onDelete: () 
-> Unit) {
     val scrollState = rememberScrollState()
     Column(
         modifier = Modifier
@@ -87,6 +87,9 @@ fun TransactionPeerComposable(t: Transaction, onDelete: () -> 
Unit) {
             else -> error("unexpected transaction: ${t::class.simpleName}")
         }
         DeleteTransactionComposable(onDelete)
+        if (devMode == true && t.error != null) {
+            ErrorTransactionButton(error = t.error!!)
+        }
     }
 }
 
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt
 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt
index 4c26449..36d3bc7 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefreshFragment.kt
@@ -20,6 +20,7 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.View.GONE
+import android.view.View.VISIBLE
 import android.view.ViewGroup
 import net.taler.common.toAbsoluteTime
 import net.taler.wallet.R
@@ -55,6 +56,12 @@ class TransactionRefreshFragment : 
TransactionDetailFragment() {
             ui.deleteButton.setOnClickListener {
                 onDeleteButtonClicked(t)
             }
+            if (devMode.value == true && t.error != null) {
+                ui.showErrorButton.visibility = VISIBLE
+                ui.showErrorButton.setOnClickListener {
+                    onShowErrorButtonClicked(t)
+                }
+            }
         }
     }
 
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefundFragment.kt
 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefundFragment.kt
index 125ae0c..9c30609 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefundFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionRefundFragment.kt
@@ -19,6 +19,7 @@ package net.taler.wallet.transactions
 import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
+import android.view.View.VISIBLE
 import android.view.ViewGroup
 import androidx.core.content.ContextCompat.getColor
 import net.taler.common.toAbsoluteTime
@@ -60,6 +61,12 @@ class TransactionRefundFragment : 
TransactionDetailFragment() {
             ui.deleteButton.setOnClickListener {
                 onDeleteButtonClicked(t)
             }
+            if (devMode.value == true && t.error != null) {
+                ui.showErrorButton.visibility = VISIBLE
+                ui.showErrorButton.setOnClickListener {
+                    onShowErrorButtonClicked(t)
+                }
+            }
         }
     }
 
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionTipFragment.kt 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionTipFragment.kt
index 02b522f..eb148b8 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionTipFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionTipFragment.kt
@@ -41,6 +41,8 @@ import net.taler.common.Amount
 import net.taler.common.Timestamp
 import net.taler.common.toAbsoluteTime
 import net.taler.wallet.R
+import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED
+import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.compose.TalerSurface
 import net.taler.wallet.transactions.ExtendedStatus.Pending
 
@@ -54,7 +56,7 @@ class TransactionTipFragment : TransactionDetailFragment() {
         setContent {
             TalerSurface {
                 val t = 
transactionManager.selectedTransaction.observeAsState(null).value
-                if (t is TransactionTip) TransactionTipComposable(t) {
+                if (t is TransactionTip) TransactionTipComposable(t, 
devMode.value) {
                     onDeleteButtonClicked(t)
                 }
             }
@@ -63,7 +65,7 @@ class TransactionTipFragment : TransactionDetailFragment() {
 }
 
 @Composable
-fun TransactionTipComposable(t: TransactionTip, onDelete: () -> Unit) {
+fun TransactionTipComposable(t: TransactionTip, devMode: Boolean?, onDelete: 
() -> Unit) {
     val scrollState = rememberScrollState()
     Column(
         modifier = Modifier
@@ -101,6 +103,9 @@ fun TransactionTipComposable(t: TransactionTip, onDelete: 
() -> Unit) {
             info = t.merchantBaseUrl,
         )
         DeleteTransactionComposable(onDelete)
+        if (devMode == true && t.error != null) {
+            ErrorTransactionButton(error = t.error)
+        }
     }
 }
 
@@ -114,8 +119,9 @@ fun TransactionTipPreview() {
         merchantBaseUrl = "https://merchant.example.org/";,
         amountRaw = Amount.fromDouble("TESTKUDOS", 42.23),
         amountEffective = Amount.fromDouble("TESTKUDOS", 42.1337),
+        error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED),
     )
     Surface {
-        TransactionTipComposable(t) {}
+        TransactionTipComposable(t, true) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt
 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt
index 9a43efa..ad70d2f 100644
--- 
a/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt
+++ 
b/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt
@@ -73,6 +73,12 @@ class TransactionWithdrawalFragment : 
TransactionDetailFragment() {
             ui.deleteButton.setOnClickListener {
                 onDeleteButtonClicked(t)
             }
+            if (devMode.value == true && t.error != null) {
+                ui.showErrorButton.visibility = VISIBLE
+                ui.showErrorButton.setOnClickListener {
+                    onShowErrorButtonClicked(t)
+                }
+            }
         }
     }
 
diff --git a/wallet/src/main/res/layout/fragment_transaction_payment.xml 
b/wallet/src/main/res/layout/fragment_transaction_payment.xml
index b57315f..5b674bd 100644
--- a/wallet/src/main/res/layout/fragment_transaction_payment.xml
+++ b/wallet/src/main/res/layout/fragment_transaction_payment.xml
@@ -122,11 +122,28 @@
             app:backgroundTint="?colorError"
             app:icon="@drawable/ic_delete"
             app:iconTint="?colorOnError"
-            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintBottom_toTopOf="@id/showErrorButton"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/orderIdView" />
 
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/showErrorButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginVertical="10dp"
+            android:visibility="gone"
+            android:text="@string/nav_error"
+            app:backgroundTint="?colorError"
+            app:icon="@drawable/ic_error"
+            android:textColor="?colorOnError"
+            app:iconTint="?colorOnError"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/deleteButton"
+            tools:visibility="visible" />
+
     </androidx.constraintlayout.widget.ConstraintLayout>
 
 </ScrollView>
diff --git a/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml 
b/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml
index 100ddbc..87530a4 100644
--- a/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml
+++ b/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml
@@ -149,11 +149,28 @@
             app:icon="@drawable/ic_delete"
             android:textColor="?colorOnError"
             app:iconTint="?colorOnError"
-            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintBottom_toTopOf="@id/showErrorButton"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/exchangeView" />
 
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/showErrorButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginVertical="10dp"
+            android:visibility="gone"
+            android:text="@string/nav_error"
+            app:backgroundTint="?colorError"
+            app:icon="@drawable/ic_error"
+            android:textColor="?colorOnError"
+            app:iconTint="?colorOnError"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/deleteButton"
+            tools:visibility="visible" />
+
     </androidx.constraintlayout.widget.ConstraintLayout>
 
 </ScrollView>

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]