aboutsummaryrefslogtreecommitdiff
path: root/wallet
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-09-03 09:23:11 -0300
committerTorsten Grote <t@grobox.de>2020-09-03 09:23:11 -0300
commitd56c5eaa5ea01225259486dab48b3c24e341b74c (patch)
tree71f84744ef0b42b863e92127b4de955006dddb4f /wallet
parent36821f996fddc80681b0fef9f057b0065c738418 (diff)
downloadtaler-android-d56c5eaa5ea01225259486dab48b3c24e341b74c.tar.gz
taler-android-d56c5eaa5ea01225259486dab48b3c24e341b74c.tar.bz2
taler-android-d56c5eaa5ea01225259486dab48b3c24e341b74c.zip
Don't crash on empty manual withdrawal amount
Diffstat (limited to 'wallet')
-rw-r--r--wallet/build.gradle4
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt19
-rw-r--r--wallet/src/main/res/values/strings.xml1
4 files changed, 16 insertions, 10 deletions
diff --git a/wallet/build.gradle b/wallet/build.gradle
index 30cf291..434ebb9 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download"
}
-def walletCoreVersion = "v0.7.1-dev.23"
+def walletCoreVersion = "v0.7.1-dev.25"
static def versionCodeEpoch() {
return (new Date().getTime() / 1000).toInteger()
@@ -48,7 +48,7 @@ android {
minSdkVersion 24
targetSdkVersion 29
versionCode 6
- versionName "0.7.1.dev.23"
+ versionName "0.7.1.dev.25"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "WALLET_CORE_VERSION", "\"$walletCoreVersion\""
}
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
index db3f283..0817c36 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt
@@ -190,9 +190,7 @@ class TransactionRefund(
*/
val amountInvalid: Amount? = null,
override val error: TalerErrorInfo? = null,
- @SerialName("amountEffective") // TODO remove when fixed in wallet-core
override val amountRaw: Amount,
- @SerialName("amountRaw") // TODO remove when fixed in wallet-core
override val amountEffective: Amount
) : Transaction() {
override val icon = R.drawable.transaction_refund
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
index fbee6ae..af76e9b 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
@@ -55,13 +55,20 @@ class ManualWithdrawFragment : Fragment() {
}.joinToString(separator = "\n", prefix = "• ")
paymentOptionsLabel.text =
getString(R.string.withdraw_manual_payment_options, exchangeItem.name, paymentOptions)
- checkFeesButton.setOnClickListener {
- val value = amountView.text.toString().toLong()
- val amount = Amount(exchangeItem.currency, value, 0)
- amountView.hideKeyboard()
- Toast.makeText(view.context, "Not implemented: $amount", LENGTH_SHORT).show()
- withdrawManager.getWithdrawalDetails(exchangeItem.exchangeBaseUrl, amount)
+ checkFeesButton.setOnClickListener { onCheckFees() }
+ }
+
+ private fun onCheckFees() {
+ if (amountView.text?.isEmpty() ?: true) {
+ amountLayout.setError(getString(R.string.withdraw_amount_error))
+ return
}
+ amountLayout.setError(null)
+ val value = amountView.text.toString().toLong()
+ val amount = Amount(exchangeItem.currency, value, 0)
+ amountView.hideKeyboard()
+ Toast.makeText(requireContext(), "Not implemented: $amount", LENGTH_SHORT).show()
+ withdrawManager.getWithdrawalDetails(exchangeItem.exchangeBaseUrl, amount)
}
}
diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml
index a9f6c73..a780ad3 100644
--- a/wallet/src/main/res/values/strings.xml
+++ b/wallet/src/main/res/values/strings.xml
@@ -113,6 +113,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card
<string name="withdraw_waiting_confirm">Waiting for confirmation</string>
<string name="withdraw_manual_title">Make a manual transfer to the exchange</string>
<string name="withdraw_amount">How much to withdraw?</string>
+ <string name="withdraw_amount_error">Enter valid amount</string>
<string name="withdraw_manual_payment_options">Payment options supported by %1$s:\n\n%2$s</string>
<string name="withdraw_manual_check_fees">Check fees</string>
<string name="withdraw_error_title">Withdrawal Error</string>