[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-terminal-android] 02/03: Prepend https:// to config URLs
From: |
gnunet |
Subject: |
[taler-merchant-terminal-android] 02/03: Prepend https:// to config URLs if they are missing it |
Date: |
Tue, 03 Mar 2020 21:14:01 +0100 |
This is an automated email from the git hooks/post-receive script.
torsten-grote pushed a commit to branch master
in repository merchant-terminal-android.
commit 5cfc6b55bc8e140bdb290490733aa3ecbbba7a38
Author: Torsten Grote <address@hidden>
AuthorDate: Tue Mar 3 16:17:02 2020 -0300
Prepend https:// to config URLs if they are missing it
---
.../merchantpos/config/MerchantConfigFragment.kt | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git
a/app/src/main/java/net/taler/merchantpos/config/MerchantConfigFragment.kt
b/app/src/main/java/net/taler/merchantpos/config/MerchantConfigFragment.kt
index 2bca677..bd99754 100644
--- a/app/src/main/java/net/taler/merchantpos/config/MerchantConfigFragment.kt
+++ b/app/src/main/java/net/taler/merchantpos/config/MerchantConfigFragment.kt
@@ -37,12 +37,16 @@ class MerchantConfigFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
okButton.setOnClickListener {
- if (!checkInput()) return@setOnClickListener
- configUrlView.error = null
+ val inputUrl = configUrlView.editText!!.text
+ val url = if (inputUrl.startsWith("http")) {
+ inputUrl.toString()
+ } else {
+ "https://$inputUrl".also {
configUrlView.editText!!.setText(it) }
+ }
progressBar.visibility = VISIBLE
okButton.visibility = INVISIBLE
val config = Config(
- configUrl = configUrlView.editText!!.text.toString(),
+ configUrl = url,
username = usernameView.editText!!.text.toString(),
password = passwordView.editText!!.text.toString()
)
@@ -93,15 +97,6 @@ class MerchantConfigFragment : Fragment() {
forgetPasswordButton.visibility = if (config.hasPassword()) VISIBLE
else GONE
}
- private fun checkInput(): Boolean {
- return if (configUrlView.editText!!.text.startsWith("https://")) {
- true
- } else {
- configUrlView.error = getString(R.string.config_malformed_url)
- false
- }
- }
-
private fun onConfigReceived(currency: String) {
onResultReceived()
updateView()
--
To stop receiving notification emails like this one, please contact
address@hidden.