aboutsummaryrefslogtreecommitdiff
path: root/wallet/src
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2022-09-23 13:10:03 -0300
committerTorsten Grote <t@grobox.de>2022-09-23 13:10:03 -0300
commit54789b6adc3a7716c31b3d634b2afe55d95d9724 (patch)
tree4823bbf75fb0e7320f58a1989b6f49c83cc91a7d /wallet/src
parenta95f3a0068825ef28bcfdc7379a965609056ca6a (diff)
downloadtaler-android-54789b6adc3a7716c31b3d634b2afe55d95d9724.tar.gz
taler-android-54789b6adc3a7716c31b3d634b2afe55d95d9724.tar.bz2
taler-android-54789b6adc3a7716c31b3d634b2afe55d95d9724.zip
[wallet] Support uppercase URIs
Diffstat (limited to 'wallet/src')
-rw-r--r--wallet/src/main/AndroidManifest.xml3
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainActivity.kt20
-rw-r--r--wallet/src/main/java/net/taler/wallet/UriInputFragment.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/Utils.kt2
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt2
5 files changed, 17 insertions, 12 deletions
diff --git a/wallet/src/main/AndroidManifest.xml b/wallet/src/main/AndroidManifest.xml
index 7a924be..69670c3 100644
--- a/wallet/src/main/AndroidManifest.xml
+++ b/wallet/src/main/AndroidManifest.xml
@@ -60,6 +60,9 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="taler" />
+ <data
+ android:scheme="TALER"
+ tools:ignore="AppLinkUrlError" />
</intent-filter>
</activity>
diff --git a/wallet/src/main/java/net/taler/wallet/MainActivity.kt b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
index df974ff..5597564 100644
--- a/wallet/src/main/java/net/taler/wallet/MainActivity.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
@@ -203,7 +203,7 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
}
}
} else {
- if (!scheme.startsWith("taler")) {
+ if (!scheme.startsWith("taler", ignoreCase = true)) {
return actionFound
}
actionFound.postValue(uri.toString())
@@ -223,9 +223,11 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
val normalizedURL = u.lowercase(ROOT)
val action = normalizedURL.substring(
- if (normalizedURL.startsWith("taler://")) {
+ if (normalizedURL.startsWith("taler://", ignoreCase = true)) {
"taler://".length
- } else if (normalizedURL.startsWith("taler+http://") && model.devMode.value == true) {
+ } else if (normalizedURL.startsWith("taler+http://",
+ ignoreCase = true) && model.devMode.value == true
+ ) {
"taler+http://".length
} else {
normalizedURL.length
@@ -233,31 +235,31 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
)
when {
- action.startsWith("pay/") -> {
+ action.startsWith("pay/", ignoreCase = true) -> {
Log.v(TAG, "navigating!")
nav.navigate(R.id.action_global_promptPayment)
model.paymentManager.preparePay(u)
}
- action.startsWith("tip/") -> {
+ action.startsWith("tip/", ignoreCase = true) -> {
Log.v(TAG, "navigating!")
nav.navigate(R.id.action_global_promptTip)
model.tipManager.prepareTip(u)
}
- action.startsWith("withdraw/") -> {
+ action.startsWith("withdraw/", ignoreCase = true) -> {
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(u)
}
- action.startsWith("refund/") -> {
+ action.startsWith("refund/", ignoreCase = true) -> {
model.showProgressBar.value = true
model.refundManager.refund(u).observe(this, Observer(::onRefundResponse))
}
- action.startsWith("pay-pull/") -> {
+ action.startsWith("pay-pull/", ignoreCase = true) -> {
nav.navigate(R.id.action_global_prompt_pull_payment)
model.peerManager.checkPeerPullPayment(u)
}
- action.startsWith("pay-push/") -> {
+ action.startsWith("pay-push/", ignoreCase = true) -> {
nav.navigate(R.id.action_global_prompt_push_payment)
model.peerManager.checkPeerPushPayment(u)
}
diff --git a/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt b/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt
index b42e7d1..8ad1fb7 100644
--- a/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/UriInputFragment.kt
@@ -59,7 +59,7 @@ class UriInputFragment : Fragment() {
}
}
ui.okButton.setOnClickListener {
- if (ui.uriView.text?.startsWith("taler://") == true) {
+ if (ui.uriView.text?.startsWith("taler://", ignoreCase = true) == true) {
ui.uriLayout.error = null
val i = Intent(ACTION_VIEW, Uri.parse(ui.uriView.text.toString()))
startActivity(i)
diff --git a/wallet/src/main/java/net/taler/wallet/Utils.kt b/wallet/src/main/java/net/taler/wallet/Utils.kt
index 67bc72a..c0ccbed 100644
--- a/wallet/src/main/java/net/taler/wallet/Utils.kt
+++ b/wallet/src/main/java/net/taler/wallet/Utils.kt
@@ -84,7 +84,7 @@ private fun connectToWifiDeprecated(context: Context, ssid: String) {
}
fun cleanExchange(exchange: String) = exchange.let {
- if (it.startsWith("https://")) it.substring(8) else it
+ if (it.startsWith("https://", ignoreCase = true)) it.substring(8) else it
}.trimEnd('/')
fun getAmount(currency: String, text: String): Amount? {
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
index 07b95af..eef2fd3 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt
@@ -82,7 +82,7 @@ abstract class TransactionDetailFragment : Fragment() {
} else {
"${info.summary}\n\n${info.fulfillmentMessage}"
}
- if (info.fulfillmentUrl?.startsWith("http") == true) {
+ if (info.fulfillmentUrl?.startsWith("http", ignoreCase = true) == true) {
val i = Intent().apply {
data = Uri.parse(info.fulfillmentUrl)
}