diff options
author | Sebastian <sebasjm@gmail.com> | 2021-09-21 10:04:17 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-09-21 10:04:22 -0300 |
commit | 0ee31366954622f33a838a78e27f0b237f557e5a (patch) | |
tree | 1fc18aefda29883fd8b670e1c50d954353463f2a /wallet | |
parent | b783156eadfeb2b3e3b28fd6aabf17285930306d (diff) | |
download | taler-android-0ee31366954622f33a838a78e27f0b237f557e5a.tar.gz taler-android-0ee31366954622f33a838a78e27f0b237f557e5a.tar.bz2 taler-android-0ee31366954622f33a838a78e27f0b237f557e5a.zip |
add support to +http under devMode
Diffstat (limited to 'wallet')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/MainActivity.kt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/MainActivity.kt b/wallet/src/main/java/net/taler/wallet/MainActivity.kt index 09c26a8..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.lowercase(ROOT).startsWith("taler://pay/") || url.lowercase(ROOT).startsWith("taler+http://pay/") -> { + action.startsWith("pay/") -> { Log.v(TAG, "navigating!") nav.navigate(R.id.action_nav_main_to_promptPayment) model.paymentManager.preparePay(url) } - url.lowercase(ROOT).startsWith("taler://withdraw/") || url.lowercase(ROOT).startsWith("taler+http://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.lowercase(ROOT).startsWith("taler://refund/") || url.lowercase(ROOT).startsWith("taler+http://refund/") -> { + action.startsWith("refund/") -> { model.showProgressBar.value = true model.refundManager.refund(url).observe(this, Observer(::onRefundResponse)) } |