expo-facebook-analytics 1.0.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/README.md +242 -0
- package/android/build.gradle +60 -0
- package/android/src/main/java/com/nitrofbanalytics/HybridFacebookAnalytics.kt +139 -0
- package/app.plugin.js +1 -0
- package/expo-facebook-analytics.podspec +31 -0
- package/ios/HybridFacebookAnalytics.swift +135 -0
- package/lib/index.d.ts +58 -0
- package/lib/index.js +138 -0
- package/lib/specs/FacebookAnalytics.nitro.d.ts +20 -0
- package/lib/specs/FacebookAnalytics.nitro.js +2 -0
- package/lib/types.d.ts +65 -0
- package/lib/types.js +52 -0
- package/nitro.json +19 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroFBAnalytics+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroFBAnalytics+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroFBAnalyticsOnLoad.cpp +44 -0
- package/nitrogen/generated/android/NitroFBAnalyticsOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JHybridFacebookAnalyticsSpec.cpp +157 -0
- package/nitrogen/generated/android/c++/JHybridFacebookAnalyticsSpec.hpp +79 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitrofbanalytics/HybridFacebookAnalyticsSpec.kt +110 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitrofbanalytics/NitroFBAnalyticsOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroFBAnalytics+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroFBAnalytics-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/NitroFBAnalytics-Swift-Cxx-Bridge.hpp +171 -0
- package/nitrogen/generated/ios/NitroFBAnalytics-Swift-Cxx-Umbrella.hpp +47 -0
- package/nitrogen/generated/ios/NitroFBAnalyticsAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroFBAnalyticsAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridFacebookAnalyticsSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridFacebookAnalyticsSpecSwift.hpp +167 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/HybridFacebookAnalyticsSpec.swift +69 -0
- package/nitrogen/generated/ios/swift/HybridFacebookAnalyticsSpec_cxx.swift +410 -0
- package/nitrogen/generated/shared/c++/HybridFacebookAnalyticsSpec.cpp +34 -0
- package/nitrogen/generated/shared/c++/HybridFacebookAnalyticsSpec.hpp +78 -0
- package/package.json +66 -0
- package/plugin/build/index.d.ts +13 -0
- package/plugin/build/index.js +42 -0
- package/plugin/build/withFacebookAnalyticsAndroid.d.ts +14 -0
- package/plugin/build/withFacebookAnalyticsAndroid.js +67 -0
- package/plugin/build/withFacebookAnalyticsIOS.d.ts +16 -0
- package/plugin/build/withFacebookAnalyticsIOS.js +96 -0
- package/src/index.ts +161 -0
- package/src/specs/FacebookAnalytics.nitro.ts +47 -0
- package/src/types.ts +67 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridFacebookAnalyticsSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridFacebookAnalyticsSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridFacebookAnalyticsSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroFBAnalytics { class HybridFacebookAnalyticsSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <unordered_map>
|
|
19
|
+
#include <optional>
|
|
20
|
+
#include <NitroModules/Promise.hpp>
|
|
21
|
+
|
|
22
|
+
#include "NitroFBAnalytics-Swift-Cxx-Umbrella.hpp"
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::fbanalytics {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The C++ part of HybridFacebookAnalyticsSpec_cxx.swift.
|
|
28
|
+
*
|
|
29
|
+
* HybridFacebookAnalyticsSpecSwift (C++) accesses HybridFacebookAnalyticsSpec_cxx (Swift), and might
|
|
30
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
31
|
+
*
|
|
32
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
33
|
+
* the future, HybridFacebookAnalyticsSpec_cxx can directly inherit from the C++ class HybridFacebookAnalyticsSpec
|
|
34
|
+
* to simplify the whole structure and memory management.
|
|
35
|
+
*/
|
|
36
|
+
class HybridFacebookAnalyticsSpecSwift: public virtual HybridFacebookAnalyticsSpec {
|
|
37
|
+
public:
|
|
38
|
+
// Constructor from a Swift instance
|
|
39
|
+
explicit HybridFacebookAnalyticsSpecSwift(const NitroFBAnalytics::HybridFacebookAnalyticsSpec_cxx& swiftPart):
|
|
40
|
+
HybridObject(HybridFacebookAnalyticsSpec::TAG),
|
|
41
|
+
_swiftPart(swiftPart) { }
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
// Get the Swift part
|
|
45
|
+
inline NitroFBAnalytics::HybridFacebookAnalyticsSpec_cxx& getSwiftPart() noexcept {
|
|
46
|
+
return _swiftPart;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
51
|
+
return _swiftPart.getMemorySize();
|
|
52
|
+
}
|
|
53
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
54
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridFacebookAnalyticsSpecSwift>(other)) {
|
|
55
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
void dispose() noexcept override {
|
|
60
|
+
_swiftPart.dispose();
|
|
61
|
+
}
|
|
62
|
+
std::string toString() override {
|
|
63
|
+
return _swiftPart.toString();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public:
|
|
67
|
+
// Properties
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
// Methods
|
|
72
|
+
inline void logEvent(const std::string& eventName, double valueToSum, const std::unordered_map<std::string, std::string>& params) override {
|
|
73
|
+
auto __result = _swiftPart.logEvent(eventName, std::forward<decltype(valueToSum)>(valueToSum), params);
|
|
74
|
+
if (__result.hasError()) [[unlikely]] {
|
|
75
|
+
std::rethrow_exception(__result.error());
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
inline void logEventWithoutParams(const std::string& eventName, double valueToSum) override {
|
|
79
|
+
auto __result = _swiftPart.logEventWithoutParams(eventName, std::forward<decltype(valueToSum)>(valueToSum));
|
|
80
|
+
if (__result.hasError()) [[unlikely]] {
|
|
81
|
+
std::rethrow_exception(__result.error());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
inline void logPurchase(double amount, const std::string& currency, const std::unordered_map<std::string, std::string>& params) override {
|
|
85
|
+
auto __result = _swiftPart.logPurchase(std::forward<decltype(amount)>(amount), currency, params);
|
|
86
|
+
if (__result.hasError()) [[unlikely]] {
|
|
87
|
+
std::rethrow_exception(__result.error());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
inline void logPushNotificationOpen(const std::unordered_map<std::string, std::string>& payload) override {
|
|
91
|
+
auto __result = _swiftPart.logPushNotificationOpen(payload);
|
|
92
|
+
if (__result.hasError()) [[unlikely]] {
|
|
93
|
+
std::rethrow_exception(__result.error());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
inline void setUserID(const std::string& userID) override {
|
|
97
|
+
auto __result = _swiftPart.setUserID(userID);
|
|
98
|
+
if (__result.hasError()) [[unlikely]] {
|
|
99
|
+
std::rethrow_exception(__result.error());
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
inline void clearUserID() override {
|
|
103
|
+
auto __result = _swiftPart.clearUserID();
|
|
104
|
+
if (__result.hasError()) [[unlikely]] {
|
|
105
|
+
std::rethrow_exception(__result.error());
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
inline std::optional<std::string> getUserID() override {
|
|
109
|
+
auto __result = _swiftPart.getUserID();
|
|
110
|
+
if (__result.hasError()) [[unlikely]] {
|
|
111
|
+
std::rethrow_exception(__result.error());
|
|
112
|
+
}
|
|
113
|
+
auto __value = std::move(__result.value());
|
|
114
|
+
return __value;
|
|
115
|
+
}
|
|
116
|
+
inline void 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) override {
|
|
117
|
+
auto __result = _swiftPart.setUserData(email, firstName, lastName, phone, dateOfBirth, gender, city, state, zip, country);
|
|
118
|
+
if (__result.hasError()) [[unlikely]] {
|
|
119
|
+
std::rethrow_exception(__result.error());
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
inline std::shared_ptr<Promise<std::optional<std::string>>> getAnonymousID() override {
|
|
123
|
+
auto __result = _swiftPart.getAnonymousID();
|
|
124
|
+
if (__result.hasError()) [[unlikely]] {
|
|
125
|
+
std::rethrow_exception(__result.error());
|
|
126
|
+
}
|
|
127
|
+
auto __value = std::move(__result.value());
|
|
128
|
+
return __value;
|
|
129
|
+
}
|
|
130
|
+
inline std::shared_ptr<Promise<std::optional<std::string>>> getAdvertiserID() override {
|
|
131
|
+
auto __result = _swiftPart.getAdvertiserID();
|
|
132
|
+
if (__result.hasError()) [[unlikely]] {
|
|
133
|
+
std::rethrow_exception(__result.error());
|
|
134
|
+
}
|
|
135
|
+
auto __value = std::move(__result.value());
|
|
136
|
+
return __value;
|
|
137
|
+
}
|
|
138
|
+
inline void setFlushBehavior(const std::string& flushBehavior) override {
|
|
139
|
+
auto __result = _swiftPart.setFlushBehavior(flushBehavior);
|
|
140
|
+
if (__result.hasError()) [[unlikely]] {
|
|
141
|
+
std::rethrow_exception(__result.error());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
inline void flush() override {
|
|
145
|
+
auto __result = _swiftPart.flush();
|
|
146
|
+
if (__result.hasError()) [[unlikely]] {
|
|
147
|
+
std::rethrow_exception(__result.error());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
inline void setPushNotificationsDeviceToken(const std::string& token) override {
|
|
151
|
+
auto __result = _swiftPart.setPushNotificationsDeviceToken(token);
|
|
152
|
+
if (__result.hasError()) [[unlikely]] {
|
|
153
|
+
std::rethrow_exception(__result.error());
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
inline void setPushNotificationsRegistrationId(const std::string& registrationId) override {
|
|
157
|
+
auto __result = _swiftPart.setPushNotificationsRegistrationId(registrationId);
|
|
158
|
+
if (__result.hasError()) [[unlikely]] {
|
|
159
|
+
std::rethrow_exception(__result.error());
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private:
|
|
164
|
+
NitroFBAnalytics::HybridFacebookAnalyticsSpec_cxx _swiftPart;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
} // namespace margelo::nitro::fbanalytics
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_std__exception_ptr {
|
|
16
|
+
public typealias bridge = margelo.nitro.fbanalytics.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ error: Error) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
26
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
45
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__optional_std__string_.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: String?) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_std__optional_std__string_ {
|
|
16
|
+
public typealias bridge = margelo.nitro.fbanalytics.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: String?) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: String?) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: bridge.std__optional_std__string_) -> Void {
|
|
26
|
+
self.closure({ () -> String? in
|
|
27
|
+
if bridge.has_value_std__optional_std__string_(value) {
|
|
28
|
+
let __unwrapped = bridge.get_std__optional_std__string_(value)
|
|
29
|
+
return String(__unwrapped)
|
|
30
|
+
} else {
|
|
31
|
+
return nil
|
|
32
|
+
}
|
|
33
|
+
}())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
38
|
+
* This acquires one additional strong reference on the object!
|
|
39
|
+
*/
|
|
40
|
+
@inline(__always)
|
|
41
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
42
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Casts an unsafe pointer to a `Func_void_std__optional_std__string_`.
|
|
47
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_std__string_>`.
|
|
48
|
+
* This removes one strong reference from the object!
|
|
49
|
+
*/
|
|
50
|
+
@inline(__always)
|
|
51
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_std__string_ {
|
|
52
|
+
return Unmanaged<Func_void_std__optional_std__string_>.fromOpaque(pointer).takeRetainedValue()
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridFacebookAnalyticsSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridFacebookAnalyticsSpec``
|
|
12
|
+
public protocol HybridFacebookAnalyticsSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func logEvent(eventName: String, valueToSum: Double, params: Dictionary<String, String>) throws -> Void
|
|
18
|
+
func logEventWithoutParams(eventName: String, valueToSum: Double) throws -> Void
|
|
19
|
+
func logPurchase(amount: Double, currency: String, params: Dictionary<String, String>) throws -> Void
|
|
20
|
+
func logPushNotificationOpen(payload: Dictionary<String, String>) throws -> Void
|
|
21
|
+
func setUserID(userID: String) throws -> Void
|
|
22
|
+
func clearUserID() throws -> Void
|
|
23
|
+
func getUserID() throws -> String?
|
|
24
|
+
func setUserData(email: String?, firstName: String?, lastName: String?, phone: String?, dateOfBirth: String?, gender: String?, city: String?, state: String?, zip: String?, country: String?) throws -> Void
|
|
25
|
+
func getAnonymousID() throws -> Promise<String?>
|
|
26
|
+
func getAdvertiserID() throws -> Promise<String?>
|
|
27
|
+
func setFlushBehavior(flushBehavior: String) throws -> Void
|
|
28
|
+
func flush() throws -> Void
|
|
29
|
+
func setPushNotificationsDeviceToken(token: String) throws -> Void
|
|
30
|
+
func setPushNotificationsRegistrationId(registrationId: String) throws -> Void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public extension HybridFacebookAnalyticsSpec_protocol {
|
|
34
|
+
/// Default implementation of ``HybridObject.toString``
|
|
35
|
+
func toString() -> String {
|
|
36
|
+
return "[HybridObject FacebookAnalytics]"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// See ``HybridFacebookAnalyticsSpec``
|
|
41
|
+
open class HybridFacebookAnalyticsSpec_base {
|
|
42
|
+
private weak var cxxWrapper: HybridFacebookAnalyticsSpec_cxx? = nil
|
|
43
|
+
public init() { }
|
|
44
|
+
public func getCxxWrapper() -> HybridFacebookAnalyticsSpec_cxx {
|
|
45
|
+
#if DEBUG
|
|
46
|
+
guard self is any HybridFacebookAnalyticsSpec else {
|
|
47
|
+
fatalError("`self` is not a `HybridFacebookAnalyticsSpec`! Did you accidentally inherit from `HybridFacebookAnalyticsSpec_base` instead of `HybridFacebookAnalyticsSpec`?")
|
|
48
|
+
}
|
|
49
|
+
#endif
|
|
50
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
51
|
+
return cxxWrapper
|
|
52
|
+
} else {
|
|
53
|
+
let cxxWrapper = HybridFacebookAnalyticsSpec_cxx(self as! any HybridFacebookAnalyticsSpec)
|
|
54
|
+
self.cxxWrapper = cxxWrapper
|
|
55
|
+
return cxxWrapper
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A Swift base-protocol representing the FacebookAnalytics HybridObject.
|
|
62
|
+
* Implement this protocol to create Swift-based instances of FacebookAnalytics.
|
|
63
|
+
* ```swift
|
|
64
|
+
* class HybridFacebookAnalytics : HybridFacebookAnalyticsSpec {
|
|
65
|
+
* // ...
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
public typealias HybridFacebookAnalyticsSpec = HybridFacebookAnalyticsSpec_protocol & HybridFacebookAnalyticsSpec_base
|