gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-android] 06/06: [wallet] Statically import TalerErrorCode f


From: gnunet
Subject: [taler-taler-android] 06/06: [wallet] Statically import TalerErrorCode fields.
Date: Mon, 23 Jan 2023 19:34:18 +0100

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

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

commit 890452c60bcef81480d807a8a9effe67fd6aab0c
Author: Iván Ávalos <avalos@disroot.org>
AuthorDate: Wed Jan 18 11:14:12 2023 -0600

    [wallet] Statically import TalerErrorCode fields.
---
 wallet/src/main/java/net/taler/wallet/Utils.kt                        | 4 ++--
 wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt     | 3 ++-
 wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt      | 4 ++--
 .../main/java/net/taler/wallet/peer/OutgoingPullResultComposable.kt   | 4 ++--
 .../main/java/net/taler/wallet/peer/OutgoingPushResultComposable.kt   | 4 ++--
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/wallet/src/main/java/net/taler/wallet/Utils.kt 
b/wallet/src/main/java/net/taler/wallet/Utils.kt
index 259e3f4..6b66368 100644
--- a/wallet/src/main/java/net/taler/wallet/Utils.kt
+++ b/wallet/src/main/java/net/taler/wallet/Utils.kt
@@ -33,7 +33,7 @@ import androidx.browser.customtabs.CustomTabsIntent
 import androidx.core.content.getSystemService
 import net.taler.common.Amount
 import net.taler.common.AmountParserException
-import net.taler.wallet.backend.TalerErrorCode
+import net.taler.wallet.backend.TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED
 import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.transactions.Transaction
 
@@ -105,7 +105,7 @@ fun getAmount(currency: String, text: String): Amount? {
 fun <T> Transaction.handleKyc(notRequired: () -> T, required: (TalerErrorInfo) 
-> T): T {
     return error?.let { error ->
         when (error.code) {
-            TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED -> required(error)
+            WALLET_WITHDRAWAL_KYC_REQUIRED -> required(error)
             else -> notRequired()
         }
     } ?: notRequired()
diff --git a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt 
b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt
index 1bfc9d8..9fc5cac 100644
--- a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt
+++ b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt
@@ -30,6 +30,7 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.withContext
 import kotlinx.serialization.KSerializer
 import kotlinx.serialization.json.Json
+import net.taler.wallet.backend.TalerErrorCode.NONE
 import net.taler.wallet.backend.WalletBackendService.Companion.MSG_COMMAND
 import net.taler.wallet.backend.WalletBackendService.Companion.MSG_NOTIFY
 import net.taler.wallet.backend.WalletBackendService.Companion.MSG_REPLY
@@ -164,7 +165,7 @@ class WalletBackendApi(
                         WalletResponse.Success(t)
                     }
                 } catch (e: Exception) {
-                    val info = TalerErrorInfo(TalerErrorCode.NONE, "", 
e.toString(), null)
+                    val info = TalerErrorInfo(NONE, "", e.toString(), null)
                     WalletResponse.Error(info)
                 }
                 cont.resume(response)
diff --git a/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt 
b/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
index 501fa3c..70f36a2 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
@@ -48,7 +48,7 @@ import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.dp
 import net.taler.common.Amount
 import net.taler.wallet.R
-import net.taler.wallet.backend.TalerErrorCode
+import net.taler.wallet.backend.TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED
 import net.taler.wallet.backend.TalerErrorInfo
 
 data class IncomingData(
@@ -237,7 +237,7 @@ fun PeerPullAcceptingPreview() {
 fun PeerPullPayErrorPreview() {
     Surface {
         @SuppressLint("UnrememberedMutableState")
-        val s = 
mutableStateOf(IncomingError(TalerErrorInfo(TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED,
 "hint", "msg")))
+        val s = 
mutableStateOf(IncomingError(TalerErrorInfo(WALLET_WITHDRAWAL_KYC_REQUIRED, 
"hint", "msg")))
         IncomingComposable(s, incomingPush) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullResultComposable.kt 
b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullResultComposable.kt
index 32364a6..84d9415 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullResultComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullResultComposable.kt
@@ -38,7 +38,7 @@ import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.dp
 import net.taler.common.QrCodeManager
 import net.taler.wallet.R
-import net.taler.wallet.backend.TalerErrorCode
+import net.taler.wallet.backend.TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED
 import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.compose.QrCodeUriComposable
 import net.taler.wallet.compose.TalerSurface
@@ -143,7 +143,7 @@ fun PeerPullResponseLandscapePreview() {
 fun PeerPullErrorPreview() {
     Surface {
         val json = JSONObject().apply { put("foo", "bar") }
-        val response = 
OutgoingError(TalerErrorInfo(TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED, 
"hint", "message", json))
+        val response = 
OutgoingError(TalerErrorInfo(WALLET_WITHDRAWAL_KYC_REQUIRED, "hint", "message", 
json))
         OutgoingPullResultComposable(response) {}
     }
 }
diff --git 
a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushResultComposable.kt 
b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushResultComposable.kt
index 42f0e3e..27b04c8 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushResultComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushResultComposable.kt
@@ -38,7 +38,7 @@ import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.dp
 import net.taler.common.QrCodeManager
 import net.taler.wallet.R
-import net.taler.wallet.backend.TalerErrorCode
+import net.taler.wallet.backend.TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED
 import net.taler.wallet.backend.TalerErrorInfo
 import net.taler.wallet.compose.QrCodeUriComposable
 import net.taler.wallet.compose.TalerSurface
@@ -143,7 +143,7 @@ fun PeerPushResponseLandscapePreview() {
 fun PeerPushErrorPreview() {
     Surface {
         val json = JSONObject().apply { put("foo", "bar") }
-        val response = 
OutgoingError(TalerErrorInfo(TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED, 
"hint", "message", json))
+        val response = 
OutgoingError(TalerErrorInfo(WALLET_WITHDRAWAL_KYC_REQUIRED, "hint", "message", 
json))
         OutgoingPushResultComposable(response) {}
     }
 }

-- 
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]