@dittolive/ditto 4.12.4-experimental.sdk-publishing.6 → 4.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/node/ditto.cjs.js +2 -2
- package/node/ditto.darwin-arm64.node +0 -0
- package/node/ditto.darwin-x64.node +0 -0
- package/node/ditto.linux-arm64.node +0 -0
- package/node/ditto.linux-x64.node +0 -0
- package/node/ditto.win32-x64.node +0 -0
- package/package.json +1 -1
- package/react-native/android/dittoffi/src/dittoffi.h +21 -10
- package/react-native/android/dittoffi/src/dittoffi_java.cpp +121 -84
- package/react-native/android/dittoffi/src/dittostore_java.i +45 -1
- package/react-native/ditto.es6.js +1 -1
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
_Ditto is a cross-platform SDK that allows mobile, web, and IoT apps to sync
|
|
4
4
|
with and even without connectivity._
|
|
5
5
|
|
|
6
|
-
Version: **4.12.4
|
|
6
|
+
Version: **4.12.4**
|
|
7
7
|
|
|
8
8
|
For more information please visit [ditto.com](https://ditto.com), as well as the
|
|
9
|
-
[API Reference](https://software.ditto.live/js/Ditto/4.12.4
|
|
9
|
+
[API Reference](https://software.ditto.live/js/Ditto/4.12.4/api-reference/) for this particular version.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
package/node/ditto.cjs.js
CHANGED
|
@@ -2393,7 +2393,7 @@ class AttachmentToken {
|
|
|
2393
2393
|
|
|
2394
2394
|
// NOTE: this is patched up with the actual build version by Jake task
|
|
2395
2395
|
// build:package and has to be a valid semantic version as defined here: https://semver.org.
|
|
2396
|
-
const fullBuildVersionString = '4.12.4
|
|
2396
|
+
const fullBuildVersionString = '4.12.4';
|
|
2397
2397
|
|
|
2398
2398
|
//
|
|
2399
2399
|
// Copyright © 2021 DittoLive Incorporated. All rights reserved.
|
|
@@ -7008,7 +7008,7 @@ class TransportConfig {
|
|
|
7008
7008
|
isEnabled: false,
|
|
7009
7009
|
interfaceIP: '[::]',
|
|
7010
7010
|
port: 80,
|
|
7011
|
-
websocketSync:
|
|
7011
|
+
websocketSync: true,
|
|
7012
7012
|
},
|
|
7013
7013
|
};
|
|
7014
7014
|
this.global = {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dittolive/ditto",
|
|
3
|
-
"version": "4.12.4
|
|
3
|
+
"version": "4.12.4",
|
|
4
4
|
"description": "Ditto is a cross-platform SDK that allows apps to sync with and even without internet connectivity.",
|
|
5
5
|
"homepage": "https://ditto.com",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -1672,16 +1672,6 @@ BoxedCharPtrResult_t
|
|
|
1672
1672
|
char *
|
|
1673
1673
|
/* fn */ ditto_error_message (void);
|
|
1674
1674
|
|
|
1675
|
-
/** \brief
|
|
1676
|
-
* Retrieves last thread-local error message (used by some synchronous APIs)
|
|
1677
|
-
* and retains ownership of it.
|
|
1678
|
-
*
|
|
1679
|
-
* Returns `NULL` if there was no error. A non-null result MUST be freed using
|
|
1680
|
-
* `ditto_c_string_free`.
|
|
1681
|
-
*/
|
|
1682
|
-
char *
|
|
1683
|
-
/* fn */ ditto_error_message_peek (void);
|
|
1684
|
-
|
|
1685
1675
|
/** <No documentation available> */
|
|
1686
1676
|
typedef struct CIdentityConfig CIdentityConfig_t;
|
|
1687
1677
|
|
|
@@ -3044,6 +3034,27 @@ char const *
|
|
|
3044
3034
|
char const *
|
|
3045
3035
|
/* fn */ dittoffi_DITTO_DEVELOPMENT_PROVIDER (void);
|
|
3046
3036
|
|
|
3037
|
+
/** \brief
|
|
3038
|
+
* Communicate to the allocation tracking machinery that we want allocations to start being
|
|
3039
|
+
* tracked.
|
|
3040
|
+
*
|
|
3041
|
+
* In practice, all this means is that the allocation tracker will reset to a default state.
|
|
3042
|
+
*
|
|
3043
|
+
* If the `alloc-tracking` feature is not enabled then this is a no-op.
|
|
3044
|
+
*/
|
|
3045
|
+
void
|
|
3046
|
+
/* fn */ dittoffi_alloc_tracking_start (void);
|
|
3047
|
+
|
|
3048
|
+
/** \brief
|
|
3049
|
+
* Compare current allocations to an empty (default) snapshot and return any leaks as a string.
|
|
3050
|
+
*
|
|
3051
|
+
* Returns `None` if no leaks detected.
|
|
3052
|
+
*
|
|
3053
|
+
* If the `alloc-tracking` feature is not enabled then this is (essentially) a no-op.
|
|
3054
|
+
*/
|
|
3055
|
+
char *
|
|
3056
|
+
/* fn */ dittoffi_alloc_tracking_stop (void);
|
|
3057
|
+
|
|
3047
3058
|
/** <No documentation available> */
|
|
3048
3059
|
void
|
|
3049
3060
|
/* fn */ dittoffi_authentication_register_local_server_backend (
|
|
@@ -939,6 +939,14 @@ SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
|
|
|
939
939
|
{
|
|
940
940
|
return *it;
|
|
941
941
|
}
|
|
942
|
+
|
|
943
|
+
// Helper function to extract and take ownership of the string from BoxedCharPtrResult_t
|
|
944
|
+
// The returned string is freed by the custom typemap above
|
|
945
|
+
char* take_string_from_BoxedCharPtrResult(BoxedCharPtrResult_t* result) {
|
|
946
|
+
char* str = result->c_string;
|
|
947
|
+
result->c_string = NULL; // Prevent double-free
|
|
948
|
+
return str;
|
|
949
|
+
}
|
|
942
950
|
}
|
|
943
951
|
extern "C" {
|
|
944
952
|
// This apparently no-op functions relies on the out typemap to perform the conversion
|
|
@@ -1051,26 +1059,27 @@ static CWriteTransaction_t * Ditto_WriteTransactionHandle_value(CWriteTransactio
|
|
|
1051
1059
|
}
|
|
1052
1060
|
|
|
1053
1061
|
|
|
1054
|
-
|
|
1055
|
-
return
|
|
1062
|
+
char ** new_Ditto_StringHandle(void) {
|
|
1063
|
+
return (char **) malloc(sizeof(char *));
|
|
1056
1064
|
}
|
|
1057
1065
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1066
|
+
void delete_Ditto_StringHandle(char **obj) {
|
|
1067
|
+
if (obj != NULL) {
|
|
1068
|
+
if (*obj != NULL) {
|
|
1069
|
+
ditto_c_string_free(*obj); // Free the string itself
|
|
1070
|
+
}
|
|
1071
|
+
free(obj); // Free the wrapper
|
|
1072
|
+
}
|
|
1060
1073
|
}
|
|
1061
1074
|
|
|
1062
|
-
|
|
1063
|
-
|
|
1075
|
+
char * Ditto_StringHandle_value(char **obj) {
|
|
1076
|
+
return *obj;
|
|
1064
1077
|
}
|
|
1065
1078
|
|
|
1066
|
-
|
|
1079
|
+
void Ditto_StringHandle_assign(char **obj, char *value) {
|
|
1067
1080
|
*obj = value;
|
|
1068
1081
|
}
|
|
1069
1082
|
|
|
1070
|
-
static char * Ditto_StringHandle_value(char * *obj) {
|
|
1071
|
-
return *obj;
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
1083
|
|
|
1075
1084
|
static long long *new_Ditto_LongLongHandle(void) {
|
|
1076
1085
|
return new long long();
|
|
@@ -9297,6 +9306,41 @@ SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Java
|
|
|
9297
9306
|
}
|
|
9298
9307
|
|
|
9299
9308
|
|
|
9309
|
+
SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_take_1string_1from_1BoxedCharPtrResult(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
|
9310
|
+
jstring jresult = 0 ;
|
|
9311
|
+
BoxedCharPtrResult_t *arg1 = (BoxedCharPtrResult_t *) 0 ;
|
|
9312
|
+
char *result = 0 ;
|
|
9313
|
+
|
|
9314
|
+
(void)jenv;
|
|
9315
|
+
(void)jcls;
|
|
9316
|
+
(void)jarg1_;
|
|
9317
|
+
arg1 = *(BoxedCharPtrResult_t **)&jarg1;
|
|
9318
|
+
{
|
|
9319
|
+
try {
|
|
9320
|
+
result = (char *)take_string_from_BoxedCharPtrResult(arg1);
|
|
9321
|
+
} catch (const std::runtime_error &e) {
|
|
9322
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9323
|
+
return 0;
|
|
9324
|
+
} catch (const std::exception &e) {
|
|
9325
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9326
|
+
return 0;
|
|
9327
|
+
} catch (...) {
|
|
9328
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
|
|
9329
|
+
return 0;
|
|
9330
|
+
}
|
|
9331
|
+
}
|
|
9332
|
+
{
|
|
9333
|
+
if (result != NULL) {
|
|
9334
|
+
jresult = jenv->NewStringUTF((const char *)result);
|
|
9335
|
+
ditto_c_string_free(result); // Free the string after converting to Java String
|
|
9336
|
+
} else {
|
|
9337
|
+
jresult = NULL;
|
|
9338
|
+
}
|
|
9339
|
+
}
|
|
9340
|
+
return jresult;
|
|
9341
|
+
}
|
|
9342
|
+
|
|
9343
|
+
|
|
9300
9344
|
SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_JavaOf_1slice_1ref_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
|
9301
9345
|
jbyteArray jresult = 0 ;
|
|
9302
9346
|
slice_ref_uint8_t *arg1 = (slice_ref_uint8_t *) 0 ;
|
|
@@ -9872,58 +9916,53 @@ SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditt
|
|
|
9872
9916
|
}
|
|
9873
9917
|
|
|
9874
9918
|
|
|
9875
|
-
SWIGEXPORT
|
|
9876
|
-
|
|
9877
|
-
char *arg1 = (char *) 0 ;
|
|
9878
|
-
char **result = 0 ;
|
|
9919
|
+
SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1StringHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
|
|
9920
|
+
char **arg1 = (char **) 0 ;
|
|
9879
9921
|
|
|
9880
9922
|
(void)jenv;
|
|
9881
9923
|
(void)jcls;
|
|
9882
|
-
arg1 =
|
|
9883
|
-
if (jarg1) {
|
|
9884
|
-
arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
|
|
9885
|
-
if (!arg1) return 0;
|
|
9886
|
-
}
|
|
9924
|
+
arg1 = *(char ***)&jarg1;
|
|
9887
9925
|
{
|
|
9888
9926
|
try {
|
|
9889
|
-
|
|
9927
|
+
delete_Ditto_StringHandle(arg1);
|
|
9890
9928
|
} catch (const std::runtime_error &e) {
|
|
9891
9929
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9892
|
-
return
|
|
9930
|
+
return ;
|
|
9893
9931
|
} catch (const std::exception &e) {
|
|
9894
9932
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9895
|
-
return
|
|
9933
|
+
return ;
|
|
9896
9934
|
} catch (...) {
|
|
9897
9935
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
|
|
9898
|
-
return
|
|
9936
|
+
return ;
|
|
9899
9937
|
}
|
|
9900
9938
|
}
|
|
9901
|
-
*(char ***)&jresult = result;
|
|
9902
|
-
if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
|
|
9903
|
-
return jresult;
|
|
9904
9939
|
}
|
|
9905
9940
|
|
|
9906
9941
|
|
|
9907
|
-
SWIGEXPORT
|
|
9942
|
+
SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1StringHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
|
|
9943
|
+
jstring jresult = 0 ;
|
|
9908
9944
|
char **arg1 = (char **) 0 ;
|
|
9945
|
+
char *result = 0 ;
|
|
9909
9946
|
|
|
9910
9947
|
(void)jenv;
|
|
9911
9948
|
(void)jcls;
|
|
9912
9949
|
arg1 = *(char ***)&jarg1;
|
|
9913
9950
|
{
|
|
9914
9951
|
try {
|
|
9915
|
-
|
|
9952
|
+
result = (char *)Ditto_StringHandle_value(arg1);
|
|
9916
9953
|
} catch (const std::runtime_error &e) {
|
|
9917
9954
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9918
|
-
return ;
|
|
9955
|
+
return 0;
|
|
9919
9956
|
} catch (const std::exception &e) {
|
|
9920
9957
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9921
|
-
return ;
|
|
9958
|
+
return 0;
|
|
9922
9959
|
} catch (...) {
|
|
9923
9960
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
|
|
9924
|
-
return ;
|
|
9961
|
+
return 0;
|
|
9925
9962
|
}
|
|
9926
9963
|
}
|
|
9964
|
+
if (result) jresult = jenv->NewStringUTF((const char *)result);
|
|
9965
|
+
return jresult;
|
|
9927
9966
|
}
|
|
9928
9967
|
|
|
9929
9968
|
|
|
@@ -9957,33 +9996,6 @@ SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1Str
|
|
|
9957
9996
|
}
|
|
9958
9997
|
|
|
9959
9998
|
|
|
9960
|
-
SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1StringHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
|
|
9961
|
-
jstring jresult = 0 ;
|
|
9962
|
-
char **arg1 = (char **) 0 ;
|
|
9963
|
-
char *result = 0 ;
|
|
9964
|
-
|
|
9965
|
-
(void)jenv;
|
|
9966
|
-
(void)jcls;
|
|
9967
|
-
arg1 = *(char ***)&jarg1;
|
|
9968
|
-
{
|
|
9969
|
-
try {
|
|
9970
|
-
result = (char *)Ditto_StringHandle_value(arg1);
|
|
9971
|
-
} catch (const std::runtime_error &e) {
|
|
9972
|
-
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9973
|
-
return 0;
|
|
9974
|
-
} catch (const std::exception &e) {
|
|
9975
|
-
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
9976
|
-
return 0;
|
|
9977
|
-
} catch (...) {
|
|
9978
|
-
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
|
|
9979
|
-
return 0;
|
|
9980
|
-
}
|
|
9981
|
-
}
|
|
9982
|
-
if (result) jresult = jenv->NewStringUTF((const char *)result);
|
|
9983
|
-
return jresult;
|
|
9984
|
-
}
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
9999
|
SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1LongLongHandle(JNIEnv *jenv, jclass jcls) {
|
|
9988
10000
|
jlong jresult = 0 ;
|
|
9989
10001
|
long long *result = 0 ;
|
|
@@ -15565,6 +15577,11 @@ SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1
|
|
|
15565
15577
|
}
|
|
15566
15578
|
}
|
|
15567
15579
|
if (result) jresult = jenv->NewStringUTF((const char *)result);
|
|
15580
|
+
{
|
|
15581
|
+
if (result != NULL) {
|
|
15582
|
+
ditto_c_string_free(result);
|
|
15583
|
+
}
|
|
15584
|
+
}
|
|
15568
15585
|
return jresult;
|
|
15569
15586
|
}
|
|
15570
15587
|
|
|
@@ -20093,31 +20110,6 @@ SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1
|
|
|
20093
20110
|
}
|
|
20094
20111
|
|
|
20095
20112
|
|
|
20096
|
-
SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1error_1message_1peek(JNIEnv *jenv, jclass jcls) {
|
|
20097
|
-
jstring jresult = 0 ;
|
|
20098
|
-
char *result = 0 ;
|
|
20099
|
-
|
|
20100
|
-
(void)jenv;
|
|
20101
|
-
(void)jcls;
|
|
20102
|
-
{
|
|
20103
|
-
try {
|
|
20104
|
-
result = (char *)ditto_error_message_peek();
|
|
20105
|
-
} catch (const std::runtime_error &e) {
|
|
20106
|
-
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
20107
|
-
return 0;
|
|
20108
|
-
} catch (const std::exception &e) {
|
|
20109
|
-
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
20110
|
-
return 0;
|
|
20111
|
-
} catch (...) {
|
|
20112
|
-
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
|
|
20113
|
-
return 0;
|
|
20114
|
-
}
|
|
20115
|
-
}
|
|
20116
|
-
if (result) jresult = jenv->NewStringUTF((const char *)result);
|
|
20117
|
-
return jresult;
|
|
20118
|
-
}
|
|
20119
|
-
|
|
20120
|
-
|
|
20121
20113
|
SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1experimental_1make_1with_1passphrase(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jint jarg3, jstring jarg4, jlong jarg5) {
|
|
20122
20114
|
jlong jresult = 0 ;
|
|
20123
20115
|
char *arg1 = (char *) 0 ;
|
|
@@ -25559,6 +25551,51 @@ SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoff
|
|
|
25559
25551
|
}
|
|
25560
25552
|
|
|
25561
25553
|
|
|
25554
|
+
SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1alloc_1tracking_1start(JNIEnv *jenv, jclass jcls) {
|
|
25555
|
+
(void)jenv;
|
|
25556
|
+
(void)jcls;
|
|
25557
|
+
{
|
|
25558
|
+
try {
|
|
25559
|
+
dittoffi_alloc_tracking_start();
|
|
25560
|
+
} catch (const std::runtime_error &e) {
|
|
25561
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
25562
|
+
return ;
|
|
25563
|
+
} catch (const std::exception &e) {
|
|
25564
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
25565
|
+
return ;
|
|
25566
|
+
} catch (...) {
|
|
25567
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
|
|
25568
|
+
return ;
|
|
25569
|
+
}
|
|
25570
|
+
}
|
|
25571
|
+
}
|
|
25572
|
+
|
|
25573
|
+
|
|
25574
|
+
SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1alloc_1tracking_1stop(JNIEnv *jenv, jclass jcls) {
|
|
25575
|
+
jstring jresult = 0 ;
|
|
25576
|
+
char *result = 0 ;
|
|
25577
|
+
|
|
25578
|
+
(void)jenv;
|
|
25579
|
+
(void)jcls;
|
|
25580
|
+
{
|
|
25581
|
+
try {
|
|
25582
|
+
result = (char *)dittoffi_alloc_tracking_stop();
|
|
25583
|
+
} catch (const std::runtime_error &e) {
|
|
25584
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
25585
|
+
return 0;
|
|
25586
|
+
} catch (const std::exception &e) {
|
|
25587
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
|
|
25588
|
+
return 0;
|
|
25589
|
+
} catch (...) {
|
|
25590
|
+
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
|
|
25591
|
+
return 0;
|
|
25592
|
+
}
|
|
25593
|
+
}
|
|
25594
|
+
if (result) jresult = jenv->NewStringUTF((const char *)result);
|
|
25595
|
+
return jresult;
|
|
25596
|
+
}
|
|
25597
|
+
|
|
25598
|
+
|
|
25562
25599
|
SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1authentication_1register_1local_1server_1backend(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jlong jarg6) {
|
|
25563
25600
|
CDitto_t *arg1 = (CDitto_t *) 0 ;
|
|
25564
25601
|
void *arg2 = (void *) 0 ;
|
|
@@ -369,6 +369,18 @@
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
|
|
373
|
+
// Custom typemap for take_string_from_BoxedCharPtrResult helper function
|
|
374
|
+
// This properly frees the string after conversion since ownership was transferred
|
|
375
|
+
%typemap(out) char *take_string_from_BoxedCharPtrResult {
|
|
376
|
+
if ($1 != NULL) {
|
|
377
|
+
$result = jenv->NewStringUTF((const char *)$1);
|
|
378
|
+
ditto_c_string_free($1); // Free the string after converting to Java String
|
|
379
|
+
} else {
|
|
380
|
+
$result = NULL;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
372
384
|
%inline %{ extern "C" {
|
|
373
385
|
slice_boxed_uint8_t get_id (
|
|
374
386
|
CAttachment_t const * it)
|
|
@@ -382,6 +394,14 @@
|
|
|
382
394
|
{
|
|
383
395
|
return *it;
|
|
384
396
|
}
|
|
397
|
+
|
|
398
|
+
// Helper function to extract and take ownership of the string from BoxedCharPtrResult_t
|
|
399
|
+
// The returned string is freed by the custom typemap above
|
|
400
|
+
char* take_string_from_BoxedCharPtrResult(BoxedCharPtrResult_t* result) {
|
|
401
|
+
char* str = result->c_string;
|
|
402
|
+
result->c_string = NULL; // Prevent double-free
|
|
403
|
+
return str;
|
|
404
|
+
}
|
|
385
405
|
} %}
|
|
386
406
|
|
|
387
407
|
// High-level Java type
|
|
@@ -479,6 +499,7 @@
|
|
|
479
499
|
%newobject dittoffi_ditto_absolute_persistence_directory;
|
|
480
500
|
%newobject ditto_sdk_transports_error_description;
|
|
481
501
|
%newobject dittoffi_connection_request_peer_key_string;
|
|
502
|
+
%newobject ditto_auth_client_get_app_id;
|
|
482
503
|
|
|
483
504
|
// To make it possible (or at least a lot easier) to work with pointers to some
|
|
484
505
|
// of the Ditto_* types we use the `%pointer_functions` directive to provide a
|
|
@@ -503,7 +524,30 @@
|
|
|
503
524
|
CWriteTransaction_t *,
|
|
504
525
|
Ditto_WriteTransactionHandle
|
|
505
526
|
)
|
|
506
|
-
|
|
527
|
+
// Custom implementation for Ditto_StringHandle to properly free the string
|
|
528
|
+
%inline %{
|
|
529
|
+
char ** new_Ditto_StringHandle(void) {
|
|
530
|
+
return (char **) malloc(sizeof(char *));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
void delete_Ditto_StringHandle(char **obj) {
|
|
534
|
+
if (obj != NULL) {
|
|
535
|
+
if (*obj != NULL) {
|
|
536
|
+
ditto_c_string_free(*obj); // Free the string itself
|
|
537
|
+
}
|
|
538
|
+
free(obj); // Free the wrapper
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
char * Ditto_StringHandle_value(char **obj) {
|
|
543
|
+
return *obj;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
void Ditto_StringHandle_assign(char **obj, char *value) {
|
|
547
|
+
*obj = value;
|
|
548
|
+
}
|
|
549
|
+
%}
|
|
550
|
+
|
|
507
551
|
%pointer_functions(long long, Ditto_LongLongHandle)
|
|
508
552
|
%pointer_functions(uint64_t, Ditto_U64Handle)
|
|
509
553
|
%pointer_functions(bool, Ditto_BoolHandle)
|