expo-facebook-analytics 1.0.3 → 1.0.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 +1 -1
- package/android/build.gradle +1 -1
- package/expo-facebook-analytics.podspec +1 -1
- package/nitrogen/generated/android/NitroFBAnalyticsOnLoad.cpp +26 -16
- package/nitrogen/generated/android/NitroFBAnalyticsOnLoad.hpp +13 -4
- package/nitrogen/generated/android/c++/JHybridFacebookAnalyticsSpec.cpp +32 -38
- package/nitrogen/generated/android/c++/JHybridFacebookAnalyticsSpec.hpp +19 -22
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitrofbanalytics/HybridFacebookAnalyticsSpec.kt +15 -18
- package/nitrogen/generated/ios/NitroFBAnalytics-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +0 -1
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +0 -1
- package/nitrogen/generated/ios/swift/HybridFacebookAnalyticsSpec.swift +0 -1
- package/nitrogen/generated/ios/swift/HybridFacebookAnalyticsSpec_cxx.swift +0 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install expo-facebook-analytics react-native-nitro-modules
|
|
|
25
25
|
### Peer Dependencies
|
|
26
26
|
|
|
27
27
|
- `react-native` >= 0.71
|
|
28
|
-
- `react-native-nitro-modules` >= 0.
|
|
28
|
+
- `react-native-nitro-modules` >= 0.35.0
|
|
29
29
|
- `expo` >= 55.0.0 _(optional, for config plugin)_
|
|
30
30
|
|
|
31
31
|
### iOS
|
package/android/build.gradle
CHANGED
|
@@ -56,5 +56,5 @@ repositories {
|
|
|
56
56
|
dependencies {
|
|
57
57
|
implementation 'com.facebook.react:react-native:+'
|
|
58
58
|
implementation 'com.margelo.nitro:nitro-modules:+'
|
|
59
|
-
implementation 'com.facebook.android:facebook-android-sdk:
|
|
59
|
+
implementation 'com.facebook.android:facebook-android-sdk:18.0.3'
|
|
60
60
|
}
|
|
@@ -21,24 +21,34 @@
|
|
|
21
21
|
namespace margelo::nitro::fbanalytics {
|
|
22
22
|
|
|
23
23
|
int initialize(JavaVM* vm) {
|
|
24
|
+
return facebook::jni::initialize(vm, []() {
|
|
25
|
+
::margelo::nitro::fbanalytics::registerAllNatives();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
struct JHybridFacebookAnalyticsSpecImpl: public jni::JavaClass<JHybridFacebookAnalyticsSpecImpl, JHybridFacebookAnalyticsSpec::JavaPart> {
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/nitrofbanalytics/HybridFacebookAnalytics;";
|
|
31
|
+
static std::shared_ptr<JHybridFacebookAnalyticsSpec> create() {
|
|
32
|
+
static auto constructorFn = javaClassStatic()->getConstructor<JHybridFacebookAnalyticsSpecImpl::javaobject()>();
|
|
33
|
+
jni::local_ref<JHybridFacebookAnalyticsSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
34
|
+
return javaPart->getJHybridFacebookAnalyticsSpec();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
void registerAllNatives() {
|
|
24
39
|
using namespace margelo::nitro;
|
|
25
40
|
using namespace margelo::nitro::fbanalytics;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
auto instance = object.create();
|
|
38
|
-
return instance->cthis()->shared();
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
});
|
|
41
|
+
|
|
42
|
+
// Register native JNI methods
|
|
43
|
+
margelo::nitro::fbanalytics::JHybridFacebookAnalyticsSpec::CxxPart::registerNatives();
|
|
44
|
+
|
|
45
|
+
// Register Nitro Hybrid Objects
|
|
46
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
47
|
+
"FacebookAnalytics",
|
|
48
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
49
|
+
return JHybridFacebookAnalyticsSpecImpl::create();
|
|
50
|
+
}
|
|
51
|
+
);
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
} // namespace margelo::nitro::fbanalytics
|
|
@@ -6,20 +6,29 @@
|
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
9
10
|
#include <NitroModules/NitroDefines.hpp>
|
|
10
11
|
|
|
11
12
|
namespace margelo::nitro::fbanalytics {
|
|
12
13
|
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`)
|
|
18
|
+
* Register the native (C++) part of NitroFBAnalytics, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
16
21
|
* Example:
|
|
17
22
|
* ```cpp (cpp-adapter.cpp)
|
|
18
23
|
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
-
* return
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all NitroFBAnalytics HybridObjects
|
|
26
|
+
* margelo::nitro::fbanalytics::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
20
29
|
* }
|
|
21
30
|
* ```
|
|
22
31
|
*/
|
|
23
|
-
|
|
32
|
+
void registerAllNatives();
|
|
24
33
|
|
|
25
34
|
} // namespace margelo::nitro::fbanalytics
|
|
@@ -17,37 +17,31 @@
|
|
|
17
17
|
|
|
18
18
|
namespace margelo::nitro::fbanalytics {
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
20
|
+
std::shared_ptr<JHybridFacebookAnalyticsSpec> JHybridFacebookAnalyticsSpec::JavaPart::getJHybridFacebookAnalyticsSpec() {
|
|
21
|
+
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
22
|
+
auto castHybridObject = std::dynamic_pointer_cast<JHybridFacebookAnalyticsSpec>(hybridObject);
|
|
23
|
+
if (castHybridObject == nullptr) [[unlikely]] {
|
|
24
|
+
throw std::runtime_error("Failed to downcast JHybridObject to JHybridFacebookAnalyticsSpec!");
|
|
25
|
+
}
|
|
26
|
+
return castHybridObject;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return method(_javaPart);
|
|
29
|
+
jni::local_ref<JHybridFacebookAnalyticsSpec::CxxPart::jhybriddata> JHybridFacebookAnalyticsSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
30
|
+
return makeCxxInstance(jThis);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
std::shared_ptr<JHybridObject> JHybridFacebookAnalyticsSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
34
|
+
auto castJavaPart = jni::dynamic_ref_cast<JHybridFacebookAnalyticsSpec::JavaPart>(javaPart);
|
|
35
|
+
if (castJavaPart == nullptr) [[unlikely]] {
|
|
36
|
+
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridFacebookAnalyticsSpec::JavaPart!");
|
|
38
37
|
}
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
void JHybridFacebookAnalyticsSpec::dispose() noexcept {
|
|
43
|
-
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
44
|
-
method(_javaPart);
|
|
38
|
+
return std::make_shared<JHybridFacebookAnalyticsSpec>(castJavaPart);
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
void JHybridFacebookAnalyticsSpec::CxxPart::registerNatives() {
|
|
42
|
+
registerHybrid({
|
|
43
|
+
makeNativeMethod("initHybrid", JHybridFacebookAnalyticsSpec::CxxPart::initHybrid),
|
|
44
|
+
});
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
// Properties
|
|
@@ -55,7 +49,7 @@ namespace margelo::nitro::fbanalytics {
|
|
|
55
49
|
|
|
56
50
|
// Methods
|
|
57
51
|
void JHybridFacebookAnalyticsSpec::logEvent(const std::string& eventName, double valueToSum, const std::unordered_map<std::string, std::string>& params) {
|
|
58
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* eventName */, double /* valueToSum */, jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* params */)>("logEvent");
|
|
52
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* eventName */, double /* valueToSum */, jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* params */)>("logEvent");
|
|
59
53
|
method(_javaPart, jni::make_jstring(eventName), valueToSum, [&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
|
|
60
54
|
auto __map = jni::JHashMap<jni::JString, jni::JString>::create(params.size());
|
|
61
55
|
for (const auto& __entry : params) {
|
|
@@ -65,11 +59,11 @@ namespace margelo::nitro::fbanalytics {
|
|
|
65
59
|
}());
|
|
66
60
|
}
|
|
67
61
|
void JHybridFacebookAnalyticsSpec::logEventWithoutParams(const std::string& eventName, double valueToSum) {
|
|
68
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* eventName */, double /* valueToSum */)>("logEventWithoutParams");
|
|
62
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* eventName */, double /* valueToSum */)>("logEventWithoutParams");
|
|
69
63
|
method(_javaPart, jni::make_jstring(eventName), valueToSum);
|
|
70
64
|
}
|
|
71
65
|
void JHybridFacebookAnalyticsSpec::logPurchase(double amount, const std::string& currency, const std::unordered_map<std::string, std::string>& params) {
|
|
72
|
-
static const auto method = javaClassStatic()->getMethod<void(double /* amount */, jni::alias_ref<jni::JString> /* currency */, jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* params */)>("logPurchase");
|
|
66
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* amount */, jni::alias_ref<jni::JString> /* currency */, jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* params */)>("logPurchase");
|
|
73
67
|
method(_javaPart, amount, jni::make_jstring(currency), [&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
|
|
74
68
|
auto __map = jni::JHashMap<jni::JString, jni::JString>::create(params.size());
|
|
75
69
|
for (const auto& __entry : params) {
|
|
@@ -79,7 +73,7 @@ namespace margelo::nitro::fbanalytics {
|
|
|
79
73
|
}());
|
|
80
74
|
}
|
|
81
75
|
void JHybridFacebookAnalyticsSpec::logPushNotificationOpen(const std::unordered_map<std::string, std::string>& payload) {
|
|
82
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* payload */)>("logPushNotificationOpen");
|
|
76
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JMap<jni::JString, jni::JString>> /* payload */)>("logPushNotificationOpen");
|
|
83
77
|
method(_javaPart, [&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
|
|
84
78
|
auto __map = jni::JHashMap<jni::JString, jni::JString>::create(payload.size());
|
|
85
79
|
for (const auto& __entry : payload) {
|
|
@@ -89,24 +83,24 @@ namespace margelo::nitro::fbanalytics {
|
|
|
89
83
|
}());
|
|
90
84
|
}
|
|
91
85
|
void JHybridFacebookAnalyticsSpec::setUserID(const std::string& userID) {
|
|
92
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* userID */)>("setUserID");
|
|
86
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* userID */)>("setUserID");
|
|
93
87
|
method(_javaPart, jni::make_jstring(userID));
|
|
94
88
|
}
|
|
95
89
|
void JHybridFacebookAnalyticsSpec::clearUserID() {
|
|
96
|
-
static const auto method = javaClassStatic()->getMethod<void()>("clearUserID");
|
|
90
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("clearUserID");
|
|
97
91
|
method(_javaPart);
|
|
98
92
|
}
|
|
99
93
|
std::optional<std::string> JHybridFacebookAnalyticsSpec::getUserID() {
|
|
100
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getUserID");
|
|
94
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getUserID");
|
|
101
95
|
auto __result = method(_javaPart);
|
|
102
96
|
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
103
97
|
}
|
|
104
98
|
void JHybridFacebookAnalyticsSpec::setUserData(const std::optional<std::string>& email, const std::optional<std::string>& firstName, const std::optional<std::string>& lastName, const std::optional<std::string>& phone, const std::optional<std::string>& dateOfBirth, const std::optional<std::string>& gender, const std::optional<std::string>& city, const std::optional<std::string>& state, const std::optional<std::string>& zip, const std::optional<std::string>& country) {
|
|
105
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* email */, jni::alias_ref<jni::JString> /* firstName */, jni::alias_ref<jni::JString> /* lastName */, jni::alias_ref<jni::JString> /* phone */, jni::alias_ref<jni::JString> /* dateOfBirth */, jni::alias_ref<jni::JString> /* gender */, jni::alias_ref<jni::JString> /* city */, jni::alias_ref<jni::JString> /* state */, jni::alias_ref<jni::JString> /* zip */, jni::alias_ref<jni::JString> /* country */)>("setUserData");
|
|
99
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* email */, jni::alias_ref<jni::JString> /* firstName */, jni::alias_ref<jni::JString> /* lastName */, jni::alias_ref<jni::JString> /* phone */, jni::alias_ref<jni::JString> /* dateOfBirth */, jni::alias_ref<jni::JString> /* gender */, jni::alias_ref<jni::JString> /* city */, jni::alias_ref<jni::JString> /* state */, jni::alias_ref<jni::JString> /* zip */, jni::alias_ref<jni::JString> /* country */)>("setUserData");
|
|
106
100
|
method(_javaPart, email.has_value() ? jni::make_jstring(email.value()) : nullptr, firstName.has_value() ? jni::make_jstring(firstName.value()) : nullptr, lastName.has_value() ? jni::make_jstring(lastName.value()) : nullptr, phone.has_value() ? jni::make_jstring(phone.value()) : nullptr, dateOfBirth.has_value() ? jni::make_jstring(dateOfBirth.value()) : nullptr, gender.has_value() ? jni::make_jstring(gender.value()) : nullptr, city.has_value() ? jni::make_jstring(city.value()) : nullptr, state.has_value() ? jni::make_jstring(state.value()) : nullptr, zip.has_value() ? jni::make_jstring(zip.value()) : nullptr, country.has_value() ? jni::make_jstring(country.value()) : nullptr);
|
|
107
101
|
}
|
|
108
102
|
std::shared_ptr<Promise<std::optional<std::string>>> JHybridFacebookAnalyticsSpec::getAnonymousID() {
|
|
109
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAnonymousID");
|
|
103
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAnonymousID");
|
|
110
104
|
auto __result = method(_javaPart);
|
|
111
105
|
return [&]() {
|
|
112
106
|
auto __promise = Promise<std::optional<std::string>>::create();
|
|
@@ -122,7 +116,7 @@ namespace margelo::nitro::fbanalytics {
|
|
|
122
116
|
}();
|
|
123
117
|
}
|
|
124
118
|
std::shared_ptr<Promise<std::optional<std::string>>> JHybridFacebookAnalyticsSpec::getAdvertiserID() {
|
|
125
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAdvertiserID");
|
|
119
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAdvertiserID");
|
|
126
120
|
auto __result = method(_javaPart);
|
|
127
121
|
return [&]() {
|
|
128
122
|
auto __promise = Promise<std::optional<std::string>>::create();
|
|
@@ -138,19 +132,19 @@ namespace margelo::nitro::fbanalytics {
|
|
|
138
132
|
}();
|
|
139
133
|
}
|
|
140
134
|
void JHybridFacebookAnalyticsSpec::setFlushBehavior(const std::string& flushBehavior) {
|
|
141
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* flushBehavior */)>("setFlushBehavior");
|
|
135
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* flushBehavior */)>("setFlushBehavior");
|
|
142
136
|
method(_javaPart, jni::make_jstring(flushBehavior));
|
|
143
137
|
}
|
|
144
138
|
void JHybridFacebookAnalyticsSpec::flush() {
|
|
145
|
-
static const auto method = javaClassStatic()->getMethod<void()>("flush");
|
|
139
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("flush");
|
|
146
140
|
method(_javaPart);
|
|
147
141
|
}
|
|
148
142
|
void JHybridFacebookAnalyticsSpec::setPushNotificationsDeviceToken(const std::string& token) {
|
|
149
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* token */)>("setPushNotificationsDeviceToken");
|
|
143
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* token */)>("setPushNotificationsDeviceToken");
|
|
150
144
|
method(_javaPart, jni::make_jstring(token));
|
|
151
145
|
}
|
|
152
146
|
void JHybridFacebookAnalyticsSpec::setPushNotificationsRegistrationId(const std::string& registrationId) {
|
|
153
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* registrationId */)>("setPushNotificationsRegistrationId");
|
|
147
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* registrationId */)>("setPushNotificationsRegistrationId");
|
|
154
148
|
method(_javaPart, jni::make_jstring(registrationId));
|
|
155
149
|
}
|
|
156
150
|
|
|
@@ -18,34 +18,33 @@ namespace margelo::nitro::fbanalytics {
|
|
|
18
18
|
|
|
19
19
|
using namespace facebook;
|
|
20
20
|
|
|
21
|
-
class JHybridFacebookAnalyticsSpec: public
|
|
22
|
-
public virtual HybridFacebookAnalyticsSpec {
|
|
21
|
+
class JHybridFacebookAnalyticsSpec: public virtual HybridFacebookAnalyticsSpec, public virtual JHybridObject {
|
|
23
22
|
public:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
HybridBase
|
|
33
|
-
|
|
23
|
+
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/nitrofbanalytics/HybridFacebookAnalyticsSpec;";
|
|
25
|
+
std::shared_ptr<JHybridFacebookAnalyticsSpec> getJHybridFacebookAnalyticsSpec();
|
|
26
|
+
};
|
|
27
|
+
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/nitrofbanalytics/HybridFacebookAnalyticsSpec$CxxPart;";
|
|
29
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
+
static void registerNatives();
|
|
31
|
+
using HybridBase::HybridBase;
|
|
32
|
+
protected:
|
|
33
|
+
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
+
};
|
|
34
35
|
|
|
35
36
|
public:
|
|
37
|
+
explicit JHybridFacebookAnalyticsSpec(const jni::local_ref<JHybridFacebookAnalyticsSpec::JavaPart>& javaPart):
|
|
38
|
+
HybridObject(HybridFacebookAnalyticsSpec::TAG),
|
|
39
|
+
JHybridObject(javaPart),
|
|
40
|
+
_javaPart(jni::make_global(javaPart)) {}
|
|
36
41
|
~JHybridFacebookAnalyticsSpec() override {
|
|
37
42
|
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
43
|
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
public:
|
|
42
|
-
|
|
43
|
-
bool equals(const std::shared_ptr<HybridObject>& other) override;
|
|
44
|
-
void dispose() noexcept override;
|
|
45
|
-
std::string toString() override;
|
|
46
|
-
|
|
47
|
-
public:
|
|
48
|
-
inline const jni::global_ref<JHybridFacebookAnalyticsSpec::javaobject>& getJavaPart() const noexcept {
|
|
47
|
+
inline const jni::global_ref<JHybridFacebookAnalyticsSpec::JavaPart>& getJavaPart() const noexcept {
|
|
49
48
|
return _javaPart;
|
|
50
49
|
}
|
|
51
50
|
|
|
@@ -71,9 +70,7 @@ namespace margelo::nitro::fbanalytics {
|
|
|
71
70
|
void setPushNotificationsRegistrationId(const std::string& registrationId) override;
|
|
72
71
|
|
|
73
72
|
private:
|
|
74
|
-
|
|
75
|
-
using HybridBase::HybridBase;
|
|
76
|
-
jni::global_ref<JHybridFacebookAnalyticsSpec::javaobject> _javaPart;
|
|
73
|
+
jni::global_ref<JHybridFacebookAnalyticsSpec::JavaPart> _javaPart;
|
|
77
74
|
};
|
|
78
75
|
|
|
79
76
|
} // namespace margelo::nitro::fbanalytics
|
|
@@ -25,23 +25,6 @@ import com.margelo.nitro.core.HybridObject
|
|
|
25
25
|
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
26
|
)
|
|
27
27
|
abstract class HybridFacebookAnalyticsSpec: HybridObject() {
|
|
28
|
-
@DoNotStrip
|
|
29
|
-
private var mHybridData: HybridData = initHybrid()
|
|
30
|
-
|
|
31
|
-
init {
|
|
32
|
-
super.updateNative(mHybridData)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override fun updateNative(hybridData: HybridData) {
|
|
36
|
-
mHybridData = hybridData
|
|
37
|
-
super.updateNative(hybridData)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Default implementation of `HybridObject.toString()`
|
|
41
|
-
override fun toString(): String {
|
|
42
|
-
return "[HybridObject FacebookAnalytics]"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
28
|
// Properties
|
|
46
29
|
|
|
47
30
|
|
|
@@ -102,7 +85,21 @@ abstract class HybridFacebookAnalyticsSpec: HybridObject() {
|
|
|
102
85
|
@Keep
|
|
103
86
|
abstract fun setPushNotificationsRegistrationId(registrationId: String): Unit
|
|
104
87
|
|
|
105
|
-
|
|
88
|
+
// Default implementation of `HybridObject.toString()`
|
|
89
|
+
override fun toString(): String {
|
|
90
|
+
return "[HybridObject FacebookAnalytics]"
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// C++ backing class
|
|
94
|
+
@DoNotStrip
|
|
95
|
+
@Keep
|
|
96
|
+
protected open class CxxPart(javaPart: HybridFacebookAnalyticsSpec): HybridObject.CxxPart(javaPart) {
|
|
97
|
+
// C++ JHybridFacebookAnalyticsSpec::CxxPart::initHybrid(...)
|
|
98
|
+
external override fun initHybrid(): HybridData
|
|
99
|
+
}
|
|
100
|
+
override fun createCxxPart(): CxxPart {
|
|
101
|
+
return CxxPart(this)
|
|
102
|
+
}
|
|
106
103
|
|
|
107
104
|
companion object {
|
|
108
105
|
protected const val TAG = "HybridFacebookAnalyticsSpec"
|
|
@@ -70,7 +70,7 @@ namespace margelo::nitro::fbanalytics::bridge::swift {
|
|
|
70
70
|
return optional.has_value();
|
|
71
71
|
}
|
|
72
72
|
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
73
|
-
return
|
|
73
|
+
return optional.value();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// pragma MARK: std::shared_ptr<Promise<std::optional<std::string>>>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-facebook-analytics",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "High-performance Facebook Analytics for React Native using Nitro Modules",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "*",
|
|
50
50
|
"react-native": "*",
|
|
51
|
-
"react-native-nitro-modules": ">=0.
|
|
51
|
+
"react-native-nitro-modules": ">=0.35.0",
|
|
52
52
|
"expo": ">=55.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@biomejs/biome": "2.4.5",
|
|
61
61
|
"@expo/config-plugins": "^55.0.6",
|
|
62
62
|
"@types/bun": "^1.3.10",
|
|
63
|
-
"nitrogen": "0.
|
|
64
|
-
"react-native-nitro-modules": "0.
|
|
63
|
+
"nitrogen": "0.35.0",
|
|
64
|
+
"react-native-nitro-modules": "0.35.0",
|
|
65
65
|
"typescript": "^5.9.3"
|
|
66
66
|
}
|
|
67
67
|
}
|