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,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridFacebookAnalyticsSpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridFacebookAnalyticsSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::fbanalytics {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridFacebookAnalyticsSpec: public jni::HybridClass<JHybridFacebookAnalyticsSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridFacebookAnalyticsSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/nitrofbanalytics/HybridFacebookAnalyticsSpec;";
|
|
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 JHybridFacebookAnalyticsSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridFacebookAnalyticsSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridFacebookAnalyticsSpec() 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
|
+
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 {
|
|
49
|
+
return _javaPart;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Properties
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
void logEvent(const std::string& eventName, double valueToSum, const std::unordered_map<std::string, std::string>& params) override;
|
|
59
|
+
void logEventWithoutParams(const std::string& eventName, double valueToSum) override;
|
|
60
|
+
void logPurchase(double amount, const std::string& currency, const std::unordered_map<std::string, std::string>& params) override;
|
|
61
|
+
void logPushNotificationOpen(const std::unordered_map<std::string, std::string>& payload) override;
|
|
62
|
+
void setUserID(const std::string& userID) override;
|
|
63
|
+
void clearUserID() override;
|
|
64
|
+
std::optional<std::string> getUserID() override;
|
|
65
|
+
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;
|
|
66
|
+
std::shared_ptr<Promise<std::optional<std::string>>> getAnonymousID() override;
|
|
67
|
+
std::shared_ptr<Promise<std::optional<std::string>>> getAdvertiserID() override;
|
|
68
|
+
void setFlushBehavior(const std::string& flushBehavior) override;
|
|
69
|
+
void flush() override;
|
|
70
|
+
void setPushNotificationsDeviceToken(const std::string& token) override;
|
|
71
|
+
void setPushNotificationsRegistrationId(const std::string& registrationId) override;
|
|
72
|
+
|
|
73
|
+
private:
|
|
74
|
+
friend HybridBase;
|
|
75
|
+
using HybridBase::HybridBase;
|
|
76
|
+
jni::global_ref<JHybridFacebookAnalyticsSpec::javaobject> _javaPart;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro::fbanalytics
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridFacebookAnalyticsSpec.kt
|
|
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
|
+
package com.margelo.nitro.com.nitrofbanalytics
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
import com.margelo.nitro.core.HybridObject
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A Kotlin class representing the FacebookAnalytics HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of FacebookAnalytics.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
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
|
+
// Properties
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Methods
|
|
49
|
+
@DoNotStrip
|
|
50
|
+
@Keep
|
|
51
|
+
abstract fun logEvent(eventName: String, valueToSum: Double, params: Map<String, String>): Unit
|
|
52
|
+
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
abstract fun logEventWithoutParams(eventName: String, valueToSum: Double): Unit
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
abstract fun logPurchase(amount: Double, currency: String, params: Map<String, String>): Unit
|
|
60
|
+
|
|
61
|
+
@DoNotStrip
|
|
62
|
+
@Keep
|
|
63
|
+
abstract fun logPushNotificationOpen(payload: Map<String, String>): Unit
|
|
64
|
+
|
|
65
|
+
@DoNotStrip
|
|
66
|
+
@Keep
|
|
67
|
+
abstract fun setUserID(userID: String): Unit
|
|
68
|
+
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
abstract fun clearUserID(): Unit
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
abstract fun getUserID(): String?
|
|
76
|
+
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
@Keep
|
|
79
|
+
abstract fun setUserData(email: String?, firstName: String?, lastName: String?, phone: String?, dateOfBirth: String?, gender: String?, city: String?, state: String?, zip: String?, country: String?): Unit
|
|
80
|
+
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
@Keep
|
|
83
|
+
abstract fun getAnonymousID(): Promise<String?>
|
|
84
|
+
|
|
85
|
+
@DoNotStrip
|
|
86
|
+
@Keep
|
|
87
|
+
abstract fun getAdvertiserID(): Promise<String?>
|
|
88
|
+
|
|
89
|
+
@DoNotStrip
|
|
90
|
+
@Keep
|
|
91
|
+
abstract fun setFlushBehavior(flushBehavior: String): Unit
|
|
92
|
+
|
|
93
|
+
@DoNotStrip
|
|
94
|
+
@Keep
|
|
95
|
+
abstract fun flush(): Unit
|
|
96
|
+
|
|
97
|
+
@DoNotStrip
|
|
98
|
+
@Keep
|
|
99
|
+
abstract fun setPushNotificationsDeviceToken(token: String): Unit
|
|
100
|
+
|
|
101
|
+
@DoNotStrip
|
|
102
|
+
@Keep
|
|
103
|
+
abstract fun setPushNotificationsRegistrationId(registrationId: String): Unit
|
|
104
|
+
|
|
105
|
+
private external fun initHybrid(): HybridData
|
|
106
|
+
|
|
107
|
+
companion object {
|
|
108
|
+
protected const val TAG = "HybridFacebookAnalyticsSpec"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroFBAnalyticsOnLoad.kt
|
|
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
|
+
package com.margelo.nitro.com.nitrofbanalytics
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class NitroFBAnalyticsOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "NitroFBAnalyticsOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "NitroFBAnalytics".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading NitroFBAnalytics C++ library...")
|
|
25
|
+
System.loadLibrary("NitroFBAnalytics")
|
|
26
|
+
Log.i(TAG, "Successfully loaded NitroFBAnalytics C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load NitroFBAnalytics C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroFBAnalytics+autolinking.rb
|
|
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
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroFBAnalytics+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroFBAnalytics is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroFBAnalytics-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroFBAnalytics-Swift-Cxx-Bridge.cpp
|
|
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
|
+
#include "NitroFBAnalytics-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridFacebookAnalyticsSpecSwift.hpp"
|
|
12
|
+
#include "NitroFBAnalytics-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::fbanalytics::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(const std::optional<std::string>& /* result */)>
|
|
18
|
+
Func_void_std__optional_std__string_ create_Func_void_std__optional_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = NitroFBAnalytics::Func_void_std__optional_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const std::optional<std::string>& result) mutable -> void {
|
|
21
|
+
swiftClosure.call(result);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
26
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = NitroFBAnalytics::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
29
|
+
swiftClosure.call(error);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::shared_ptr<HybridFacebookAnalyticsSpec>
|
|
34
|
+
std::shared_ptr<HybridFacebookAnalyticsSpec> create_std__shared_ptr_HybridFacebookAnalyticsSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
35
|
+
NitroFBAnalytics::HybridFacebookAnalyticsSpec_cxx swiftPart = NitroFBAnalytics::HybridFacebookAnalyticsSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
36
|
+
return std::make_shared<margelo::nitro::fbanalytics::HybridFacebookAnalyticsSpecSwift>(swiftPart);
|
|
37
|
+
}
|
|
38
|
+
void* NON_NULL get_std__shared_ptr_HybridFacebookAnalyticsSpec_(std__shared_ptr_HybridFacebookAnalyticsSpec_ cppType) {
|
|
39
|
+
std::shared_ptr<margelo::nitro::fbanalytics::HybridFacebookAnalyticsSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::fbanalytics::HybridFacebookAnalyticsSpecSwift>(cppType);
|
|
40
|
+
#ifdef NITRO_DEBUG
|
|
41
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
42
|
+
throw std::runtime_error("Class \"HybridFacebookAnalyticsSpec\" is not implemented in Swift!");
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
NitroFBAnalytics::HybridFacebookAnalyticsSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
46
|
+
return swiftPart.toUnsafe();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::fbanalytics::bridge::swift
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroFBAnalytics-Swift-Cxx-Bridge.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridFacebookAnalyticsSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::fbanalytics { class HybridFacebookAnalyticsSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridFacebookAnalyticsSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace NitroFBAnalytics { class HybridFacebookAnalyticsSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridFacebookAnalyticsSpec.hpp"
|
|
20
|
+
#include <NitroModules/Promise.hpp>
|
|
21
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
22
|
+
#include <NitroModules/Result.hpp>
|
|
23
|
+
#include <exception>
|
|
24
|
+
#include <functional>
|
|
25
|
+
#include <memory>
|
|
26
|
+
#include <optional>
|
|
27
|
+
#include <string>
|
|
28
|
+
#include <unordered_map>
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
32
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
33
|
+
*/
|
|
34
|
+
namespace margelo::nitro::fbanalytics::bridge::swift {
|
|
35
|
+
|
|
36
|
+
// pragma MARK: std::unordered_map<std::string, std::string>
|
|
37
|
+
/**
|
|
38
|
+
* Specialized version of `std::unordered_map<std::string, std::string>`.
|
|
39
|
+
*/
|
|
40
|
+
using std__unordered_map_std__string__std__string_ = std::unordered_map<std::string, std::string>;
|
|
41
|
+
inline std::unordered_map<std::string, std::string> create_std__unordered_map_std__string__std__string_(size_t size) noexcept {
|
|
42
|
+
std::unordered_map<std::string, std::string> map;
|
|
43
|
+
map.reserve(size);
|
|
44
|
+
return map;
|
|
45
|
+
}
|
|
46
|
+
inline std::vector<std::string> get_std__unordered_map_std__string__std__string__keys(const std__unordered_map_std__string__std__string_& map) noexcept {
|
|
47
|
+
std::vector<std::string> keys;
|
|
48
|
+
keys.reserve(map.size());
|
|
49
|
+
for (const auto& entry : map) {
|
|
50
|
+
keys.push_back(entry.first);
|
|
51
|
+
}
|
|
52
|
+
return keys;
|
|
53
|
+
}
|
|
54
|
+
inline std::string get_std__unordered_map_std__string__std__string__value(const std__unordered_map_std__string__std__string_& map, const std::string& key) noexcept {
|
|
55
|
+
return map.find(key)->second;
|
|
56
|
+
}
|
|
57
|
+
inline void emplace_std__unordered_map_std__string__std__string_(std__unordered_map_std__string__std__string_& map, const std::string& key, const std::string& value) noexcept {
|
|
58
|
+
map.emplace(key, value);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// pragma MARK: std::optional<std::string>
|
|
62
|
+
/**
|
|
63
|
+
* Specialized version of `std::optional<std::string>`.
|
|
64
|
+
*/
|
|
65
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
66
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
67
|
+
return std::optional<std::string>(value);
|
|
68
|
+
}
|
|
69
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
70
|
+
return optional.has_value();
|
|
71
|
+
}
|
|
72
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
73
|
+
return *optional;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// pragma MARK: std::shared_ptr<Promise<std::optional<std::string>>>
|
|
77
|
+
/**
|
|
78
|
+
* Specialized version of `std::shared_ptr<Promise<std::optional<std::string>>>`.
|
|
79
|
+
*/
|
|
80
|
+
using std__shared_ptr_Promise_std__optional_std__string___ = std::shared_ptr<Promise<std::optional<std::string>>>;
|
|
81
|
+
inline std::shared_ptr<Promise<std::optional<std::string>>> create_std__shared_ptr_Promise_std__optional_std__string___() noexcept {
|
|
82
|
+
return Promise<std::optional<std::string>>::create();
|
|
83
|
+
}
|
|
84
|
+
inline PromiseHolder<std::optional<std::string>> wrap_std__shared_ptr_Promise_std__optional_std__string___(std::shared_ptr<Promise<std::optional<std::string>>> promise) noexcept {
|
|
85
|
+
return PromiseHolder<std::optional<std::string>>(std::move(promise));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// pragma MARK: std::function<void(const std::optional<std::string>& /* result */)>
|
|
89
|
+
/**
|
|
90
|
+
* Specialized version of `std::function<void(const std::optional<std::string>&)>`.
|
|
91
|
+
*/
|
|
92
|
+
using Func_void_std__optional_std__string_ = std::function<void(const std::optional<std::string>& /* result */)>;
|
|
93
|
+
/**
|
|
94
|
+
* Wrapper class for a `std::function<void(const std::optional<std::string>& / * result * /)>`, this can be used from Swift.
|
|
95
|
+
*/
|
|
96
|
+
class Func_void_std__optional_std__string__Wrapper final {
|
|
97
|
+
public:
|
|
98
|
+
explicit Func_void_std__optional_std__string__Wrapper(std::function<void(const std::optional<std::string>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::optional<std::string>& /* result */)>>(std::move(func))) {}
|
|
99
|
+
inline void call(std::optional<std::string> result) const noexcept {
|
|
100
|
+
_function->operator()(result);
|
|
101
|
+
}
|
|
102
|
+
private:
|
|
103
|
+
std::unique_ptr<std::function<void(const std::optional<std::string>& /* result */)>> _function;
|
|
104
|
+
} SWIFT_NONCOPYABLE;
|
|
105
|
+
Func_void_std__optional_std__string_ create_Func_void_std__optional_std__string_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
106
|
+
inline Func_void_std__optional_std__string__Wrapper wrap_Func_void_std__optional_std__string_(Func_void_std__optional_std__string_ value) noexcept {
|
|
107
|
+
return Func_void_std__optional_std__string__Wrapper(std::move(value));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
111
|
+
/**
|
|
112
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
113
|
+
*/
|
|
114
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
115
|
+
/**
|
|
116
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
117
|
+
*/
|
|
118
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
119
|
+
public:
|
|
120
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
121
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
122
|
+
_function->operator()(error);
|
|
123
|
+
}
|
|
124
|
+
private:
|
|
125
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
126
|
+
} SWIFT_NONCOPYABLE;
|
|
127
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
128
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
129
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// pragma MARK: std::shared_ptr<HybridFacebookAnalyticsSpec>
|
|
133
|
+
/**
|
|
134
|
+
* Specialized version of `std::shared_ptr<HybridFacebookAnalyticsSpec>`.
|
|
135
|
+
*/
|
|
136
|
+
using std__shared_ptr_HybridFacebookAnalyticsSpec_ = std::shared_ptr<HybridFacebookAnalyticsSpec>;
|
|
137
|
+
std::shared_ptr<HybridFacebookAnalyticsSpec> create_std__shared_ptr_HybridFacebookAnalyticsSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
138
|
+
void* NON_NULL get_std__shared_ptr_HybridFacebookAnalyticsSpec_(std__shared_ptr_HybridFacebookAnalyticsSpec_ cppType);
|
|
139
|
+
|
|
140
|
+
// pragma MARK: std::weak_ptr<HybridFacebookAnalyticsSpec>
|
|
141
|
+
using std__weak_ptr_HybridFacebookAnalyticsSpec_ = std::weak_ptr<HybridFacebookAnalyticsSpec>;
|
|
142
|
+
inline std__weak_ptr_HybridFacebookAnalyticsSpec_ weakify_std__shared_ptr_HybridFacebookAnalyticsSpec_(const std::shared_ptr<HybridFacebookAnalyticsSpec>& strong) noexcept { return strong; }
|
|
143
|
+
|
|
144
|
+
// pragma MARK: Result<void>
|
|
145
|
+
using Result_void_ = Result<void>;
|
|
146
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
147
|
+
return Result<void>::withValue();
|
|
148
|
+
}
|
|
149
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
150
|
+
return Result<void>::withError(error);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// pragma MARK: Result<std::optional<std::string>>
|
|
154
|
+
using Result_std__optional_std__string__ = Result<std::optional<std::string>>;
|
|
155
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::optional<std::string>& value) noexcept {
|
|
156
|
+
return Result<std::optional<std::string>>::withValue(value);
|
|
157
|
+
}
|
|
158
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::exception_ptr& error) noexcept {
|
|
159
|
+
return Result<std::optional<std::string>>::withError(error);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::optional<std::string>>>>
|
|
163
|
+
using Result_std__shared_ptr_Promise_std__optional_std__string____ = Result<std::shared_ptr<Promise<std::optional<std::string>>>>;
|
|
164
|
+
inline Result_std__shared_ptr_Promise_std__optional_std__string____ create_Result_std__shared_ptr_Promise_std__optional_std__string____(const std::shared_ptr<Promise<std::optional<std::string>>>& value) noexcept {
|
|
165
|
+
return Result<std::shared_ptr<Promise<std::optional<std::string>>>>::withValue(value);
|
|
166
|
+
}
|
|
167
|
+
inline Result_std__shared_ptr_Promise_std__optional_std__string____ create_Result_std__shared_ptr_Promise_std__optional_std__string____(const std::exception_ptr& error) noexcept {
|
|
168
|
+
return Result<std::shared_ptr<Promise<std::optional<std::string>>>>::withError(error);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
} // namespace margelo::nitro::fbanalytics::bridge::swift
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroFBAnalytics-Swift-Cxx-Umbrella.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridFacebookAnalyticsSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::fbanalytics { class HybridFacebookAnalyticsSpec; }
|
|
13
|
+
|
|
14
|
+
// Include C++ defined types
|
|
15
|
+
#include "HybridFacebookAnalyticsSpec.hpp"
|
|
16
|
+
#include <NitroModules/Promise.hpp>
|
|
17
|
+
#include <NitroModules/Result.hpp>
|
|
18
|
+
#include <exception>
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include <optional>
|
|
21
|
+
#include <string>
|
|
22
|
+
#include <unordered_map>
|
|
23
|
+
|
|
24
|
+
// C++ helpers for Swift
|
|
25
|
+
#include "NitroFBAnalytics-Swift-Cxx-Bridge.hpp"
|
|
26
|
+
|
|
27
|
+
// Common C++ types used in Swift
|
|
28
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
29
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
30
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
31
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
32
|
+
|
|
33
|
+
// Forward declarations of Swift defined types
|
|
34
|
+
// Forward declaration of `HybridFacebookAnalyticsSpec_cxx` to properly resolve imports.
|
|
35
|
+
namespace NitroFBAnalytics { class HybridFacebookAnalyticsSpec_cxx; }
|
|
36
|
+
|
|
37
|
+
// Include Swift defined types
|
|
38
|
+
#if __has_include("NitroFBAnalytics-Swift.h")
|
|
39
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
40
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroFBAnalytics".
|
|
41
|
+
#include "NitroFBAnalytics-Swift.h"
|
|
42
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
43
|
+
#elif __has_include(<NitroFBAnalytics/NitroFBAnalytics-Swift.h>)
|
|
44
|
+
#include <NitroFBAnalytics/NitroFBAnalytics-Swift.h>
|
|
45
|
+
#else
|
|
46
|
+
#error NitroFBAnalytics's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroFBAnalytics", and try building the app first.
|
|
47
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroFBAnalyticsAutolinking.mm
|
|
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/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "NitroFBAnalytics-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridFacebookAnalyticsSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroFBAnalyticsAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroFBAnalyticsAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::fbanalytics;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"FacebookAnalytics",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridFacebookAnalyticsSpec> hybridObject = NitroFBAnalytics::NitroFBAnalyticsAutolinking::createFacebookAnalytics();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroFBAnalyticsAutolinking.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 NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NitroFBAnalyticsAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.fbanalytics.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createFacebookAnalytics() -> bridge.std__shared_ptr_HybridFacebookAnalyticsSpec_ {
|
|
16
|
+
let hybridObject = HybridFacebookAnalytics()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridFacebookAnalyticsSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isFacebookAnalyticsRecyclable() -> Bool {
|
|
24
|
+
return HybridFacebookAnalytics.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridFacebookAnalyticsSpecSwift.cpp
|
|
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
|
+
#include "HybridFacebookAnalyticsSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::fbanalytics {
|
|
11
|
+
} // namespace margelo::nitro::fbanalytics
|