@onekeyfe/react-native-cloud-kit-module 1.1.6
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/CloudKitModule.podspec +29 -0
- package/LICENSE +20 -0
- package/README.md +39 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +128 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/cloudkitmodule/CloudKitModule.kt +51 -0
- package/android/src/main/java/com/margelo/nitro/cloudkitmodule/CloudKitModulePackage.kt +22 -0
- package/ios/CloudKitModule.swift +186 -0
- package/ios/CloudKitModuleCore.swift +195 -0
- package/lib/module/CloudKitModule.nitro.js +4 -0
- package/lib/module/CloudKitModule.nitro.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/CloudKitModule.nitro.d.ts +55 -0
- package/lib/typescript/src/CloudKitModule.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JAccountInfoResult.hpp +62 -0
- package/nitrogen/generated/android/c++/JDeleteRecordParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JFetchRecordParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JHybridCloudKitModuleSpec.cpp +192 -0
- package/nitrogen/generated/android/c++/JHybridCloudKitModuleSpec.hpp +70 -0
- package/nitrogen/generated/android/c++/JQueryRecordsParams.hpp +53 -0
- package/nitrogen/generated/android/c++/JQueryRecordsResult.hpp +73 -0
- package/nitrogen/generated/android/c++/JRecordExistsParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JRecordResult.hpp +73 -0
- package/nitrogen/generated/android/c++/JSaveRecordParams.hpp +65 -0
- package/nitrogen/generated/android/c++/JSaveRecordResult.hpp +57 -0
- package/nitrogen/generated/android/cloudkitmodule+autolinking.cmake +81 -0
- package/nitrogen/generated/android/cloudkitmodule+autolinking.gradle +27 -0
- package/nitrogen/generated/android/cloudkitmoduleOnLoad.cpp +44 -0
- package/nitrogen/generated/android/cloudkitmoduleOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/AccountInfoResult.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/DeleteRecordParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/FetchRecordParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/HybridCloudKitModuleSpec.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/QueryRecordsParams.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/QueryRecordsResult.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/RecordExistsParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/RecordResult.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/SaveRecordParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/SaveRecordResult.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/cloudkitmoduleOnLoad.kt +35 -0
- package/nitrogen/generated/ios/CloudKitModule+autolinking.rb +60 -0
- package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Bridge.cpp +80 -0
- package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Bridge.hpp +340 -0
- package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Umbrella.hpp +74 -0
- package/nitrogen/generated/ios/CloudKitModuleAutolinking.mm +33 -0
- package/nitrogen/generated/ios/CloudKitModuleAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitModuleSpecSwift.hpp +150 -0
- package/nitrogen/generated/ios/swift/AccountInfoResult.swift +76 -0
- package/nitrogen/generated/ios/swift/DeleteRecordParams.swift +46 -0
- package/nitrogen/generated/ios/swift/FetchRecordParams.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_AccountInfoResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_QueryRecordsResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_SaveRecordResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_RecordResult_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitModuleSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitModuleSpec_cxx.swift +250 -0
- package/nitrogen/generated/ios/swift/QueryRecordsParams.swift +35 -0
- package/nitrogen/generated/ios/swift/QueryRecordsResult.swift +43 -0
- package/nitrogen/generated/ios/swift/RecordExistsParams.swift +46 -0
- package/nitrogen/generated/ios/swift/RecordResult.swift +90 -0
- package/nitrogen/generated/ios/swift/SaveRecordParams.swift +68 -0
- package/nitrogen/generated/ios/swift/SaveRecordResult.swift +46 -0
- package/nitrogen/generated/shared/c++/AccountInfoResult.hpp +76 -0
- package/nitrogen/generated/shared/c++/DeleteRecordParams.hpp +71 -0
- package/nitrogen/generated/shared/c++/FetchRecordParams.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitModuleSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitModuleSpec.hpp +95 -0
- package/nitrogen/generated/shared/c++/QueryRecordsParams.hpp +67 -0
- package/nitrogen/generated/shared/c++/QueryRecordsResult.hpp +69 -0
- package/nitrogen/generated/shared/c++/RecordExistsParams.hpp +71 -0
- package/nitrogen/generated/shared/c++/RecordResult.hpp +87 -0
- package/nitrogen/generated/shared/c++/SaveRecordParams.hpp +79 -0
- package/nitrogen/generated/shared/c++/SaveRecordResult.hpp +71 -0
- package/package.json +174 -0
- package/src/CloudKitModule.nitro.ts +64 -0
- package/src/index.tsx +8 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridCloudKitModuleSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridCloudKitModuleSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridCloudKitModuleSpec: public jni::HybridClass<JHybridCloudKitModuleSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridCloudKitModuleSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cloudkitmodule/HybridCloudKitModuleSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridCloudKitModuleSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridCloudKitModuleSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridCloudKitModuleSpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
void dispose() noexcept override;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
inline const jni::global_ref<JHybridCloudKitModuleSpec::javaobject>& getJavaPart() const noexcept {
|
|
47
|
+
return _javaPart;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Properties
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Methods
|
|
56
|
+
std::shared_ptr<Promise<bool>> isAvailable() override;
|
|
57
|
+
std::shared_ptr<Promise<AccountInfoResult>> getAccountInfo() override;
|
|
58
|
+
std::shared_ptr<Promise<SaveRecordResult>> saveRecord(const SaveRecordParams& params) override;
|
|
59
|
+
std::shared_ptr<Promise<std::optional<RecordResult>>> fetchRecord(const FetchRecordParams& params) override;
|
|
60
|
+
std::shared_ptr<Promise<bool>> deleteRecord(const DeleteRecordParams& params) override;
|
|
61
|
+
std::shared_ptr<Promise<bool>> recordExists(const RecordExistsParams& params) override;
|
|
62
|
+
std::shared_ptr<Promise<QueryRecordsResult>> queryRecords(const QueryRecordsParams& params) override;
|
|
63
|
+
|
|
64
|
+
private:
|
|
65
|
+
friend HybridBase;
|
|
66
|
+
using HybridBase::HybridBase;
|
|
67
|
+
jni::global_ref<JHybridCloudKitModuleSpec::javaobject> _javaPart;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JQueryRecordsParams.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "QueryRecordsParams.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "QueryRecordsParams" and the the Kotlin data class "QueryRecordsParams".
|
|
21
|
+
*/
|
|
22
|
+
struct JQueryRecordsParams final: public jni::JavaClass<JQueryRecordsParams> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cloudkitmodule/QueryRecordsParams;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct QueryRecordsParams by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
QueryRecordsParams toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldRecordType = clazz->getField<jni::JString>("recordType");
|
|
35
|
+
jni::local_ref<jni::JString> recordType = this->getFieldValue(fieldRecordType);
|
|
36
|
+
return QueryRecordsParams(
|
|
37
|
+
recordType->toStdString()
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/**
|
|
43
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
44
|
+
*/
|
|
45
|
+
[[maybe_unused]]
|
|
46
|
+
static jni::local_ref<JQueryRecordsParams::javaobject> fromCpp(const QueryRecordsParams& value) {
|
|
47
|
+
return newInstance(
|
|
48
|
+
jni::make_jstring(value.recordType)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JQueryRecordsResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "QueryRecordsResult.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JRecordResult.hpp"
|
|
14
|
+
#include "RecordResult.hpp"
|
|
15
|
+
#include <string>
|
|
16
|
+
#include <vector>
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The C++ JNI bridge between the C++ struct "QueryRecordsResult" and the the Kotlin data class "QueryRecordsResult".
|
|
24
|
+
*/
|
|
25
|
+
struct JQueryRecordsResult final: public jni::JavaClass<JQueryRecordsResult> {
|
|
26
|
+
public:
|
|
27
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cloudkitmodule/QueryRecordsResult;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Convert this Java/Kotlin-based struct to the C++ struct QueryRecordsResult by copying all values to C++.
|
|
32
|
+
*/
|
|
33
|
+
[[maybe_unused]]
|
|
34
|
+
[[nodiscard]]
|
|
35
|
+
QueryRecordsResult toCpp() const {
|
|
36
|
+
static const auto clazz = javaClassStatic();
|
|
37
|
+
static const auto fieldRecords = clazz->getField<jni::JArrayClass<JRecordResult>>("records");
|
|
38
|
+
jni::local_ref<jni::JArrayClass<JRecordResult>> records = this->getFieldValue(fieldRecords);
|
|
39
|
+
return QueryRecordsResult(
|
|
40
|
+
[&]() {
|
|
41
|
+
size_t __size = records->size();
|
|
42
|
+
std::vector<RecordResult> __vector;
|
|
43
|
+
__vector.reserve(__size);
|
|
44
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
45
|
+
auto __element = records->getElement(__i);
|
|
46
|
+
__vector.push_back(__element->toCpp());
|
|
47
|
+
}
|
|
48
|
+
return __vector;
|
|
49
|
+
}()
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
/**
|
|
55
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
56
|
+
*/
|
|
57
|
+
[[maybe_unused]]
|
|
58
|
+
static jni::local_ref<JQueryRecordsResult::javaobject> fromCpp(const QueryRecordsResult& value) {
|
|
59
|
+
return newInstance(
|
|
60
|
+
[&]() {
|
|
61
|
+
size_t __size = value.records.size();
|
|
62
|
+
jni::local_ref<jni::JArrayClass<JRecordResult>> __array = jni::JArrayClass<JRecordResult>::newArray(__size);
|
|
63
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
64
|
+
const auto& __element = value.records[__i];
|
|
65
|
+
__array->setElement(__i, *JRecordResult::fromCpp(__element));
|
|
66
|
+
}
|
|
67
|
+
return __array;
|
|
68
|
+
}()
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JRecordExistsParams.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "RecordExistsParams.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "RecordExistsParams" and the the Kotlin data class "RecordExistsParams".
|
|
21
|
+
*/
|
|
22
|
+
struct JRecordExistsParams final: public jni::JavaClass<JRecordExistsParams> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cloudkitmodule/RecordExistsParams;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct RecordExistsParams by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
RecordExistsParams toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldRecordType = clazz->getField<jni::JString>("recordType");
|
|
35
|
+
jni::local_ref<jni::JString> recordType = this->getFieldValue(fieldRecordType);
|
|
36
|
+
static const auto fieldRecordID = clazz->getField<jni::JString>("recordID");
|
|
37
|
+
jni::local_ref<jni::JString> recordID = this->getFieldValue(fieldRecordID);
|
|
38
|
+
return RecordExistsParams(
|
|
39
|
+
recordType->toStdString(),
|
|
40
|
+
recordID->toStdString()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JRecordExistsParams::javaobject> fromCpp(const RecordExistsParams& value) {
|
|
50
|
+
return newInstance(
|
|
51
|
+
jni::make_jstring(value.recordType),
|
|
52
|
+
jni::make_jstring(value.recordID)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JRecordResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "RecordResult.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "RecordResult" and the the Kotlin data class "RecordResult".
|
|
21
|
+
*/
|
|
22
|
+
struct JRecordResult final: public jni::JavaClass<JRecordResult> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cloudkitmodule/RecordResult;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct RecordResult by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
RecordResult toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldRecordID = clazz->getField<jni::JString>("recordID");
|
|
35
|
+
jni::local_ref<jni::JString> recordID = this->getFieldValue(fieldRecordID);
|
|
36
|
+
static const auto fieldRecordType = clazz->getField<jni::JString>("recordType");
|
|
37
|
+
jni::local_ref<jni::JString> recordType = this->getFieldValue(fieldRecordType);
|
|
38
|
+
static const auto fieldData = clazz->getField<jni::JString>("data");
|
|
39
|
+
jni::local_ref<jni::JString> data = this->getFieldValue(fieldData);
|
|
40
|
+
static const auto fieldMeta = clazz->getField<jni::JString>("meta");
|
|
41
|
+
jni::local_ref<jni::JString> meta = this->getFieldValue(fieldMeta);
|
|
42
|
+
static const auto fieldCreatedAt = clazz->getField<double>("createdAt");
|
|
43
|
+
double createdAt = this->getFieldValue(fieldCreatedAt);
|
|
44
|
+
static const auto fieldModifiedAt = clazz->getField<double>("modifiedAt");
|
|
45
|
+
double modifiedAt = this->getFieldValue(fieldModifiedAt);
|
|
46
|
+
return RecordResult(
|
|
47
|
+
recordID->toStdString(),
|
|
48
|
+
recordType->toStdString(),
|
|
49
|
+
data->toStdString(),
|
|
50
|
+
meta->toStdString(),
|
|
51
|
+
createdAt,
|
|
52
|
+
modifiedAt
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
/**
|
|
58
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
59
|
+
*/
|
|
60
|
+
[[maybe_unused]]
|
|
61
|
+
static jni::local_ref<JRecordResult::javaobject> fromCpp(const RecordResult& value) {
|
|
62
|
+
return newInstance(
|
|
63
|
+
jni::make_jstring(value.recordID),
|
|
64
|
+
jni::make_jstring(value.recordType),
|
|
65
|
+
jni::make_jstring(value.data),
|
|
66
|
+
jni::make_jstring(value.meta),
|
|
67
|
+
value.createdAt,
|
|
68
|
+
value.modifiedAt
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JSaveRecordParams.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "SaveRecordParams.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "SaveRecordParams" and the the Kotlin data class "SaveRecordParams".
|
|
21
|
+
*/
|
|
22
|
+
struct JSaveRecordParams final: public jni::JavaClass<JSaveRecordParams> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cloudkitmodule/SaveRecordParams;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct SaveRecordParams by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
SaveRecordParams toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldRecordType = clazz->getField<jni::JString>("recordType");
|
|
35
|
+
jni::local_ref<jni::JString> recordType = this->getFieldValue(fieldRecordType);
|
|
36
|
+
static const auto fieldRecordID = clazz->getField<jni::JString>("recordID");
|
|
37
|
+
jni::local_ref<jni::JString> recordID = this->getFieldValue(fieldRecordID);
|
|
38
|
+
static const auto fieldData = clazz->getField<jni::JString>("data");
|
|
39
|
+
jni::local_ref<jni::JString> data = this->getFieldValue(fieldData);
|
|
40
|
+
static const auto fieldMeta = clazz->getField<jni::JString>("meta");
|
|
41
|
+
jni::local_ref<jni::JString> meta = this->getFieldValue(fieldMeta);
|
|
42
|
+
return SaveRecordParams(
|
|
43
|
+
recordType->toStdString(),
|
|
44
|
+
recordID->toStdString(),
|
|
45
|
+
data->toStdString(),
|
|
46
|
+
meta->toStdString()
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
53
|
+
*/
|
|
54
|
+
[[maybe_unused]]
|
|
55
|
+
static jni::local_ref<JSaveRecordParams::javaobject> fromCpp(const SaveRecordParams& value) {
|
|
56
|
+
return newInstance(
|
|
57
|
+
jni::make_jstring(value.recordType),
|
|
58
|
+
jni::make_jstring(value.recordID),
|
|
59
|
+
jni::make_jstring(value.data),
|
|
60
|
+
jni::make_jstring(value.meta)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JSaveRecordResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "SaveRecordResult.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "SaveRecordResult" and the the Kotlin data class "SaveRecordResult".
|
|
21
|
+
*/
|
|
22
|
+
struct JSaveRecordResult final: public jni::JavaClass<JSaveRecordResult> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cloudkitmodule/SaveRecordResult;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct SaveRecordResult by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
SaveRecordResult toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldRecordID = clazz->getField<jni::JString>("recordID");
|
|
35
|
+
jni::local_ref<jni::JString> recordID = this->getFieldValue(fieldRecordID);
|
|
36
|
+
static const auto fieldCreatedAt = clazz->getField<double>("createdAt");
|
|
37
|
+
double createdAt = this->getFieldValue(fieldCreatedAt);
|
|
38
|
+
return SaveRecordResult(
|
|
39
|
+
recordID->toStdString(),
|
|
40
|
+
createdAt
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JSaveRecordResult::javaobject> fromCpp(const SaveRecordResult& value) {
|
|
50
|
+
return newInstance(
|
|
51
|
+
jni::make_jstring(value.recordID),
|
|
52
|
+
value.createdAt
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#
|
|
2
|
+
# cloudkitmodule+autolinking.cmake
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/cloudkitmodule+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_CLOUDKITMODULE_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
cloudkitmodule PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/cloudkitmoduleOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridCloudKitModuleSpec.cpp
|
|
37
|
+
# Android-specific Nitrogen C++ sources
|
|
38
|
+
../nitrogen/generated/android/c++/JHybridCloudKitModuleSpec.cpp
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
42
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
43
|
+
target_compile_definitions(
|
|
44
|
+
cloudkitmodule PRIVATE
|
|
45
|
+
-DFOLLY_NO_CONFIG=1
|
|
46
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
47
|
+
-DFOLLY_USE_LIBCPP=1
|
|
48
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
49
|
+
-DFOLLY_MOBILE=1
|
|
50
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
51
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
52
|
+
# Once we target android-23 above, we can comment
|
|
53
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
54
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Add all libraries required by the generated specs
|
|
58
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
59
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
60
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
61
|
+
|
|
62
|
+
# Link all libraries together
|
|
63
|
+
target_link_libraries(
|
|
64
|
+
cloudkitmodule
|
|
65
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
66
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
67
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
71
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
72
|
+
target_link_libraries(
|
|
73
|
+
cloudkitmodule
|
|
74
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
75
|
+
)
|
|
76
|
+
else()
|
|
77
|
+
target_link_libraries(
|
|
78
|
+
cloudkitmodule
|
|
79
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
80
|
+
)
|
|
81
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// cloudkitmodule+autolinking.gradle
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/cloudkitmodule+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 cloudkitmodule is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// cloudkitmoduleOnLoad.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#ifndef BUILDING_CLOUDKITMODULE_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error cloudkitmoduleOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "cloudkitmoduleOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridCloudKitModuleSpec.hpp"
|
|
19
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
22
|
+
|
|
23
|
+
int initialize(JavaVM* vm) {
|
|
24
|
+
using namespace margelo::nitro;
|
|
25
|
+
using namespace margelo::nitro::cloudkitmodule;
|
|
26
|
+
using namespace facebook;
|
|
27
|
+
|
|
28
|
+
return facebook::jni::initialize(vm, [] {
|
|
29
|
+
// Register native JNI methods
|
|
30
|
+
margelo::nitro::cloudkitmodule::JHybridCloudKitModuleSpec::registerNatives();
|
|
31
|
+
|
|
32
|
+
// Register Nitro Hybrid Objects
|
|
33
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
34
|
+
"CloudKitModule",
|
|
35
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
36
|
+
static DefaultConstructableObject<JHybridCloudKitModuleSpec::javaobject> object("com/margelo/nitro/cloudkitmodule/CloudKitModule");
|
|
37
|
+
auto instance = object.create();
|
|
38
|
+
return instance->cthis()->shared();
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// cloudkitmoduleOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <jni.h>
|
|
9
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
10
|
+
|
|
11
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initializes the native (C++) part of cloudkitmodule, and autolinks all Hybrid Objects.
|
|
15
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
|
|
16
|
+
* Example:
|
|
17
|
+
* ```cpp (cpp-adapter.cpp)
|
|
18
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
+
* return margelo::nitro::cloudkitmodule::initialize(vm);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
int initialize(JavaVM* vm);
|
|
24
|
+
|
|
25
|
+
} // namespace margelo::nitro::cloudkitmodule
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/AccountInfoResult.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AccountInfoResult.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.cloudkitmodule
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.margelo.nitro.core.*
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "AccountInfoResult".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class AccountInfoResult
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
constructor(
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val status: Double,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val statusName: String,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val containerUserId: String?
|
|
33
|
+
) {
|
|
34
|
+
/* main constructor */
|
|
35
|
+
}
|