aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2021-08-27 16:43:46 +0200
committerTorsten Grote <t@grobox.de>2021-08-27 16:43:46 +0200
commitb663081104dc38df462c30d7dfc90e435ef3cf6c (patch)
treefce942ffc2eedfdb2a32ef4aa4f838c9b65e25c6
parent06f16a7477b337f07526285b65a7f3003b814d33 (diff)
downloadtaler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.tar.gz
taler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.tar.bz2
taler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.zip
Update libraries and do associated maintenance
-rw-r--r--.idea/compiler.xml10
-rw-r--r--.idea/gradle.xml3
-rw-r--r--build.gradle19
-rw-r--r--cashier/build.gradle11
-rw-r--r--cashier/src/main/java/net/taler/cashier/Response.kt4
-rw-r--r--cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt2
-rw-r--r--cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt4
-rw-r--r--cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt12
-rw-r--r--gradle.properties1
-rw-r--r--gradle/wrapper/gradle-wrapper.properties6
-rw-r--r--merchant-lib/build.gradle9
-rw-r--r--merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt10
-rw-r--r--merchant-lib/src/main/java/net/taler/merchantlib/Response.kt2
-rw-r--r--merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt14
-rw-r--r--merchant-terminal/build.gradle4
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt6
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt2
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt2
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt6
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt2
-rw-r--r--merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt4
-rw-r--r--merchant-terminal/src/main/res/layout/list_item_history.xml4
-rw-r--r--taler-kotlin-android/build.gradle6
-rw-r--r--wallet/.gitignore2
-rw-r--r--wallet/build.gradle8
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainActivity.kt6
-rw-r--r--wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFeesFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt3
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt2
-rw-r--r--wallet/src/main/res/layout/fragment_prompt_withdraw.xml2
31 files changed, 91 insertions, 81 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index fdae4ca..0bb9609 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -11,15 +11,15 @@
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
- <bytecodeTargetLevel target="1.8">
+ <bytecodeTargetLevel target="11">
<module name="common_commonMain" target="1.6" />
<module name="common_commonTest" target="1.6" />
<module name="common_jvmMain" target="1.6" />
<module name="common_jvmTest" target="1.6" />
- <module name="taler-android.multiplatform.common.commonMain" target="1.6" />
- <module name="taler-android.multiplatform.common.commonTest" target="1.6" />
- <module name="taler-android.multiplatform.common.jvmMain" target="1.6" />
- <module name="taler-android.multiplatform.common.jvmTest" target="1.6" />
+ <module name="taler-android.multiplatform.common.commonMain" target="1.8" />
+ <module name="taler-android.multiplatform.common.commonTest" target="1.8" />
+ <module name="taler-android.multiplatform.common.jvmMain" target="1.8" />
+ <module name="taler-android.multiplatform.common.jvmTest" target="1.8" />
<module name="taler-kotlin-common_jvmMain" target="1.6" />
<module name="taler-kotlin-common_jvmTest" target="1.6" />
</bytecodeTargetLevel>
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 20236d7..f7de5ff 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -4,7 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
- <option name="testRunner" value="PLATFORM" />
+ <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
@@ -21,7 +21,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
- <option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
diff --git a/build.gradle b/build.gradle
index 76ae6c8..87765ad 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,21 +1,21 @@
buildscript {
- ext.kotlin_version = '1.4.21'
- ext.ktor_version = "1.4.0"
- ext.nav_version = "2.3.3"
- ext.material_version = "1.2.1"
- ext.lifecycle_version = "2.2.0"
- ext.constraintlayout_version = "2.0.4"
- ext.junit_version = "4.13.1"
+ ext.kotlin_version = '1.5.30'
+ ext.ktor_version = "1.6.3"
+ ext.nav_version = "2.3.5"
+ ext.material_version = "1.4.0"
+ ext.lifecycle_version = "2.3.1"
+ ext.constraintlayout_version = "2.1.0"
+ ext.junit_version = "4.13.2"
// check https://android-rebuilds.beuc.net/ for availability of free build tools
ext.build_tools_version = "30.0.3"
// should debug build types be minified with D8 as well?
ext.minify_debug = false
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.2'
+ classpath 'com.android.tools.build:gradle:7.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
@@ -26,6 +26,7 @@ allprojects {
repositories {
google()
jcenter()
+ mavenCentral()
maven { url 'https://jitpack.io' }
}
}
diff --git a/cashier/build.gradle b/cashier/build.gradle
index 5d2bc10..54b2df7 100644
--- a/cashier/build.gradle
+++ b/cashier/build.gradle
@@ -46,6 +46,11 @@ android {
}
}
+ compileOptions {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
+
kotlinOptions {
jvmTarget = "1.8"
}
@@ -70,7 +75,7 @@ android {
dependencies {
implementation project(":taler-kotlin-android")
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
- implementation 'androidx.security:security-crypto:1.0.0-rc04' // requires minSdk 23
+ implementation 'androidx.security:security-crypto:1.0.0' // requires minSdk 23
implementation "com.google.android.material:material:$material_version"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
@@ -82,6 +87,6 @@ dependencies {
testImplementation "junit:junit:$junit_version"
- androidTestImplementation 'androidx.test.ext:junit:1.1.2'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.3'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
diff --git a/cashier/src/main/java/net/taler/cashier/Response.kt b/cashier/src/main/java/net/taler/cashier/Response.kt
index c5b1c32..6a72604 100644
--- a/cashier/src/main/java/net/taler/cashier/Response.kt
+++ b/cashier/src/main/java/net/taler/cashier/Response.kt
@@ -39,12 +39,12 @@ class Response<out T> private constructor(
}
private suspend fun getFailure(e: Throwable): Failure = when (e) {
- is ResponseException -> Failure(e, getExceptionString(e), e.response?.status)
+ is ResponseException -> Failure(e, getExceptionString(e), e.response.status)
else -> Failure(e, e.toString())
}
private suspend fun getExceptionString(e: ResponseException): String {
- val response = e.response ?: return e.toString()
+ val response = e.response
return try {
Log.e("TEST", "TRY RECEIVE $response")
val error: Error = response.receive()
diff --git a/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt b/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt
index 6498590..e6ac249 100644
--- a/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt
+++ b/cashier/src/main/java/net/taler/cashier/config/ConfigFragment.kt
@@ -130,7 +130,7 @@ class ConfigFragment : Fragment() {
return true
}
- private val onConfigResult = Observer<ConfigResult> { result ->
+ private val onConfigResult = Observer<ConfigResult?> { result ->
if (result == null) return@Observer
when (result) {
is ConfigResult.Success -> {
diff --git a/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt b/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
index e9f4117..0718963 100644
--- a/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
+++ b/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
@@ -75,8 +75,8 @@ class ConfigManager(
)
internal val currency: LiveData<String> = mCurrency
- private val mConfigResult = MutableLiveData<ConfigResult>()
- val configResult: LiveData<ConfigResult> = mConfigResult
+ private val mConfigResult = MutableLiveData<ConfigResult?>()
+ val configResult: LiveData<ConfigResult?> = mConfigResult
fun hasConfig() = config.bankUrl.isNotEmpty()
&& config.username.isNotEmpty()
diff --git a/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt b/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
index 30ff3d8..5d34bba 100644
--- a/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
+++ b/cashier/src/main/java/net/taler/cashier/withdraw/WithdrawManager.kt
@@ -61,14 +61,14 @@ class WithdrawManager(
private var withdrawStatusCheck: Job? = null
- private val mWithdrawAmount = MutableLiveData<Amount>()
- val withdrawAmount: LiveData<Amount> = mWithdrawAmount
+ private val mWithdrawAmount = MutableLiveData<Amount?>()
+ val withdrawAmount: LiveData<Amount?> = mWithdrawAmount
- private val mWithdrawResult = MutableLiveData<WithdrawResult>()
- val withdrawResult: LiveData<WithdrawResult> = mWithdrawResult
+ private val mWithdrawResult = MutableLiveData<WithdrawResult?>()
+ val withdrawResult: LiveData<WithdrawResult?> = mWithdrawResult
- private val mWithdrawStatus = MutableLiveData<WithdrawStatus>()
- val withdrawStatus: LiveData<WithdrawStatus> = mWithdrawStatus
+ private val mWithdrawStatus = MutableLiveData<WithdrawStatus?>()
+ val withdrawStatus: LiveData<WithdrawStatus?> = mWithdrawStatus
private val mLastTransaction = MutableLiveData<LastTransaction>()
val lastTransaction: LiveData<LastTransaction> = mLastTransaction
diff --git a/gradle.properties b/gradle.properties
index 337c38f..8a57460 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -20,3 +20,4 @@ android.useAndroidX=true
android.enableJetifier=false
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
+kotlin.mpp.stability.nowarn=true
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 803791e..7a0ef64 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Feb 04 11:18:01 BRT 2021
+#Fri Aug 27 15:56:47 CEST 2021
distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
+zipStoreBase=GRADLE_USER_HOME
diff --git a/merchant-lib/build.gradle b/merchant-lib/build.gradle
index a173cce..f53baa2 100644
--- a/merchant-lib/build.gradle
+++ b/merchant-lib/build.gradle
@@ -45,6 +45,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
+
+ compileOptions {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
}
dependencies {
@@ -54,8 +59,8 @@ dependencies {
api "io.ktor:ktor-client-okhttp:$ktor_version"
api "io.ktor:ktor-client-serialization-jvm:$ktor_version"
- testImplementation 'junit:junit:4.13.1'
+ testImplementation "junit:junit:$junit_version"
testImplementation "io.ktor:ktor-client-mock-jvm:$ktor_version"
testImplementation "io.ktor:ktor-client-logging-jvm:$ktor_version"
- testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9'
+ testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1'
}
diff --git a/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt b/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
index a467c41..0d22f91 100644
--- a/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
+++ b/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
@@ -35,7 +35,7 @@ import net.taler.merchantlib.Response.Companion.response
class MerchantApi(
private val httpClient: HttpClient = getDefaultHttpClient(),
- private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
+ private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO,
) {
suspend fun getConfig(baseUrl: String): Response<ConfigResponse> = withContext(ioDispatcher) {
@@ -46,7 +46,7 @@ class MerchantApi(
suspend fun postOrder(
merchantConfig: MerchantConfig,
- orderRequest: PostOrderRequest
+ orderRequest: PostOrderRequest,
): Response<PostOrderResponse> = withContext(ioDispatcher) {
response {
httpClient.post(merchantConfig.urlFor("private/orders")) {
@@ -59,7 +59,7 @@ class MerchantApi(
suspend fun checkOrder(
merchantConfig: MerchantConfig,
- orderId: String
+ orderId: String,
): Response<CheckPaymentResponse> = withContext(ioDispatcher) {
response {
httpClient.get(merchantConfig.urlFor("private/orders/$orderId")) {
@@ -70,7 +70,7 @@ class MerchantApi(
suspend fun deleteOrder(
merchantConfig: MerchantConfig,
- orderId: String
+ orderId: String,
): Response<Unit> = withContext(ioDispatcher) {
response {
httpClient.delete(merchantConfig.urlFor("private/orders/$orderId")) {
@@ -91,7 +91,7 @@ class MerchantApi(
suspend fun giveRefund(
merchantConfig: MerchantConfig,
orderId: String,
- request: RefundRequest
+ request: RefundRequest,
): Response<RefundResponse> = withContext(ioDispatcher) {
response {
httpClient.post(merchantConfig.urlFor("private/orders/$orderId/refund")) {
diff --git a/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt b/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt
index 1b63900..6fd0e37 100644
--- a/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt
+++ b/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt
@@ -70,7 +70,7 @@ class Response<out T> private constructor(
}
private suspend fun getExceptionString(e: ResponseException): String {
- val response = e.response ?: return e.toString()
+ val response = e.response
return try {
val error: Error = response.receive()
"Error ${error.code}: ${error.hint}"
diff --git a/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt b/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
index 63188f9..6abacfd 100644
--- a/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
+++ b/merchant-lib/src/test/java/net/taler/merchantlib/MerchantApiTest.kt
@@ -18,8 +18,8 @@ package net.taler.merchantlib
import io.ktor.http.HttpStatusCode.Companion.NotFound
import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.TestCoroutineDispatcher
-import kotlinx.coroutines.test.runBlockingTest
import net.taler.common.ContractProduct
import net.taler.common.ContractTerms
import net.taler.lib.common.Amount
@@ -41,7 +41,7 @@ class MerchantApiTest {
private val orderId = "orderIdFoo"
@Test
- fun testGetConfig() = runBlockingTest {
+ fun testGetConfig() = runBlocking {
httpClient.giveJsonResponse("https://backend.int.taler.net/config") {
"""
{
@@ -56,7 +56,7 @@ class MerchantApiTest {
}
@Test
- fun testPostOrder() = runBlockingTest {
+ fun testPostOrder() = runBlocking {
val product = ContractProduct(
productId = "foo",
description = "bar",
@@ -113,7 +113,7 @@ class MerchantApiTest {
}
@Test
- fun testCheckOrder() = runBlockingTest {
+ fun testCheckOrder() = runBlocking {
val unpaidResponse = CheckPaymentResponse.Unpaid(false, "http://taler.net/foo")
httpClient.giveJsonResponse("http://example.net/instances/testInstance/private/orders/$orderId") {
"""{
@@ -142,7 +142,7 @@ class MerchantApiTest {
}
@Test
- fun testDeleteOrder() = runBlockingTest {
+ fun testDeleteOrder() = runBlocking {
httpClient.giveJsonResponse("http://example.net/instances/testInstance/private/orders/$orderId") {
"{}"
}
@@ -165,7 +165,7 @@ class MerchantApiTest {
}
@Test
- fun testGetOrderHistory() = runBlockingTest {
+ fun testGetOrderHistory() = runBlocking {
httpClient.giveJsonResponse("http://example.net/instances/testInstance/private/orders") {
"""{ "orders": [
{
@@ -215,7 +215,7 @@ class MerchantApiTest {
}
@Test
- fun testGiveRefund() = runBlockingTest {
+ fun testGiveRefund() = runBlocking {
httpClient.giveJsonResponse("http://example.net/instances/testInstance/private/orders/$orderId/refund") {
"""{
"taler_refund_uri": "taler://refund/foo/bar"
diff --git a/merchant-terminal/build.gradle b/merchant-terminal/build.gradle
index 0458f36..e7a3bcc 100644
--- a/merchant-terminal/build.gradle
+++ b/merchant-terminal/build.gradle
@@ -68,7 +68,7 @@ dependencies {
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:1.2.1"
implementation "androidx.recyclerview:recyclerview-selection:1.1.0"
// Navigation
@@ -77,6 +77,6 @@ dependencies {
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
- testImplementation 'androidx.test.ext:junit:1.1.2'
+ testImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'org.robolectric:robolectric:4.4'
}
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt
index d7c446f..165bb8e 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigManager.kt
@@ -84,8 +84,8 @@ class ConfigManager(
var currency: String? = null
private set
- private val mConfigUpdateResult = MutableLiveData<ConfigUpdateResult>()
- val configUpdateResult: LiveData<ConfigUpdateResult> = mConfigUpdateResult
+ private val mConfigUpdateResult = MutableLiveData<ConfigUpdateResult?>()
+ val configUpdateResult: LiveData<ConfigUpdateResult?> = mConfigUpdateResult
fun addConfigurationReceiver(receiver: ConfigurationReceiver) {
configurationReceivers.add(receiver)
@@ -115,7 +115,7 @@ class ConfigManager(
Log.e(TAG, "Error retrieving merchant config", e)
val msg = if (e is ClientRequestException) {
context.getString(
- if (e.response?.status == Unauthorized) R.string.config_auth_error
+ if (e.response.status == Unauthorized) R.string.config_auth_error
else R.string.config_error_network
)
} else {
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt
index 738e32b..10aabd4 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt
@@ -54,7 +54,7 @@ internal class MutableLiveOrder(
MutableLiveData(Order(id, currency, availableCategories))
override val orderTotal: LiveData<Amount> = Transformations.map(order) { it.total }
override val restartState = MutableLiveData(DISABLED)
- private val selectedOrderLine = MutableLiveData<ConfigProduct>()
+ private val selectedOrderLine = MutableLiveData<ConfigProduct?>()
override val selectedProductKey: String?
get() = selectedOrderLine.value?.id
override val modifyOrderAllowed =
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt
index 2180ccb..dc98f88 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderAdapter.kt
@@ -100,7 +100,7 @@ internal class OrderAdapter : Adapter<OrderViewHolder>() {
list.findChildViewUnder(e.x, e.y)?.let { view ->
val holder = list.getChildViewHolder(view)
val adapter = list.adapter as OrderAdapter
- val position = holder.adapterPosition
+ val position = holder.bindingAdapterPosition
return object : ItemDetails<String>() {
override fun getPosition(): Int = position
override fun getSelectionKey(): String = adapter.keyProvider.getKey(position)
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt
index a89a85d..6c5ecdf 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/OrderManager.kt
@@ -120,7 +120,7 @@ class OrderManager(private val context: Context) : ConfigurationReceiver {
val currentOrder = order(currentId)
if (currentOrder.isEmpty()) orders.remove(currentId)
else currentOrder.lastAddedProduct = null // not needed anymore and it would get selected
- mCurrentOrderId.value = nextId
+ mCurrentOrderId.value = requireNotNull(nextId)
}
@UiThread
@@ -143,7 +143,7 @@ class OrderManager(private val context: Context) : ConfigurationReceiver {
// and would get selected when navigating back instead of last selection
if (currentOrder.isEmpty()) orders.remove(currentId)
else currentOrder.lastAddedProduct = null
- mCurrentOrderId.value = previousId
+ mCurrentOrderId.value = requireNotNull(previousId)
}
fun hasPreviousOrder(currentOrderId: Int): Boolean {
@@ -159,7 +159,7 @@ class OrderManager(private val context: Context) : ConfigurationReceiver {
forEach { if (it.selected) it.selected = false }
category.selected = true
}
- mCategories.postValue(newCategories)
+ mCategories.postValue(newCategories ?: emptyList())
mProducts.postValue(productsByCategory[category])
}
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt
index a3898fd..b2a245f 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/ProductsFragment.kt
@@ -100,7 +100,7 @@ private class ProductAdapter(
notifyDataSetChanged()
}
- private inner class ProductViewHolder(private val v: View) : ViewHolder(v) {
+ inner class ProductViewHolder(private val v: View) : ViewHolder(v) {
private val name: TextView = v.findViewById(R.id.name)
private val price: TextView = v.findViewById(R.id.price)
diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt
index de6cdde..8b3efca 100644
--- a/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt
+++ b/merchant-terminal/src/main/java/net/taler/merchantpos/refund/RefundManager.kt
@@ -49,8 +49,8 @@ class RefundManager(
var toBeRefunded: OrderHistoryEntry? = null
private set
- private val mRefundResult = MutableLiveData<RefundResult>()
- internal val refundResult: LiveData<RefundResult> = mRefundResult
+ private val mRefundResult = MutableLiveData<RefundResult?>()
+ internal val refundResult: LiveData<RefundResult?> = mRefundResult
@UiThread
internal fun startRefund(item: OrderHistoryEntry) {
diff --git a/merchant-terminal/src/main/res/layout/list_item_history.xml b/merchant-terminal/src/main/res/layout/list_item_history.xml
index 08f45b7..4d947cf 100644
--- a/merchant-terminal/src/main/res/layout/list_item_history.xml
+++ b/merchant-terminal/src/main/res/layout/list_item_history.xml
@@ -87,10 +87,10 @@
android:layout_height="48dp"
android:backgroundTint="?colorPrimary"
android:contentDescription="@string/history_refund"
- android:tint="?attr/colorOnPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:srcCompat="@drawable/ic_cash_refund" />
+ app:srcCompat="@drawable/ic_cash_refund"
+ app:tint="?attr/colorOnPrimary" />
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/taler-kotlin-android/build.gradle b/taler-kotlin-android/build.gradle
index 877b94e..7d3d8e4 100644
--- a/taler-kotlin-android/build.gradle
+++ b/taler-kotlin-android/build.gradle
@@ -59,8 +59,8 @@ android {
dependencies {
api project(":multiplatform:common")
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'androidx.core:core-ktx:1.3.2'
+ implementation 'androidx.appcompat:appcompat:1.3.1'
+ implementation 'androidx.core:core-ktx:1.6.0'
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
// Navigation
@@ -81,7 +81,7 @@ dependencies {
implementation 'com.github.pedrovgs:renderers:4.0.0'
// JSON parsing and serialization
- api "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC"
+ api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2"
lintPublish 'com.github.thirdegg:lint-rules:0.0.6-beta'
diff --git a/wallet/.gitignore b/wallet/.gitignore
index fa4dd35..44ca846 100644
--- a/wallet/.gitignore
+++ b/wallet/.gitignore
@@ -1,3 +1,3 @@
/build
/.bundle
-/src/main/assets/taler-wallet-android-*.js
+/src/main/assets/taler-wallet-*-*.js
diff --git a/wallet/build.gradle b/wallet/build.gradle
index 08bb009..2fce66e 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -120,7 +120,7 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
// Lists and Selection
- implementation "androidx.recyclerview:recyclerview:1.1.0"
+ implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.recyclerview:recyclerview-selection:1.1.0"
// Navigation Library
@@ -133,7 +133,7 @@ dependencies {
// QR codes
implementation 'com.journeyapps:zxing-android-embedded:4.0.2@aar'
// needed to support zxing library in taler-kotlin-android on API < 24
- coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1'
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
// Nicer ProgressBar
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
@@ -146,8 +146,8 @@ dependencies {
testImplementation "junit:junit:$junit_version"
testImplementation 'org.json:json:20200518'
- androidTestImplementation 'androidx.test:runner:1.3.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+ androidTestImplementation 'androidx.test:runner:1.4.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
def walletLibraryDir = "src/main/assets"
diff --git a/wallet/src/main/java/net/taler/wallet/MainActivity.kt b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
index 1dafce0..ca53de3 100644
--- a/wallet/src/main/java/net/taler/wallet/MainActivity.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
@@ -151,18 +151,18 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
connectToWifi(this, uri.fragment!!)
}
when {
- url.toLowerCase(ROOT).startsWith("taler://pay/") -> {
+ url.lowercase(ROOT).startsWith("taler://pay/") -> {
Log.v(TAG, "navigating!")
nav.navigate(R.id.action_nav_main_to_promptPayment)
model.paymentManager.preparePay(url)
}
- url.toLowerCase(ROOT).startsWith("taler://withdraw/") -> {
+ url.lowercase(ROOT).startsWith("taler://withdraw/") -> {
Log.v(TAG, "navigating!")
// there's more than one entry point, so use global action
nav.navigate(R.id.action_global_promptWithdraw)
model.withdrawManager.getWithdrawalDetails(url)
}
- url.toLowerCase(ROOT).startsWith("taler://refund/") -> {
+ url.lowercase(ROOT).startsWith("taler://refund/") -> {
model.showProgressBar.value = true
model.refundManager.refund(url).observe(this, Observer(::onRefundResponse))
}
diff --git a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFeesFragment.kt b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFeesFragment.kt
index c59fffe..1ea32dd 100644
--- a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFeesFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFeesFragment.kt
@@ -89,7 +89,7 @@ private class CoinFeeAdapter(private val items: List<CoinFee>) : Adapter<CoinFee
holder.bind(items[position])
}
- private class CoinFeeViewHolder(private val v: View) : ViewHolder(v) {
+ class CoinFeeViewHolder(private val v: View) : ViewHolder(v) {
private val res = v.context.resources
private val coinView: TextView = v.findViewById(R.id.coinView)
private val withdrawFeeView: TextView = v.findViewById(R.id.withdrawFeeView)
@@ -127,7 +127,7 @@ private class WireFeeAdapter(private val items: List<WireFee>) : Adapter<WireFee
holder.bind(items[position])
}
- private class WireFeeViewHolder(private val v: View) : ViewHolder(v) {
+ class WireFeeViewHolder(private val v: View) : ViewHolder(v) {
private val validityView: TextView = v.findViewById(R.id.validityView)
private val wireFeeView: TextView = v.findViewById(R.id.wireFeeView)
private val closingFeeView: TextView = v.findViewById(R.id.closingFeeView)
diff --git a/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt b/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
index 664dcc9..700e158 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
@@ -24,7 +24,6 @@ import android.view.View.GONE
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
-import androidx.lifecycle.observe
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.snackbar.Snackbar
@@ -51,7 +50,7 @@ class PromptPaymentFragment : Fragment(), ProductImageClickListener {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
- ): View? {
+ ): View {
ui = FragmentPromptPaymentBinding.inflate(inflater, container, false)
return ui.root
}
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
index 5e492f5..b8bf9af 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
@@ -154,7 +154,7 @@ internal class TransactionLookup(
override fun getItemDetails(e: MotionEvent): ItemDetails<String>? {
list.findChildViewUnder(e.x, e.y)?.let { view ->
val holder = list.getChildViewHolder(view)
- val position = holder.adapterPosition
+ val position = holder.bindingAdapterPosition
return object : ItemDetails<String>() {
override fun getPosition(): Int = position
override fun getSelectionKey(): String = adapter.keyProvider.getKey(position)
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 47c2c6b..3acb29f 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/ManualWithdrawFragment.kt
@@ -53,7 +53,7 @@ class ManualWithdrawFragment : Fragment() {
ui.qrCodeButton.setOnClickListener { scanQrCode(requireActivity()) }
ui.currencyView.text = exchangeItem.currency
val paymentOptions = exchangeItem.paytoUris.mapNotNull { paytoUri ->
- Uri.parse(paytoUri).authority?.toUpperCase(Locale.getDefault())
+ Uri.parse(paytoUri).authority?.uppercase(Locale.getDefault())
}.joinToString(separator = "\n", prefix = "• ")
ui.paymentOptionsLabel.text =
getString(R.string.withdraw_manual_payment_options, exchangeItem.name, paymentOptions)
diff --git a/wallet/src/main/res/layout/fragment_prompt_withdraw.xml b/wallet/src/main/res/layout/fragment_prompt_withdraw.xml
index 421911a..372163b 100644
--- a/wallet/src/main/res/layout/fragment_prompt_withdraw.xml
+++ b/wallet/src/main/res/layout/fragment_prompt_withdraw.xml
@@ -168,12 +168,12 @@
android:backgroundTint="@color/colorPrimary"
android:contentDescription="@string/nav_exchange_fees"
android:src="@drawable/ic_edit"
- android:tint="?attr/colorOnPrimary"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/withdrawExchangeUrl"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/withdrawExchangeUrl"
app:layout_constraintTop_toTopOf="@+id/withdrawExchangeUrl"
+ app:tint="?attr/colorOnPrimary"
tools:visibility="visible" />
<ProgressBar