aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-02-14 11:12:42 -0600
committerTorsten Grote <t@grobox.de>2023-02-14 16:07:58 -0300
commit2731915faa8cfa57419fef8747ecab09a51ac991 (patch)
tree735b2bb251ba785617b14550482b810d00645fe3
parent23dd3cd9e783955b2badc5dab850468512e6cae7 (diff)
downloadtaler-android-2731915faa8cfa57419fef8747ecab09a51ac991.tar.gz
taler-android-2731915faa8cfa57419fef8747ecab09a51ac991.tar.bz2
taler-android-2731915faa8cfa57419fef8747ecab09a51ac991.zip
[wallet] Add support for ext+taler:// URI
-rw-r--r--wallet/src/main/AndroidManifest.xml4
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainActivity.kt23
2 files changed, 20 insertions, 7 deletions
diff --git a/wallet/src/main/AndroidManifest.xml b/wallet/src/main/AndroidManifest.xml
index 01e82a6..c40b87e 100644
--- a/wallet/src/main/AndroidManifest.xml
+++ b/wallet/src/main/AndroidManifest.xml
@@ -65,6 +65,10 @@
<data
android:scheme="TALER"
tools:ignore="AppLinkUrlError" />
+ <data android:scheme="ext+taler" />
+ <data
+ android:scheme="EXT+TALER"
+ tools:ignore="AppLinkUrlError" />
<data android:scheme="payto" />
</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 c3fc433..fcc9dee 100644
--- a/wallet/src/main/java/net/taler/wallet/MainActivity.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
@@ -235,9 +235,13 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
}
val normalizedURL = u.lowercase(ROOT)
+ var ext = false
val action = normalizedURL.substring(
if (normalizedURL.startsWith("taler://", ignoreCase = true)) {
"taler://".length
+ } else if (normalizedURL.startsWith("ext+taler://", ignoreCase = true)) {
+ ext = true
+ "ext+taler://".length
} else if (normalizedURL.startsWith("taler+http://", ignoreCase = true) &&
model.devMode.value == true
) {
@@ -247,37 +251,42 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
}
)
+ // Remove ext+ scheme prefix if present
+ val u2 = if (ext) {
+ "taler://" + u.substring("ext+taler://".length)
+ } else u
+
when {
action.startsWith("pay/", ignoreCase = true) -> {
Log.v(TAG, "navigating!")
nav.navigate(R.id.action_global_promptPayment)
- model.paymentManager.preparePay(u)
+ model.paymentManager.preparePay(u2)
}
action.startsWith("tip/", ignoreCase = true) -> {
Log.v(TAG, "navigating!")
nav.navigate(R.id.action_global_promptTip)
- model.tipManager.prepareTip(u)
+ model.tipManager.prepareTip(u2)
}
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)
+ model.withdrawManager.getWithdrawalDetails(u2)
}
action.startsWith("refund/", ignoreCase = true) -> {
model.showProgressBar.value = true
- model.refundManager.refund(u).observe(this, Observer(::onRefundResponse))
+ model.refundManager.refund(u2).observe(this, Observer(::onRefundResponse))
}
action.startsWith("pay-pull/", ignoreCase = true) -> {
nav.navigate(R.id.action_global_prompt_pull_payment)
- model.peerManager.checkPeerPullPayment(u)
+ model.peerManager.checkPeerPullPayment(u2)
}
action.startsWith("pay-push/", ignoreCase = true) -> {
nav.navigate(R.id.action_global_prompt_push_payment)
- model.peerManager.checkPeerPushPayment(u)
+ model.peerManager.checkPeerPushPayment(u2)
}
else -> {
- showError(R.string.error_unsupported_uri, "From: $from\nURI: $u")
+ showError(R.string.error_unsupported_uri, "From: $from\nURI: $u2")
}
}
}