gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] branch master updated (8562b15 -> 89f8c6a)


From: gnunet
Subject: [taler-taler-android] branch master updated (8562b15 -> 89f8c6a)
Date: Fri, 31 Jul 2020 20:40:16 +0200

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a change to branch master
in repository taler-android.

    from 8562b15  Remove left-over class from libraryfication
     new dabc0ce  [cashier] check version from bank when configuring
     new 4bd0ec9  Enable code minification for release builds of all apps
     new 89f8c6a  [wallet] adapt to new message envelope API

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:
 cashier/.gitlab-ci.yml                             |  2 +-
 cashier/build.gradle                               |  2 +-
 cashier/proguard-rules.pro                         |  4 ++
 .../main/java/net/taler/cashier/MainViewModel.kt   | 32 +++++++++-----
 merchant-lib/consumer-rules.pro                    |  1 +
 merchant-terminal/.gitlab-ci.yml                   |  2 +-
 merchant-terminal/proguard-rules.pro               |  2 +
 settings.gradle                                    |  4 +-
 taler-kotlin-android/consumer-rules.pro            | 15 +++++++
 wallet/.gitlab-ci.yml                              |  2 +-
 wallet/build.gradle                                |  6 +--
 wallet/proguard-rules.pro                          |  4 ++
 .../taler/wallet/backend/WalletBackendService.kt   | 51 ++++++++++++----------
 13 files changed, 82 insertions(+), 45 deletions(-)

diff --git a/cashier/.gitlab-ci.yml b/cashier/.gitlab-ci.yml
index 6b73dee..cbf2bf0 100644
--- a/cashier/.gitlab-ci.yml
+++ b/cashier/.gitlab-ci.yml
@@ -36,7 +36,7 @@ cashier_deploy_nightly:
     # Set nightly application ID
     - sed -i "s,^\(\s*applicationId\) \"*[a-z\.].*\",\1 
\"net.taler.cashier.nightly\"," cashier/build.gradle
     # Build the APK
-    - ./gradlew :cashier:assembleDebug
+    - ./gradlew :cashier:assembleRelease
     # START only needed while patch not accepted/released upstream
     - apt update && apt install patch
     - patch /usr/lib/python3/dist-packages/fdroidserver/nightly.py 
nightly-stats.patch
diff --git a/cashier/build.gradle b/cashier/build.gradle
index e443944..341562d 100644
--- a/cashier/build.gradle
+++ b/cashier/build.gradle
@@ -35,7 +35,7 @@ android {
 
     buildTypes {
         release {
-            minifyEnabled false
+            minifyEnabled true
             proguardFiles 
getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
     }
diff --git a/cashier/proguard-rules.pro b/cashier/proguard-rules.pro
index f1b4245..f612b29 100644
--- a/cashier/proguard-rules.pro
+++ b/cashier/proguard-rules.pro
@@ -19,3 +19,7 @@
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
 #-renamesourcefileattribute SourceFile
+
+# androidx.security:security-crypto
+# https://github.com/google/tink/issues/361
+-keep class * extends 
com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite { *; }
diff --git a/cashier/src/main/java/net/taler/cashier/MainViewModel.kt 
b/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
index a4fd35e..1740494 100644
--- a/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
+++ b/cashier/src/main/java/net/taler/cashier/MainViewModel.kt
@@ -36,11 +36,13 @@ import net.taler.cashier.HttpHelper.makeJsonGetRequest
 import net.taler.cashier.withdraw.WithdrawManager
 import net.taler.common.AmountParserException
 import net.taler.common.SignedAmount
+import net.taler.common.Version
+import net.taler.common.getIncompatibleStringOrNull
 import net.taler.common.isOnline
 
 private val TAG = MainViewModel::class.java.simpleName
 
-private const val VERSION_BANK = "0:0:0"
+private val VERSION_BANK = Version(0, 0, 0)
 private const val PREF_NAME = "net.taler.cashier.prefs"
 private const val PREF_KEY_BANK_URL = "bankUrl"
 private const val PREF_KEY_USERNAME = "username"
@@ -91,17 +93,23 @@ class MainViewModel(private val app: Application) : 
AndroidViewModel(app) {
             Log.d(TAG, "Checking config: $url")
             val result = when (val response = makeJsonGetRequest(url, config)) 
{
                 is HttpJsonResult.Success -> {
-                    val version = response.json.getString("version")
-                    // TODO check if version is compatible
-                    val currency = response.json.getString("currency")
-                    try {
-                        mCurrency.postValue(currency)
-                        prefs.edit().putString(PREF_KEY_CURRENCY, 
currency).apply()
-                        // save config
-                        saveConfig(config)
-                        ConfigResult.Success
-                    } catch (e: Exception) {
-                        ConfigResult.Error(false, "Invalid Config: 
${response.json}")
+                    // check if bank's version is compatible with app
+                    // TODO use real version response when fixed in bank
+                    val version = "0:0:0" // response.json.getString("version")
+                    val versionIncompatible = 
VERSION_BANK.getIncompatibleStringOrNull(app, version)
+                    if (versionIncompatible != null) {
+                        ConfigResult.Error(false, versionIncompatible)
+                    } else {
+                        val currency = response.json.getString("currency")
+                        try {
+                            mCurrency.postValue(currency)
+                            prefs.edit().putString(PREF_KEY_CURRENCY, 
currency).apply()
+                            // save config
+                            saveConfig(config)
+                            ConfigResult.Success
+                        } catch (e: Exception) {
+                            ConfigResult.Error(false, "Invalid Config: 
${response.json}")
+                        }
                     }
                 }
                 is HttpJsonResult.Error -> {
diff --git a/merchant-lib/consumer-rules.pro b/merchant-lib/consumer-rules.pro
index e69de29..dc239e6 100644
--- a/merchant-lib/consumer-rules.pro
+++ b/merchant-lib/consumer-rules.pro
@@ -0,0 +1 @@
+-keep class net.taler.merchantlib.** {*;}
diff --git a/merchant-terminal/.gitlab-ci.yml b/merchant-terminal/.gitlab-ci.yml
index d159902..470cb58 100644
--- a/merchant-terminal/.gitlab-ci.yml
+++ b/merchant-terminal/.gitlab-ci.yml
@@ -38,7 +38,7 @@ merchant_deploy_nightly:
     # Set nightly application ID
     - sed -i "s,^\(\s*applicationId\) \"*[a-z\.].*\",\1 
\"net.taler.merchantpos.nightly\"," merchant-terminal/build.gradle
     # Build the APK
-    - ./gradlew :merchant-terminal:assembleDebug
+    - ./gradlew :merchant-terminal:assembleRelease
     # START only needed while patch not accepted/released upstream
     - apt update && apt install patch
     - patch /usr/lib/python3/dist-packages/fdroidserver/nightly.py 
nightly-stats.patch
diff --git a/merchant-terminal/proguard-rules.pro 
b/merchant-terminal/proguard-rules.pro
index f1b4245..1a50a50 100644
--- a/merchant-terminal/proguard-rules.pro
+++ b/merchant-terminal/proguard-rules.pro
@@ -19,3 +19,5 @@
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
 #-renamesourcefileattribute SourceFile
+
+-keep class net.taler.merchantpos.** {*;}
diff --git a/settings.gradle b/settings.gradle
index 6175852..2240bc2 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,7 +1,7 @@
+enableFeaturePreview('GRADLE_METADATA')
+
 include ':cashier', ':merchant-terminal', ':wallet'
 include ':taler-kotlin-common'
 include ':taler-kotlin-android'
 include ':merchant-lib'
 include ':anastasis-ui'
-
-enableFeaturePreview('GRADLE_METADATA')
diff --git a/taler-kotlin-android/consumer-rules.pro 
b/taler-kotlin-android/consumer-rules.pro
index e69de29..854cdfd 100644
--- a/taler-kotlin-android/consumer-rules.pro
+++ b/taler-kotlin-android/consumer-rules.pro
@@ -0,0 +1,15 @@
+-dontobfuscate
+
+# This is broad, but better leave a few common class and still optimize the 
rest out
+-keep class net.taler.common.** {*;}
+
+# AndroidX navigation
+-keepnames class androidx.navigation.fragment.NavHostFragment
+
+# Jackson serialization
+-keep class kotlin.Metadata { *; }
+-keep class kotlin.reflect.** { *; }
+
+# KotlinX serialization
+-keepattributes *Annotation*, InnerClasses
+-dontnote kotlinx.serialization.SerializationKt
diff --git a/wallet/.gitlab-ci.yml b/wallet/.gitlab-ci.yml
index c417aa9..42f561d 100644
--- a/wallet/.gitlab-ci.yml
+++ b/wallet/.gitlab-ci.yml
@@ -25,7 +25,7 @@ wallet_deploy_nightly:
     # Ensure that key exists
     - test -z "$DEBUG_KEYSTORE" && exit 0
     # Build the APK
-    - ./gradlew :wallet:assembleNightlyDebug
+    - ./gradlew :wallet:assembleNightlyRelease
     # START only needed while patch not accepted/released upstream
     - apt update && apt install patch
     - patch -b /usr/lib/python3/dist-packages/fdroidserver/nightly.py 
nightly-stats.patch
diff --git a/wallet/build.gradle b/wallet/build.gradle
index 1761018..ef5ddfa 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -23,7 +23,7 @@ plugins {
     id "de.undercouch.download"
 }
 
-def walletCoreVersion = "v0.7.1-dev.16"
+def walletCoreVersion = "v0.7.1-dev.18"
 
 static def versionCodeEpoch() {
     return (new Date().getTime() / 1000).toInteger()
@@ -47,13 +47,13 @@ android {
         minSdkVersion 24
         targetSdkVersion 29
         versionCode 6
-        versionName "0.7.1.dev.16"
+        versionName "0.7.1.dev.18"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         buildConfigField "String", "WALLET_CORE_VERSION", 
"\"$walletCoreVersion\""
     }
     buildTypes {
         release {
-            minifyEnabled false
+            minifyEnabled true
             proguardFiles 
getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
     }
diff --git a/wallet/proguard-rules.pro b/wallet/proguard-rules.pro
index f1b4245..27f3799 100644
--- a/wallet/proguard-rules.pro
+++ b/wallet/proguard-rules.pro
@@ -19,3 +19,7 @@
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
 #-renamesourcefileattribute SourceFile
+
+-keep class akono.AkonoJni {*;}
+
+-keep class net.taler.wallet.** {*;}
diff --git 
a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt 
b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
index f39a3e7..993114c 100644
--- a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
+++ b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
@@ -36,7 +36,7 @@ import kotlin.system.exitProcess
 
 private const val TAG = "taler-wallet-backend"
 
-class RequestData(val clientRequestID: Int, val messenger: Messenger)
+class RequestData(val clientRequestId: Int, val messenger: Messenger)
 
 
 class WalletBackendService : Service() {
@@ -70,7 +70,6 @@ class WalletBackendService : Service() {
                 this@WalletBackendService.handleAkonoMessage(message)
             }
         })
-        akono.evalNodeCode("console.log('hello world from taler 
wallet-android')")
         //akono.evalNodeCode("require('source-map-support').install();")
         akono.evalNodeCode("require('akono');")
         akono.evalNodeCode("tw = require('taler-wallet-android');")
@@ -184,9 +183,9 @@ class WalletBackendService : Service() {
     }
 
     private fun handleAkonoMessage(messageStr: String) {
-        Log.v(TAG, "got back message: $messageStr")
         val message = JSONObject(messageStr)
-        when (message.getString("type")) {
+        Log.v(TAG, "got back message: ${message.toString(2)}")
+        when (val type = message.getString("type")) {
             "notification" -> {
                 sendNotify(message.getString("payload"))
             }
@@ -199,7 +198,7 @@ class WalletBackendService : Service() {
                 }
             }
             "response" -> {
-                when (val operation = message.getString("operation")) {
+                when (message.getString("operation")) {
                     "init" -> {
                         Log.v(TAG, "got response for init operation: 
${message.toString(2)}")
                         sendNotify(message.toString(2))
@@ -208,29 +207,33 @@ class WalletBackendService : Service() {
                         exitProcess(1)
                     }
                     else -> {
-                        val id = message.getInt("id")
-                        Log.v(TAG, "got response for operation $operation")
-                        val rd = requests[id]
-                        if (rd == null) {
-                            Log.e(TAG, "wallet returned unknown request ID 
($id)")
-                            return
-                        }
-                        val m = Message.obtain(null, MSG_REPLY)
-                        val b = m.data
-                        if (message.has("result")) {
-                            val respJson = message.getJSONObject("result")
-                            b.putString("response", respJson.toString(2))
-                        } else {
-                            b.putString("response", "{}")
-                        }
-                        b.putBoolean("isError", message.getBoolean("isError"))
-                        b.putInt("requestID", rd.clientRequestID)
-                        b.putString("operation", operation)
-                        rd.messenger.send(m)
+                        val payload = 
message.getJSONObject("result").toString(2)
+                        handleResponse(false, message, payload)
                     }
                 }
             }
+            "error" -> {
+                val payload = message.getJSONObject("error").toString(2)
+                handleResponse(true, message, payload)
+            }
+            else -> throw IllegalArgumentException("Unknown message type: 
$type")
+        }
+    }
+
+    private fun handleResponse(isError: Boolean, message: JSONObject, payload: 
String) {
+        val id = message.getInt("id")
+        val rId = requests[id]
+        if (rId == null) {
+            Log.e(TAG, "wallet returned unknown request ID ($id)")
+            return
         }
+        val m = Message.obtain(null, MSG_REPLY)
+        val b = m.data
+        b.putInt("requestID", rId.clientRequestId)
+        b.putBoolean("isError", isError)
+        b.putString("response", payload)
+        b.putString("operation", message.getString("operation"))
+        rId.messenger.send(m)
     }
 
     companion object {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]