@dittolive/ditto 4.11.2-rc.1 → 4.12.0-experimental-untangle.0
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/DittoReactNative.podspec +9 -5
- package/README.md +3 -3
- package/node/ditto.cjs.js +1701 -371
- 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 +4 -4
- package/react-native/android/dittoffi/src/bus.h +44 -12
- package/react-native/android/dittoffi/src/dittoffi.h +183 -364
- package/react-native/android/dittoffi/src/dittoffi_java.cpp +7704 -8420
- package/react-native/android/dittoffi/src/dittostore_java.i +1 -0
- package/react-native/cpp/include/DQL.h +2 -0
- package/react-native/cpp/include/IO.h +2 -0
- package/react-native/cpp/include/Lifecycle.h +7 -0
- package/react-native/cpp/include/Platform.h +1 -1
- package/react-native/cpp/src/DQL.cpp +50 -4
- package/react-native/cpp/src/IO.cpp +40 -0
- package/react-native/cpp/src/Lifecycle.cpp +181 -1
- package/react-native/cpp/src/Logger.cpp +1 -1
- package/react-native/cpp/src/Misc.cpp +13 -2
- package/react-native/cpp/src/Presence.cpp +5 -1
- package/react-native/cpp/src/Sync.cpp +5 -1
- package/react-native/cpp/src/Transports.cpp +21 -16
- package/react-native/cpp/src/main.cpp +11 -1
- package/react-native/ditto.es6.js +1 -1
- package/react-native/ios/DittoRNSDK.mm +7 -2
- package/types/ditto.d.ts +4153 -3090
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dittolive/ditto",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0-experimental-untangle.0",
|
|
4
4
|
"description": "Ditto is a cross-platform SDK that allows apps to sync with and even without internet connectivity.",
|
|
5
|
-
"homepage": "https://ditto.
|
|
5
|
+
"homepage": "https://ditto.com",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
7
|
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "DittoLive Incorporated.",
|
|
10
|
-
"email": "contact@ditto.
|
|
11
|
-
"url": "https://ditto.
|
|
10
|
+
"email": "contact@ditto.com",
|
|
11
|
+
"url": "https://ditto.com"
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
"keywords": [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#include <ctime>
|
|
1
2
|
#ifdef DITTOFFI_EXPERIMENTAL_BUS
|
|
2
3
|
#include <cstring>
|
|
3
4
|
#include <stdexcept>
|
|
@@ -21,6 +22,14 @@ extern "C" {
|
|
|
21
22
|
class PeerPubkeySwig {
|
|
22
23
|
void_const_ptr_2_array_t pubkey;
|
|
23
24
|
|
|
25
|
+
const bool is_valid() const noexcept {
|
|
26
|
+
return pubkey.idx[0] && pubkey.idx[1];
|
|
27
|
+
}
|
|
28
|
+
const void invalidate() noexcept {
|
|
29
|
+
pubkey.idx[0] = nullptr;
|
|
30
|
+
pubkey.idx[1] = nullptr;
|
|
31
|
+
}
|
|
32
|
+
|
|
24
33
|
public:
|
|
25
34
|
explicit PeerPubkeySwig(char const *peer_key_str) noexcept(false)
|
|
26
35
|
: pubkey({}) {
|
|
@@ -36,9 +45,23 @@ public:
|
|
|
36
45
|
explicit PeerPubkeySwig(void_const_ptr_2_array_t key) noexcept
|
|
37
46
|
: pubkey(key) {}
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
PeerPubkeySwig(PeerPubkeySwig const &other) noexcept : pubkey({}) {
|
|
49
|
+
if (other.is_valid()) {
|
|
50
|
+
pubkey = dittoffi_peer_pubkey_clone(&other.pubkey);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
40
53
|
|
|
41
|
-
|
|
54
|
+
~PeerPubkeySwig() noexcept {
|
|
55
|
+
if (this->is_valid()) {
|
|
56
|
+
dittoffi_peer_pubkey_delete(pubkey);
|
|
57
|
+
invalidate();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
std::string to_string() noexcept(false) {
|
|
62
|
+
if (!this->is_valid()) {
|
|
63
|
+
throw std::runtime_error("Tried to use destroyed PeerPubkey");
|
|
64
|
+
}
|
|
42
65
|
auto s = dittoffi_peer_pubkey_to_cstr(&pubkey);
|
|
43
66
|
std::string result((const char *)s.ptr, s.len);
|
|
44
67
|
return result;
|
|
@@ -90,6 +113,9 @@ public:
|
|
|
90
113
|
class BytesSwig {
|
|
91
114
|
Bytes_t bytes;
|
|
92
115
|
|
|
116
|
+
bool is_valid() const noexcept { return bytes.vtable != nullptr; }
|
|
117
|
+
void invalidate() noexcept { bytes.vtable = nullptr; }
|
|
118
|
+
|
|
93
119
|
public:
|
|
94
120
|
explicit BytesSwig(slice_ref_uint8_t slice) noexcept
|
|
95
121
|
: bytes(dittoffi_bytes_copied_from_slice(slice)) {}
|
|
@@ -97,26 +123,32 @@ public:
|
|
|
97
123
|
explicit BytesSwig(Bytes_t bytes) noexcept : bytes(bytes) {}
|
|
98
124
|
|
|
99
125
|
BytesSwig(BytesSwig &&other) noexcept : bytes(other.bytes) {
|
|
100
|
-
other.
|
|
126
|
+
other.invalidate();
|
|
101
127
|
}
|
|
102
128
|
|
|
103
|
-
BytesSwig(BytesSwig const &other) noexcept
|
|
104
|
-
|
|
129
|
+
BytesSwig(BytesSwig const &other) noexcept : bytes({}) {
|
|
130
|
+
if (other.is_valid()) {
|
|
131
|
+
bytes = dittoffi_bytes_clone(&other.bytes);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
105
134
|
|
|
106
135
|
BytesSwig &operator=(BytesSwig const &other) noexcept = default;
|
|
107
136
|
|
|
108
137
|
Bytes_t take() noexcept {
|
|
109
138
|
auto result = bytes;
|
|
110
|
-
|
|
139
|
+
invalidate();
|
|
111
140
|
return result;
|
|
112
141
|
}
|
|
113
142
|
|
|
114
|
-
slice_ref_uint8_t data()
|
|
115
|
-
|
|
143
|
+
slice_ref_uint8_t data() {
|
|
144
|
+
if (!this->is_valid()) {
|
|
145
|
+
throw std::runtime_error("Tried to use destroyed Bytes");
|
|
146
|
+
}
|
|
147
|
+
return dittoffi_bytes_as_slice(&bytes);
|
|
116
148
|
}
|
|
117
149
|
|
|
118
150
|
virtual ~BytesSwig() noexcept {
|
|
119
|
-
if (
|
|
151
|
+
if (this->is_valid()) {
|
|
120
152
|
dittoffi_bytes_drop(&bytes);
|
|
121
153
|
}
|
|
122
154
|
}
|
|
@@ -226,7 +258,7 @@ public:
|
|
|
226
258
|
.free = callback->invokeRelease});
|
|
227
259
|
}
|
|
228
260
|
|
|
229
|
-
virtual
|
|
261
|
+
virtual size_t max_send_size() noexcept {
|
|
230
262
|
return stream.inner.vtable.max_send_size(stream.inner.ptr);
|
|
231
263
|
}
|
|
232
264
|
};
|
|
@@ -391,7 +423,7 @@ public:
|
|
|
391
423
|
}
|
|
392
424
|
|
|
393
425
|
virtual void connect(const char *peer_key_str, const char *topic,
|
|
394
|
-
Reliability reliability,
|
|
426
|
+
Reliability reliability, bool request_compression,
|
|
395
427
|
ConnectionResultCallbackSwig *callback) noexcept {
|
|
396
428
|
callback->java_retain();
|
|
397
429
|
slice_ref_uint8_t peer_key_slice = {.ptr = (const uint8_t *)peer_key_str,
|
|
@@ -405,7 +437,7 @@ public:
|
|
|
405
437
|
bus.inner.vtable.connect(bus.inner.ptr, parsed._1,
|
|
406
438
|
(slice_ref_uint8_t){.ptr = (const uint8_t *)topic,
|
|
407
439
|
.len = strlen(topic)},
|
|
408
|
-
reliability,
|
|
440
|
+
reliability, request_compression,
|
|
409
441
|
{.env_ptr = callback,
|
|
410
442
|
.call = callback->invokeCall,
|
|
411
443
|
.free = callback->invokeRelease});
|