summaryrefslogtreecommitdiff
path: root/wallet/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'wallet/src/main')
-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
7 files changed, 28 insertions, 18 deletions
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