summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-09-01 09:54:21 -0300
committerTorsten Grote <t@grobox.de>2020-09-01 09:54:21 -0300
commitc59243c9bdabf07137ad0f070b6ecbde57e66466 (patch)
tree1599b6f112f6a96dc274bda816edf85eabf8facf
parenta0b0ee2b13b72d1ec6a489150c717c8bfa863158 (diff)
downloadtaler-android-c59243c9bdabf07137ad0f070b6ecbde57e66466.tar.gz
taler-android-c59243c9bdabf07137ad0f070b6ecbde57e66466.tar.bz2
taler-android-c59243c9bdabf07137ad0f070b6ecbde57e66466.zip
[wallet] don't crash on serialization errors from wallet-core
This should not be necessary if we had a stable API with documentated and versioned changes, but well...
-rw-r--r--.idea/runConfigurations/taler_android__check_.xml21
-rw-r--r--anastasis-ui/src/main/res/layout/fragment_intro.xml4
-rw-r--r--build.gradle2
-rw-r--r--cashier/build.gradle8
-rw-r--r--merchant-terminal/build.gradle6
-rw-r--r--wallet/build.gradle8
-rw-r--r--wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt15
-rw-r--r--wallet/src/test/java/net/taler/wallet/payment/PaymentResponsesTest.kt1
8 files changed, 47 insertions, 18 deletions
diff --git a/.idea/runConfigurations/taler_android__check_.xml b/.idea/runConfigurations/taler_android__check_.xml
new file mode 100644
index 0000000..5d12227
--- /dev/null
+++ b/.idea/runConfigurations/taler_android__check_.xml
@@ -0,0 +1,21 @@
+<component name="ProjectRunConfigurationManager">
+ <configuration default="false" name="taler-android [check]" type="GradleRunConfiguration" factoryName="Gradle">
+ <ExternalSystemSettings>
+ <option name="executionName" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="externalSystemIdString" value="GRADLE" />
+ <option name="scriptParameters" value="" />
+ <option name="taskDescriptions">
+ <list />
+ </option>
+ <option name="taskNames">
+ <list>
+ <option value="check" />
+ </list>
+ </option>
+ <option name="vmOptions" value="" />
+ </ExternalSystemSettings>
+ <GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
+ <method v="2" />
+ </configuration>
+</component> \ No newline at end of file
diff --git a/anastasis-ui/src/main/res/layout/fragment_intro.xml b/anastasis-ui/src/main/res/layout/fragment_intro.xml
index 262287b..32b5b33 100644
--- a/anastasis-ui/src/main/res/layout/fragment_intro.xml
+++ b/anastasis-ui/src/main/res/layout/fragment_intro.xml
@@ -24,7 +24,6 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="16dp"
- android:tint="@color/green"
app:layout_constraintBottom_toTopOf="@+id/textView"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
@@ -33,7 +32,8 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:layout_constraintVertical_chainStyle="spread"
- app:srcCompat="@drawable/ic_baseline_cloud_circle" />
+ app:srcCompat="@drawable/ic_baseline_cloud_circle"
+ app:tint="@color/green" />
<TextView
android:id="@+id/textView"
diff --git a/build.gradle b/build.gradle
index 7c9e378..2bd92ab 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,9 @@ buildscript {
ext.kotlin_version = '1.4.0'
ext.ktor_version = "1.4.0"
ext.nav_version = "2.3.0"
+ ext.material_version = "1.2.0"
ext.lifecycle_version = "2.2.0"
+ ext.constraintlayout_version = "2.0.1"
// check https://android-rebuilds.beuc.net/ for availability of free build tools
ext.build_tools_version = "29.0.2"
repositories {
diff --git a/cashier/build.gradle b/cashier/build.gradle
index 4defd7a..604a508 100644
--- a/cashier/build.gradle
+++ b/cashier/build.gradle
@@ -62,9 +62,9 @@ android {
dependencies {
implementation project(":taler-kotlin-android")
- implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
+ implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
implementation 'androidx.security:security-crypto:1.0.0-rc03'
- implementation 'com.google.android.material:material:1.2.0'
+ implementation "com.google.android.material:material:$material_version"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
@@ -75,6 +75,6 @@ dependencies {
testImplementation 'junit:junit:4.13'
- androidTestImplementation 'androidx.test.ext:junit:1.1.1'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
diff --git a/merchant-terminal/build.gradle b/merchant-terminal/build.gradle
index 1bdc138..8c94fa1 100644
--- a/merchant-terminal/build.gradle
+++ b/merchant-terminal/build.gradle
@@ -59,8 +59,8 @@ android {
dependencies {
implementation project(":merchant-lib")
- implementation 'com.google.android.material:material:1.1.0'
- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation "com.google.android.material:material:$material_version"
+ implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01"
@@ -70,6 +70,6 @@ dependencies {
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
- testImplementation 'androidx.test.ext:junit:1.1.1'
+ testImplementation 'androidx.test.ext:junit:1.1.2'
testImplementation 'org.robolectric:robolectric:4.3.1'
}
diff --git a/wallet/build.gradle b/wallet/build.gradle
index 70b9648..5d02bca 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -105,8 +105,8 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.preference:preference:1.1.1'
- implementation 'com.google.android.material:material:1.2.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
+ implementation "com.google.android.material:material:$material_version"
+ implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
// Lists and Selection
implementation "androidx.recyclerview:recyclerview:1.1.0"
@@ -133,8 +133,8 @@ dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'org.json:json:20200518'
- androidTestImplementation 'androidx.test:runner:1.2.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+ androidTestImplementation 'androidx.test:runner:1.3.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
def walletLibraryDir = "src/main/assets"
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 c6261bf..a72df9c 100644
--- a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt
+++ b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendApi.kt
@@ -158,12 +158,19 @@ class WalletBackendApi(
}
sendRequest(operation, args?.invoke(JSONObject())) { isError, message ->
val response = if (isError) {
- val error = json.decodeFromString(WalletErrorInfo.serializer(), message.toString())
+ val error =
+ json.decodeFromString(WalletErrorInfo.serializer(), message.toString())
WalletResponse.Error(error)
} else {
- @Suppress("UNCHECKED_CAST") // if serializer is null, T must be Unit
- val t: T = serializer?.let { json.decodeFromString(serializer, message.toString()) } ?: Unit as T
- WalletResponse.Success(t)
+ try {
+ val t: T = serializer?.let {
+ json.decodeFromString(serializer, message.toString())
+ } ?: Unit as T
+ WalletResponse.Success(t)
+ } catch (e: Exception) {
+ val info = WalletErrorInfo(0, "", e.toString(), null)
+ WalletResponse.Error(info)
+ }
}
cont.resume(response)
}
diff --git a/wallet/src/test/java/net/taler/wallet/payment/PaymentResponsesTest.kt b/wallet/src/test/java/net/taler/wallet/payment/PaymentResponsesTest.kt
index 15702c6..fbdc07d 100644
--- a/wallet/src/test/java/net/taler/wallet/payment/PaymentResponsesTest.kt
+++ b/wallet/src/test/java/net/taler/wallet/payment/PaymentResponsesTest.kt
@@ -57,7 +57,6 @@ class PaymentResponsesTest {
"max_wire_fee": "CHF:0.1",
"max_fee": "CHF:0.1",
"wire_fee_amortization": 10,
- "merchant_base_url": "https:\/\/backend.chf.taler.net\/instances\/department\/",
"merchant": {
"name": "BFH Department Technik und Informatik",
"instance": "department"