react-native-nitro-modules 0.26.1 → 0.26.2
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/android/build.gradle +1 -1
- package/android/src/main/cpp/core/JAnyMap.hpp +13 -1
- package/android/src/main/java/com/margelo/nitro/core/AnyMap.kt +1 -0
- package/cpp/core/AnyMap.cpp +8 -0
- package/cpp/core/AnyMap.hpp +4 -0
- package/cpp/utils/NitroDefines.hpp +1 -1
- package/ios/core/AnyMapHolder.swift +13 -0
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -51,7 +51,7 @@ android {
|
|
|
51
51
|
externalNativeBuild {
|
|
52
52
|
cmake {
|
|
53
53
|
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
|
|
54
|
-
arguments "-DANDROID_STL=c++_shared"
|
|
54
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
55
55
|
abiFilters (*reactNativeArchitectures())
|
|
56
56
|
|
|
57
57
|
buildTypes {
|
|
@@ -40,7 +40,7 @@ private:
|
|
|
40
40
|
JAnyMap() {
|
|
41
41
|
_map = std::make_shared<AnyMap>();
|
|
42
42
|
}
|
|
43
|
-
JAnyMap(const std::shared_ptr<AnyMap>& map) : _map(map) {}
|
|
43
|
+
explicit JAnyMap(const std::shared_ptr<AnyMap>& map) : _map(map) {}
|
|
44
44
|
|
|
45
45
|
protected:
|
|
46
46
|
bool contains(const std::string& key) {
|
|
@@ -52,6 +52,17 @@ protected:
|
|
|
52
52
|
void clear() {
|
|
53
53
|
_map->clear();
|
|
54
54
|
}
|
|
55
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> getAllKeys() {
|
|
56
|
+
auto& map = _map->getMap();
|
|
57
|
+
auto array = jni::JArrayClass<jni::JString>::newArray(map.size());
|
|
58
|
+
size_t index = 0;
|
|
59
|
+
for (const auto& pair : map) {
|
|
60
|
+
auto jKey = jni::make_jstring(pair.first);
|
|
61
|
+
array->setElement(index, *jKey);
|
|
62
|
+
index++;
|
|
63
|
+
}
|
|
64
|
+
return array;
|
|
65
|
+
}
|
|
55
66
|
|
|
56
67
|
protected:
|
|
57
68
|
bool isNull(const std::string& key) {
|
|
@@ -163,6 +174,7 @@ public:
|
|
|
163
174
|
makeNativeMethod("contains", JAnyMap::contains),
|
|
164
175
|
makeNativeMethod("remove", JAnyMap::remove),
|
|
165
176
|
makeNativeMethod("clear", JAnyMap::clear),
|
|
177
|
+
makeNativeMethod("getAllKeys", JAnyMap::getAllKeys),
|
|
166
178
|
// is
|
|
167
179
|
makeNativeMethod("isNull", JAnyMap::isNull),
|
|
168
180
|
makeNativeMethod("isDouble", JAnyMap::isDouble),
|
package/cpp/core/AnyMap.cpp
CHANGED
|
@@ -16,6 +16,14 @@ void AnyMap::remove(const std::string& key) {
|
|
|
16
16
|
void AnyMap::clear() noexcept {
|
|
17
17
|
_map.clear();
|
|
18
18
|
}
|
|
19
|
+
std::vector<std::string> AnyMap::getAllKeys() const {
|
|
20
|
+
std::vector<std::string> keys;
|
|
21
|
+
keys.reserve(_map.size());
|
|
22
|
+
for (const auto& pair : _map) {
|
|
23
|
+
keys.push_back(pair.first);
|
|
24
|
+
}
|
|
25
|
+
return keys;
|
|
26
|
+
}
|
|
19
27
|
|
|
20
28
|
// Is
|
|
21
29
|
bool AnyMap::isNull(const std::string& key) const {
|
package/cpp/core/AnyMap.hpp
CHANGED
|
@@ -82,6 +82,19 @@ public final class AnyMapHolder {
|
|
|
82
82
|
cppPart.pointee.clear()
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Get all keys in this map.
|
|
87
|
+
*/
|
|
88
|
+
public func getAllKeys() -> [String] {
|
|
89
|
+
let cppKeys = cppPart.pointee.getAllKeys()
|
|
90
|
+
var keys = [String]()
|
|
91
|
+
keys.reserveCapacity(cppKeys.count)
|
|
92
|
+
for cppKey in cppKeys {
|
|
93
|
+
keys.append(String(cppKey))
|
|
94
|
+
}
|
|
95
|
+
return keys
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
// pragma MARK: Getters
|
|
86
99
|
|
|
87
100
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-modules",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|