commit 01125a17a010a6d78fd4b25be549691a152c4349
parent 5e1d4e9c38ba7248c96b78b2b975c59e94b95b15
Author: Iván Ávalos <avalos@disroot.org>
Date: Thu, 21 Mar 2024 10:01:29 -0600
android: implement native interface with curl
Diffstat:
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/QuickJS-android/qtart/src/main/java/net/taler/qtart/TalerWalletCore.kt b/QuickJS-android/qtart/src/main/java/net/taler/qtart/TalerWalletCore.kt
@@ -64,6 +64,7 @@ class TalerWalletCore {
fun TALER_WALLET_run(twi: Pointer): Int
fun TALER_WALLET_join(twi: Pointer)
fun TALER_start_redirect_std(logfn: TALER_LogFn, cls: Pointer)
+ fun TALER_set_curl_http_client(twi: Pointer)
}
private val walletInstance: Pointer = TalerNative.INSTANCE.TALER_WALLET_create()
@@ -99,6 +100,10 @@ class TalerWalletCore {
TalerNative.INSTANCE.TALER_WALLET_send_request(walletInstance, request)
}
+ fun setCurlHttpClient() {
+ TalerNative.INSTANCE.TALER_set_curl_http_client(walletInstance)
+ }
+
fun run() {
TalerNative.INSTANCE.TALER_WALLET_run(walletInstance)
}
diff --git a/taler_wallet_core_lib.c b/taler_wallet_core_lib.c
@@ -335,6 +335,13 @@ TALER_set_http_client_implementation(struct TALER_WALLET_Instance *twi,
twi->http_impl = impl;
}
+void
+TALER_set_curl_http_client(struct TALER_WALLET_Instance *twi)
+{
+ struct JSHttpClientImplementation *client = js_curl_http_client_create();
+ TALER_set_http_client_implementation(twi, client);
+}
+
#pragma mark -
struct JSHttpClientImplementation *
TALER_pack_http_client_implementation(JSHttpReqCreateFn req_create,
diff --git a/taler_wallet_core_lib.h b/taler_wallet_core_lib.h
@@ -163,6 +163,15 @@ void
TALER_set_http_client_implementation(struct TALER_WALLET_Instance *twi,
struct JSHttpClientImplementation *impl);
+/**
+ * Set the reference CuRL-based HTTP client implementation as the one
+ * to be used by the wallet.
+ *
+ * @param twi wallet-core instance
+ */
+void
+TALER_set_curl_http_client(struct TALER_WALLET_Instance *twi);
+
#pragma mark -
/**
* Build JSHttpClientImplementation struct for native HTTP client implementation to be used by the wallet.