summaryrefslogtreecommitdiff
path: root/wallet/src/main/java/net/taler/wallet/backend
diff options
context:
space:
mode:
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/backend')
-rw-r--r--wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt17
1 files changed, 9 insertions, 8 deletions
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 ccb995a..f99f38d 100644
--- a/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
+++ b/wallet/src/main/java/net/taler/wallet/backend/WalletBackendService.kt
@@ -17,7 +17,6 @@
package net.taler.wallet.backend
-import akono.AkonoJni
import android.app.Service
import android.content.Intent
import android.os.Handler
@@ -26,6 +25,7 @@ import android.os.Message
import android.os.Messenger
import android.os.RemoteException
import android.util.Log
+import net.taler.akono.AkonoJni
import net.taler.wallet.BuildConfig.WALLET_CORE_VERSION
import net.taler.wallet.HostCardEmulatorService
import org.json.JSONObject
@@ -57,14 +57,14 @@ class WalletBackendService : Service() {
override fun onCreate() {
val talerWalletAndroidCode =
- assets.open("taler-wallet-android-$WALLET_CORE_VERSION.js").use {
+ assets.open("taler-wallet-embedded-$WALLET_CORE_VERSION.js").use {
it.readBytes().toString(Charsets.UTF_8)
}
Log.i(TAG, "onCreate in wallet backend service")
akono = AkonoJni()
- akono.putModuleCode("@gnu-taler/taler-wallet-android", talerWalletAndroidCode)
+ akono.putModuleCode("@gnu-taler/taler-wallet-embedded", talerWalletAndroidCode)
akono.setMessageHandler(object : AkonoJni.MessageHandler {
override fun handleMessage(message: String) {
this@WalletBackendService.handleAkonoMessage(message)
@@ -72,10 +72,9 @@ class WalletBackendService : Service() {
})
//akono.evalNodeCode("require('source-map-support').install();")
akono.evalNodeCode("require('akono');")
- akono.evalNodeCode("tw = require('@gnu-taler/taler-wallet-android');")
- akono.evalNodeCode("tw.installAndroidWalletListener();")
+ akono.evalNodeCode("tw = require('@gnu-taler/taler-wallet-embedded');")
+ akono.evalNodeCode("tw.installNativeWalletListener();")
sendInitMessage()
- initialized = true
super.onCreate()
}
@@ -92,13 +91,14 @@ class WalletBackendService : Service() {
* Handler of incoming messages from clients.
*/
class IncomingHandler(
- service: WalletBackendService
+ service: WalletBackendService,
) : Handler() {
private val serviceWeakRef = WeakReference(service)
override fun handleMessage(msg: Message) {
val svc = serviceWeakRef.get() ?: return
+ if (!svc.initialized) Log.w(TAG, "Warning: Not yet initialized")
when (msg.what) {
MSG_COMMAND -> {
val data = msg.data
@@ -203,7 +203,8 @@ class WalletBackendService : Service() {
"response" -> {
when (message.getString("operation")) {
"init" -> {
- Log.v(TAG, "got response for init operation: ${message.toString(2)}")
+ Log.d(TAG, "got response for init operation: ${message.toString(2)}")
+ initialized = true
sendNotify(message.toString(2))
}
"reset" -> {