summaryrefslogtreecommitdiff
path: root/wallet/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'wallet/src/main/java')
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainActivity.kt16
-rw-r--r--wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt8
-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
6 files changed, 22 insertions, 13 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..8312d9b 100644
--- a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
+++ b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
@@ -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,8 +72,8 @@ 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()
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)