summaryrefslogtreecommitdiff
path: root/wallet
diff options
context:
space:
mode:
Diffstat (limited to 'wallet')
-rw-r--r--wallet/.gitignore2
-rw-r--r--wallet/.gitlab-ci.yml4
-rw-r--r--wallet/build.gradle24
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainActivity.kt16
-rw-r--r--wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt17
-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
10 files changed, 43 insertions, 33 deletions
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/.gitlab-ci.yml b/wallet/.gitlab-ci.yml
index 67de977..403d13e 100644
--- a/wallet/.gitlab-ci.yml
+++ b/wallet/.gitlab-ci.yml
@@ -28,8 +28,8 @@ wallet_deploy_nightly:
- ./gradlew :wallet:assembleNightlyRelease
# Rename APK, so fdroid nightly accepts it (looks for *-debug.apk)
- mv wallet/build/outputs/apk/nightly/release/*.apk wallet-debug.apk
- # START only needed while patch not accepted/released upstream
- - apt update && apt install patch
+ # START only needed while fdroidserver and patch not accepted/released upstream
+ - apt update && apt-get -qy install --no-install-recommends fdroidserver openssh-client patch
- patch -b /usr/lib/python3/dist-packages/fdroidserver/nightly.py nightly-stats.patch
# END
- fdroid --version
diff --git a/wallet/build.gradle b/wallet/build.gradle
index 55fda26..9a5f8ef 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -23,8 +23,8 @@ plugins {
id "de.undercouch.download"
}
-def walletCoreVersion = "v0.8.0"
-def walletCoreSha256 = "46b0ec59e95f2621c8483f975dac9e288851c1e5809f386b49c491e52f41a190"
+def walletCoreVersion = "v0.8.2"
+def walletCoreSha256 = "185ee051101968fb8e01e8dcc70b2017bbb99c92bc31c97330b2be16baf043e9"
static def versionCodeEpoch() {
return (new Date().getTime() / 1000).toInteger()
@@ -47,8 +47,8 @@ android {
applicationId "net.taler.wallet"
minSdkVersion 21
targetSdkVersion 30
- versionCode 9
- versionName "v0.8.0"
+ versionCode 10
+ versionName "v0.8.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "WALLET_CORE_VERSION", "\"$walletCoreVersion\""
}
@@ -111,7 +111,7 @@ android {
dependencies {
implementation project(":taler-kotlin-android")
implementation project(":anastasis-ui")
- implementation 'net.taler:akono:0.1'
+ implementation 'net.taler:akono:0.2'
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
@@ -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,14 +146,14 @@ 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"
-def walletDestFile = "${walletLibraryDir}/taler-wallet-android-${walletCoreVersion}.js"
+def walletDestFile = "${walletLibraryDir}/taler-wallet-embedded-${walletCoreVersion}.js"
task downloadWalletLibrary(type: Download, dependsOn: preBuild) {
- src "https://git.taler.net/wallet-core.git/plain/${walletCoreVersion}/taler-wallet-android.js?h=prebuilt"
+ src "https://git.taler.net/wallet-core.git/plain/${walletCoreVersion}/taler-wallet-embedded.js?h=prebuilt"
dest walletDestFile
onlyIfModified true
overwrite false
@@ -161,7 +161,7 @@ task downloadWalletLibrary(type: Download, dependsOn: preBuild) {
new File(walletLibraryDir).mkdirs()
if (!file(dest).exists()) { // delete old versions before fetching new one
delete fileTree(walletLibraryDir) {
- include 'taler-wallet-android-*.js'
+ include 'taler-wallet-embedded-*.js'
}
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/MainActivity.kt b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
index 1dafce0..3b8be4f 100644
--- a/wallet/src/main/java/net/taler/wallet/MainActivity.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
@@ -150,19 +150,29 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
if (uri.fragment != null && !isOnline()) {
connectToWifi(this, uri.fragment!!)
}
+ val normalizedURL = url.lowercase(ROOT)
+ val action = normalizedURL.substring(
+ if (normalizedURL.startsWith("taler://")) {
+ "taler://".length
+ } else if (normalizedURL.startsWith("taler+http://") && model.devMode.value == true) {
+ "taler+http://".length
+ } else {
+ normalizedURL.length
+ }
+ )
when {
- url.toLowerCase(ROOT).startsWith("taler://pay/") -> {
+ action.startsWith("pay/") -> {
Log.v(TAG, "navigating!")
nav.navigate(R.id.action_nav_main_to_promptPayment)
model.paymentManager.preparePay(url)
}
- url.toLowerCase(ROOT).startsWith("taler://withdraw/") -> {
+ action.startsWith("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/") -> {
+ action.startsWith("refund/") -> {
model.showProgressBar.value = true
model.refundManager.refund(url).observe(this, Observer(::onRefundResponse))
}
diff --git a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
index ccb995a..f99f38d 100644
--- a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
+++ b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
@@ -17,7 +17,6 @@
package net.taler.wallet.backend
-import akono.AkonoJni
import android.app.Service
import android.content.Intent
import android.os.Handler
@@ -26,6 +25,7 @@ import android.os.Message
import android.os.Messenger
import android.os.RemoteException
import android.util.Log
+import net.taler.akono.AkonoJni
import net.taler.wallet.BuildConfig.WALLET_CORE_VERSION
import net.taler.wallet.HostCardEmulatorService
import org.json.JSONObject
@@ -57,14 +57,14 @@ class WalletBackendService : Service() {
override fun onCreate() {
val talerWalletAndroidCode =
- assets.open("taler-wallet-android-$WALLET_CORE_VERSION.js").use {
+ assets.open("taler-wallet-embedded-$WALLET_CORE_VERSION.js").use {
it.readBytes().toString(Charsets.UTF_8)
}
Log.i(TAG, "onCreate in wallet backend service")
akono = AkonoJni()
- akono.putModuleCode("@gnu-taler/taler-wallet-android", talerWalletAndroidCode)
+ akono.putModuleCode("@gnu-taler/taler-wallet-embedded", talerWalletAndroidCode)
akono.setMessageHandler(object : AkonoJni.MessageHandler {
override fun handleMessage(message: String) {
this@WalletBackendService.handleAkonoMessage(message)
@@ -72,10 +72,9 @@ class WalletBackendService : Service() {
})
//akono.evalNodeCode("require('source-map-support').install();")
akono.evalNodeCode("require('akono');")
- akono.evalNodeCode("tw = require('@gnu-taler/taler-wallet-android');")
- akono.evalNodeCode("tw.installAndroidWalletListener();")
+ akono.evalNodeCode("tw = require('@gnu-taler/taler-wallet-embedded');")
+ akono.evalNodeCode("tw.installNativeWalletListener();")
sendInitMessage()
- initialized = true
super.onCreate()
}
@@ -92,13 +91,14 @@ class WalletBackendService : Service() {
* Handler of incoming messages from clients.
*/
class IncomingHandler(
- service: WalletBackendService
+ service: WalletBackendService,
) : Handler() {
private val serviceWeakRef = WeakReference(service)
override fun handleMessage(msg: Message) {
val svc = serviceWeakRef.get() ?: return
+ if (!svc.initialized) Log.w(TAG, "Warning: Not yet initialized")
when (msg.what) {
MSG_COMMAND -> {
val data = msg.data
@@ -203,7 +203,8 @@ class WalletBackendService : Service() {
"response" -> {
when (message.getString("operation")) {
"init" -> {
- Log.v(TAG, "got response for init operation: ${message.toString(2)}")
+ Log.d(TAG, "got response for init operation: ${message.toString(2)}")
+ initialized = true
sendNotify(message.toString(2))
}
"reset" -> {
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