diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-01-18 11:14:12 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2023-01-18 11:14:12 -0600 |
commit | 890452c60bcef81480d807a8a9effe67fd6aab0c (patch) | |
tree | 5c8e69763b69e99bb71246c24d899b06547800e4 /wallet/src | |
parent | 18f1ebe0401e61d7dfab2e759708c74b76d3f672 (diff) | |
download | taler-android-890452c60bcef81480d807a8a9effe67fd6aab0c.tar.gz taler-android-890452c60bcef81480d807a8a9effe67fd6aab0c.tar.bz2 taler-android-890452c60bcef81480d807a8a9effe67fd6aab0c.zip |
[wallet] Statically import TalerErrorCode fields.
Diffstat (limited to 'wallet/src')
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) {} } } |