[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-terminal-android] branch master updated (cac721a -> bfa7
From: |
gnunet |
Subject: |
[taler-merchant-terminal-android] branch master updated (cac721a -> bfa76fd) |
Date: |
Tue, 03 Mar 2020 21:13:59 +0100 |
This is an automated email from the git hooks/post-receive script.
torsten-grote pushed a change to branch master
in repository merchant-terminal-android.
from cac721a Use new i18n JSOn format
new 4d965f2 Enable minify for release builds
new 5cfc6b5 Prepend https:// to config URLs if they are missing it
new bfa76fd Stop caring about product_id and use our own unique IDs
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
app/build.gradle | 2 +-
.../merchantpos/config/MerchantConfigFragment.kt | 19 ++++-------
.../net/taler/merchantpos/order/Definitions.kt | 37 ++++++++--------------
3 files changed, 21 insertions(+), 37 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index e196397..fd6c18c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,7 +16,7 @@ android {
}
buildTypes {
release {
- minifyEnabled false
+ minifyEnabled true
proguardFiles
getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
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()
diff --git a/app/src/main/java/net/taler/merchantpos/order/Definitions.kt
b/app/src/main/java/net/taler/merchantpos/order/Definitions.kt
index 1e6e37b..269b74a 100644
--- a/app/src/main/java/net/taler/merchantpos/order/Definitions.kt
+++ b/app/src/main/java/net/taler/merchantpos/order/Definitions.kt
@@ -21,11 +21,15 @@ data class Category(
val localizedName: String get() = getLocalizedString(nameI18n, name)
}
+@JsonInclude(NON_NULL)
abstract class Product {
- abstract val id: String
+ @get:JsonProperty("product_id")
+ abstract val productId: String?
abstract val description: String
+ @get:JsonProperty("description_i18n")
abstract val descriptionI18n: Map<String, String>?
abstract val price: String
+ @get:JsonProperty("delivery_location")
abstract val location: String?
@get:JsonIgnore
val localizedDescription: String
@@ -33,13 +37,12 @@ abstract class Product {
}
data class ConfigProduct(
- @JsonProperty("product_id")
- override val id: String,
+ @JsonIgnore
+ val id: String = UUID.randomUUID().toString(),
+ override val productId: String?,
override val description: String,
- @JsonProperty("description_i18n")
override val descriptionI18n: Map<String, String>?,
override val price: String,
- @JsonProperty("delivery_location")
override val location: String?,
val categories: List<Int>,
@JsonIgnore
@@ -47,34 +50,20 @@ data class ConfigProduct(
) : Product() {
val priceAsDouble by lazy { Amount.fromString(price).amount.toDouble() }
- override fun equals(other: Any?): Boolean {
- return other is ConfigProduct && id == other.id
- }
-
- override fun hashCode(): Int {
- var result = id.hashCode()
- result = 31 * result + description.hashCode()
- result = 31 * result + price.hashCode()
- result = 31 * result + (location?.hashCode() ?: 0)
- result = 31 * result + categories.hashCode()
- return result
- }
+ override fun equals(other: Any?) = other is ConfigProduct && id == other.id
+ override fun hashCode() = id.hashCode()
}
data class ContractProduct(
- @JsonProperty("product_id")
- override val id: String,
+ override val productId: String?,
override val description: String,
- @JsonInclude(NON_NULL)
- @JsonProperty("description_i18n")
override val descriptionI18n: Map<String, String>?,
override val price: String,
- @JsonProperty("delivery_location")
override val location: String?,
val quantity: Int
) : Product() {
constructor(product: ConfigProduct) : this(
- product.id,
+ product.productId,
product.description,
product.descriptionI18n,
product.price,
@@ -112,7 +101,7 @@ data class Order(val id: Int, val availableCategories:
Map<Int, Category>) {
val title: String = id.toString()
val summary: String
get() = getCategoryQuantities().map { (category: Category, quantity:
Int) ->
- "$quantity x ${category.localizedName}"
+ "$quantity x ${category.localizedName}"
}.joinToString()
val total: Double
get() {
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-merchant-terminal-android] branch master updated (cac721a -> bfa76fd),
gnunet <=