@crumbsdk/react-native 0.0.1-rc.3

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.
Files changed (67) hide show
  1. package/CrumbReactNative.podspec +38 -0
  2. package/LICENSE +201 -0
  3. package/README.md +109 -0
  4. package/android/CMakeLists.txt +20 -0
  5. package/android/build.gradle +118 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +10 -0
  8. package/android/src/main/java/com/margelo/nitro/crumbsdk/reactnative/CrumbReactNative.kt +228 -0
  9. package/android/src/main/java/com/margelo/nitro/crumbsdk/reactnative/ReactNativePackage.kt +22 -0
  10. package/ios/CrumbReactNative.swift +283 -0
  11. package/lib/module/CrumbReactNative.nitro.js +4 -0
  12. package/lib/module/CrumbReactNative.nitro.js.map +1 -0
  13. package/lib/module/NativeCrumbReactNative.js +5 -0
  14. package/lib/module/NativeCrumbReactNative.js.map +1 -0
  15. package/lib/module/NativeCrumbReactNative.web.js +18 -0
  16. package/lib/module/NativeCrumbReactNative.web.js.map +1 -0
  17. package/lib/module/index.js +60 -0
  18. package/lib/module/index.js.map +1 -0
  19. package/lib/module/log-buffer.js +200 -0
  20. package/lib/module/log-buffer.js.map +1 -0
  21. package/lib/module/package.json +1 -0
  22. package/lib/module/types.js +2 -0
  23. package/lib/module/types.js.map +1 -0
  24. package/lib/typescript/package.json +1 -0
  25. package/lib/typescript/src/CrumbReactNative.nitro.d.ts +12 -0
  26. package/lib/typescript/src/CrumbReactNative.nitro.d.ts.map +1 -0
  27. package/lib/typescript/src/NativeCrumbReactNative.d.ts +4 -0
  28. package/lib/typescript/src/NativeCrumbReactNative.d.ts.map +1 -0
  29. package/lib/typescript/src/NativeCrumbReactNative.web.d.ts +4 -0
  30. package/lib/typescript/src/NativeCrumbReactNative.web.d.ts.map +1 -0
  31. package/lib/typescript/src/index.d.ts +19 -0
  32. package/lib/typescript/src/index.d.ts.map +1 -0
  33. package/lib/typescript/src/log-buffer.d.ts +8 -0
  34. package/lib/typescript/src/log-buffer.d.ts.map +1 -0
  35. package/lib/typescript/src/types.d.ts +55 -0
  36. package/lib/typescript/src/types.d.ts.map +1 -0
  37. package/nitro.json +24 -0
  38. package/nitrogen/generated/.gitattributes +1 -0
  39. package/nitrogen/generated/android/c++/JHybridCrumbReactNativeSpec.cpp +94 -0
  40. package/nitrogen/generated/android/c++/JHybridCrumbReactNativeSpec.hpp +67 -0
  41. package/nitrogen/generated/android/crumbsdk_reactnative+autolinking.cmake +81 -0
  42. package/nitrogen/generated/android/crumbsdk_reactnative+autolinking.gradle +27 -0
  43. package/nitrogen/generated/android/crumbsdk_reactnativeOnLoad.cpp +54 -0
  44. package/nitrogen/generated/android/crumbsdk_reactnativeOnLoad.hpp +34 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/crumbsdk/reactnative/HybridCrumbReactNativeSpec.kt +73 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/crumbsdk/reactnative/crumbsdk_reactnativeOnLoad.kt +35 -0
  47. package/nitrogen/generated/ios/CrumbReactNative+autolinking.rb +62 -0
  48. package/nitrogen/generated/ios/CrumbReactNative-Swift-Cxx-Bridge.cpp +49 -0
  49. package/nitrogen/generated/ios/CrumbReactNative-Swift-Cxx-Bridge.hpp +119 -0
  50. package/nitrogen/generated/ios/CrumbReactNative-Swift-Cxx-Umbrella.hpp +45 -0
  51. package/nitrogen/generated/ios/CrumbReactNativeAutolinking.mm +33 -0
  52. package/nitrogen/generated/ios/CrumbReactNativeAutolinking.swift +26 -0
  53. package/nitrogen/generated/ios/c++/HybridCrumbReactNativeSpecSwift.cpp +11 -0
  54. package/nitrogen/generated/ios/c++/HybridCrumbReactNativeSpecSwift.hpp +109 -0
  55. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  56. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  57. package/nitrogen/generated/ios/swift/HybridCrumbReactNativeSpec.swift +59 -0
  58. package/nitrogen/generated/ios/swift/HybridCrumbReactNativeSpec_cxx.swift +197 -0
  59. package/nitrogen/generated/shared/c++/HybridCrumbReactNativeSpec.cpp +25 -0
  60. package/nitrogen/generated/shared/c++/HybridCrumbReactNativeSpec.hpp +67 -0
  61. package/package.json +138 -0
  62. package/src/CrumbReactNative.nitro.ts +12 -0
  63. package/src/NativeCrumbReactNative.ts +6 -0
  64. package/src/NativeCrumbReactNative.web.ts +20 -0
  65. package/src/index.ts +115 -0
  66. package/src/log-buffer.ts +265 -0
  67. package/src/types.ts +70 -0
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// crumbsdk_reactnative+autolinking.gradle
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 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/crumbsdk_reactnative+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 crumbsdk_reactnative 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,54 @@
1
+ ///
2
+ /// crumbsdk_reactnativeOnLoad.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
+ #ifndef BUILDING_CRUMBSDKREACTNATIVE_WITH_GENERATED_CMAKE_PROJECT
9
+ #error crumbsdk_reactnativeOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "crumbsdk_reactnativeOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridCrumbReactNativeSpec.hpp"
19
+ #include <NitroModules/DefaultConstructableObject.hpp>
20
+
21
+ namespace margelo::nitro::crumbsdk_reactnative {
22
+
23
+ int initialize(JavaVM* vm) {
24
+ return facebook::jni::initialize(vm, []() {
25
+ ::margelo::nitro::crumbsdk_reactnative::registerAllNatives();
26
+ });
27
+ }
28
+
29
+ struct JHybridCrumbReactNativeSpecImpl: public jni::JavaClass<JHybridCrumbReactNativeSpecImpl, JHybridCrumbReactNativeSpec::JavaPart> {
30
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/crumbsdk/reactnative/CrumbReactNative;";
31
+ static std::shared_ptr<JHybridCrumbReactNativeSpec> create() {
32
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridCrumbReactNativeSpecImpl::javaobject()>();
33
+ jni::local_ref<JHybridCrumbReactNativeSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
34
+ return javaPart->getJHybridCrumbReactNativeSpec();
35
+ }
36
+ };
37
+
38
+ void registerAllNatives() {
39
+ using namespace margelo::nitro;
40
+ using namespace margelo::nitro::crumbsdk_reactnative;
41
+
42
+ // Register native JNI methods
43
+ margelo::nitro::crumbsdk_reactnative::JHybridCrumbReactNativeSpec::CxxPart::registerNatives();
44
+
45
+ // Register Nitro Hybrid Objects
46
+ HybridObjectRegistry::registerHybridObjectConstructor(
47
+ "CrumbReactNative",
48
+ []() -> std::shared_ptr<HybridObject> {
49
+ return JHybridCrumbReactNativeSpecImpl::create();
50
+ }
51
+ );
52
+ }
53
+
54
+ } // namespace margelo::nitro::crumbsdk_reactnative
@@ -0,0 +1,34 @@
1
+ ///
2
+ /// crumbsdk_reactnativeOnLoad.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
+ #include <jni.h>
9
+ #include <functional>
10
+ #include <NitroModules/NitroDefines.hpp>
11
+
12
+ namespace margelo::nitro::crumbsdk_reactnative {
13
+
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
17
+ /**
18
+ * Register the native (C++) part of crumbsdk_reactnative, 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.
21
+ * Example:
22
+ * ```cpp (cpp-adapter.cpp)
23
+ * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all crumbsdk_reactnative HybridObjects
26
+ * margelo::nitro::crumbsdk_reactnative::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
29
+ * }
30
+ * ```
31
+ */
32
+ void registerAllNatives();
33
+
34
+ } // namespace margelo::nitro::crumbsdk_reactnative
@@ -0,0 +1,73 @@
1
+ ///
2
+ /// HybridCrumbReactNativeSpec.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.crumbsdk.reactnative
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+ import com.margelo.nitro.core.Promise
15
+ import com.margelo.nitro.core.HybridObject
16
+
17
+ /**
18
+ * A Kotlin class representing the CrumbReactNative HybridObject.
19
+ * Implement this abstract class to create Kotlin-based instances of CrumbReactNative.
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress(
24
+ "KotlinJniMissingFunction", "unused",
25
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
26
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
27
+ )
28
+ abstract class HybridCrumbReactNativeSpec: HybridObject() {
29
+ // Properties
30
+
31
+
32
+ // Methods
33
+ @DoNotStrip
34
+ @Keep
35
+ abstract fun start(configurationJson: String): Unit
36
+
37
+ @DoNotStrip
38
+ @Keep
39
+ abstract fun installReporter(): Promise<Boolean>
40
+
41
+ @DoNotStrip
42
+ @Keep
43
+ abstract fun show(): Promise<Boolean>
44
+
45
+ @DoNotStrip
46
+ @Keep
47
+ abstract fun addLog(entryJson: String): Unit
48
+
49
+ @DoNotStrip
50
+ @Keep
51
+ abstract fun clearLogs(): Unit
52
+
53
+ // Default implementation of `HybridObject.toString()`
54
+ override fun toString(): String {
55
+ return "[HybridObject CrumbReactNative]"
56
+ }
57
+
58
+ // C++ backing class
59
+ @DoNotStrip
60
+ @Keep
61
+ protected open class CxxPart(javaPart: HybridCrumbReactNativeSpec): HybridObject.CxxPart(javaPart) {
62
+ // C++ JHybridCrumbReactNativeSpec::CxxPart::initHybrid(...)
63
+ @FastNative
64
+ external override fun initHybrid(): HybridData
65
+ }
66
+ override fun createCxxPart(): CxxPart {
67
+ return CxxPart(this)
68
+ }
69
+
70
+ companion object {
71
+ protected const val TAG = "HybridCrumbReactNativeSpec"
72
+ }
73
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// crumbsdk_reactnativeOnLoad.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.crumbsdk.reactnative
9
+
10
+ import android.util.Log
11
+
12
+ internal class crumbsdk_reactnativeOnLoad {
13
+ companion object {
14
+ private const val TAG = "crumbsdk_reactnativeOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "crumbsdk_reactnative".
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 crumbsdk_reactnative C++ library...")
25
+ System.loadLibrary("crumbsdk_reactnative")
26
+ Log.i(TAG, "Successfully loaded crumbsdk_reactnative C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load crumbsdk_reactnative 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,62 @@
1
+ #
2
+ # CrumbReactNative+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/CrumbReactNative+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 CrumbReactNative 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/CrumbReactNative-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
+ # Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
60
+ "SWIFT_INSTALL_OBJC_HEADER" => "NO",
61
+ })
62
+ end
@@ -0,0 +1,49 @@
1
+ ///
2
+ /// CrumbReactNative-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 "CrumbReactNative-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "CrumbReactNative-Swift-Cxx-Umbrella.hpp"
12
+ #include "HybridCrumbReactNativeSpecSwift.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::crumbsdk_reactnative::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void(bool /* result */)>
18
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = CrumbReactNative::Func_void_bool::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)](bool 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 = CrumbReactNative::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<HybridCrumbReactNativeSpec>
34
+ std::shared_ptr<HybridCrumbReactNativeSpec> create_std__shared_ptr_HybridCrumbReactNativeSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
35
+ CrumbReactNative::HybridCrumbReactNativeSpec_cxx swiftPart = CrumbReactNative::HybridCrumbReactNativeSpec_cxx::fromUnsafe(swiftUnsafePointer);
36
+ return std::make_shared<margelo::nitro::crumbsdk_reactnative::HybridCrumbReactNativeSpecSwift>(swiftPart);
37
+ }
38
+ void* NON_NULL get_std__shared_ptr_HybridCrumbReactNativeSpec_(std__shared_ptr_HybridCrumbReactNativeSpec_ cppType) {
39
+ std::shared_ptr<margelo::nitro::crumbsdk_reactnative::HybridCrumbReactNativeSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::crumbsdk_reactnative::HybridCrumbReactNativeSpecSwift>(cppType);
40
+ #ifdef NITRO_DEBUG
41
+ if (swiftWrapper == nullptr) [[unlikely]] {
42
+ throw std::runtime_error("Class \"HybridCrumbReactNativeSpec\" is not implemented in Swift!");
43
+ }
44
+ #endif
45
+ CrumbReactNative::HybridCrumbReactNativeSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
46
+ return swiftPart.toUnsafe();
47
+ }
48
+
49
+ } // namespace margelo::nitro::crumbsdk_reactnative::bridge::swift
@@ -0,0 +1,119 @@
1
+ ///
2
+ /// CrumbReactNative-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 `HybridCrumbReactNativeSpec` to properly resolve imports.
12
+ namespace margelo::nitro::crumbsdk_reactnative { class HybridCrumbReactNativeSpec; }
13
+
14
+ // Forward declarations of Swift defined types
15
+ // Forward declaration of `HybridCrumbReactNativeSpec_cxx` to properly resolve imports.
16
+ namespace CrumbReactNative { class HybridCrumbReactNativeSpec_cxx; }
17
+
18
+ // Include C++ defined types
19
+ #include "HybridCrumbReactNativeSpec.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
+
27
+ /**
28
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
29
+ * as well as helper functions to interact with those C++ types from Swift.
30
+ */
31
+ namespace margelo::nitro::crumbsdk_reactnative::bridge::swift {
32
+
33
+ // pragma MARK: std::shared_ptr<Promise<bool>>
34
+ /**
35
+ * Specialized version of `std::shared_ptr<Promise<bool>>`.
36
+ */
37
+ using std__shared_ptr_Promise_bool__ = std::shared_ptr<Promise<bool>>;
38
+ inline std::shared_ptr<Promise<bool>> create_std__shared_ptr_Promise_bool__() noexcept {
39
+ return Promise<bool>::create();
40
+ }
41
+ inline PromiseHolder<bool> wrap_std__shared_ptr_Promise_bool__(std::shared_ptr<Promise<bool>> promise) noexcept {
42
+ return PromiseHolder<bool>(std::move(promise));
43
+ }
44
+
45
+ // pragma MARK: std::function<void(bool /* result */)>
46
+ /**
47
+ * Specialized version of `std::function<void(bool)>`.
48
+ */
49
+ using Func_void_bool = std::function<void(bool /* result */)>;
50
+ /**
51
+ * Wrapper class for a `std::function<void(bool / * result * /)>`, this can be used from Swift.
52
+ */
53
+ class Func_void_bool_Wrapper final {
54
+ public:
55
+ explicit Func_void_bool_Wrapper(std::function<void(bool /* result */)>&& func): _function(std::make_unique<std::function<void(bool /* result */)>>(std::move(func))) {}
56
+ inline void call(bool result) const noexcept {
57
+ _function->operator()(result);
58
+ }
59
+ private:
60
+ std::unique_ptr<std::function<void(bool /* result */)>> _function;
61
+ } SWIFT_NONCOPYABLE;
62
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
63
+ inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
64
+ return Func_void_bool_Wrapper(std::move(value));
65
+ }
66
+
67
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
68
+ /**
69
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
70
+ */
71
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
72
+ /**
73
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
74
+ */
75
+ class Func_void_std__exception_ptr_Wrapper final {
76
+ public:
77
+ 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))) {}
78
+ inline void call(std::exception_ptr error) const noexcept {
79
+ _function->operator()(error);
80
+ }
81
+ private:
82
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
83
+ } SWIFT_NONCOPYABLE;
84
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
85
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
86
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
87
+ }
88
+
89
+ // pragma MARK: std::shared_ptr<HybridCrumbReactNativeSpec>
90
+ /**
91
+ * Specialized version of `std::shared_ptr<HybridCrumbReactNativeSpec>`.
92
+ */
93
+ using std__shared_ptr_HybridCrumbReactNativeSpec_ = std::shared_ptr<HybridCrumbReactNativeSpec>;
94
+ std::shared_ptr<HybridCrumbReactNativeSpec> create_std__shared_ptr_HybridCrumbReactNativeSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
95
+ void* NON_NULL get_std__shared_ptr_HybridCrumbReactNativeSpec_(std__shared_ptr_HybridCrumbReactNativeSpec_ cppType);
96
+
97
+ // pragma MARK: std::weak_ptr<HybridCrumbReactNativeSpec>
98
+ using std__weak_ptr_HybridCrumbReactNativeSpec_ = std::weak_ptr<HybridCrumbReactNativeSpec>;
99
+ inline std__weak_ptr_HybridCrumbReactNativeSpec_ weakify_std__shared_ptr_HybridCrumbReactNativeSpec_(const std::shared_ptr<HybridCrumbReactNativeSpec>& strong) noexcept { return strong; }
100
+
101
+ // pragma MARK: Result<void>
102
+ using Result_void_ = Result<void>;
103
+ inline Result_void_ create_Result_void_() noexcept {
104
+ return Result<void>::withValue();
105
+ }
106
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
107
+ return Result<void>::withError(error);
108
+ }
109
+
110
+ // pragma MARK: Result<std::shared_ptr<Promise<bool>>>
111
+ using Result_std__shared_ptr_Promise_bool___ = Result<std::shared_ptr<Promise<bool>>>;
112
+ inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::shared_ptr<Promise<bool>>& value) noexcept {
113
+ return Result<std::shared_ptr<Promise<bool>>>::withValue(value);
114
+ }
115
+ inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::exception_ptr& error) noexcept {
116
+ return Result<std::shared_ptr<Promise<bool>>>::withError(error);
117
+ }
118
+
119
+ } // namespace margelo::nitro::crumbsdk_reactnative::bridge::swift
@@ -0,0 +1,45 @@
1
+ ///
2
+ /// CrumbReactNative-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 `HybridCrumbReactNativeSpec` to properly resolve imports.
12
+ namespace margelo::nitro::crumbsdk_reactnative { class HybridCrumbReactNativeSpec; }
13
+
14
+ // Include C++ defined types
15
+ #include "HybridCrumbReactNativeSpec.hpp"
16
+ #include <NitroModules/Promise.hpp>
17
+ #include <NitroModules/Result.hpp>
18
+ #include <exception>
19
+ #include <memory>
20
+ #include <string>
21
+
22
+ // C++ helpers for Swift
23
+ #include "CrumbReactNative-Swift-Cxx-Bridge.hpp"
24
+
25
+ // Common C++ types used in Swift
26
+ #include <NitroModules/ArrayBufferHolder.hpp>
27
+ #include <NitroModules/AnyMapUtils.hpp>
28
+ #include <NitroModules/RuntimeError.hpp>
29
+ #include <NitroModules/DateToChronoDate.hpp>
30
+
31
+ // Forward declarations of Swift defined types
32
+ // Forward declaration of `HybridCrumbReactNativeSpec_cxx` to properly resolve imports.
33
+ namespace CrumbReactNative { class HybridCrumbReactNativeSpec_cxx; }
34
+
35
+ // Include Swift defined types
36
+ #if __has_include("CrumbReactNative-Swift.h")
37
+ // This header is generated by Xcode/Swift on every app build.
38
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "CrumbReactNative".
39
+ #include "CrumbReactNative-Swift.h"
40
+ // Same as above, but used when building with frameworks (`use_frameworks`)
41
+ #elif __has_include(<CrumbReactNative/CrumbReactNative-Swift.h>)
42
+ #include <CrumbReactNative/CrumbReactNative-Swift.h>
43
+ #else
44
+ #error CrumbReactNative's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "CrumbReactNative", and try building the app first.
45
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// CrumbReactNativeAutolinking.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 "CrumbReactNative-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridCrumbReactNativeSpecSwift.hpp"
14
+
15
+ @interface CrumbReactNativeAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation CrumbReactNativeAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::crumbsdk_reactnative;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "CrumbReactNative",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridCrumbReactNativeSpec> hybridObject = CrumbReactNative::CrumbReactNativeAutolinking::createCrumbReactNative();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// CrumbReactNativeAutolinking.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 CrumbReactNativeAutolinking {
13
+ public typealias bridge = margelo.nitro.crumbsdk_reactnative.bridge.swift
14
+
15
+ public static func createCrumbReactNative() -> bridge.std__shared_ptr_HybridCrumbReactNativeSpec_ {
16
+ let hybridObject = CrumbReactNative()
17
+ return { () -> bridge.std__shared_ptr_HybridCrumbReactNativeSpec_ in
18
+ let __cxxWrapped = hybridObject.getCxxWrapper()
19
+ return __cxxWrapped.getCxxPart()
20
+ }()
21
+ }
22
+
23
+ public static func isCrumbReactNativeRecyclable() -> Bool {
24
+ return CrumbReactNative.self is any RecyclableView.Type
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridCrumbReactNativeSpecSwift.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 "HybridCrumbReactNativeSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::crumbsdk_reactnative {
11
+ } // namespace margelo::nitro::crumbsdk_reactnative