react-native-carrot-quest 0.1.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.
Files changed (121) hide show
  1. package/CarrotQuest.podspec +34 -0
  2. package/LICENSE +20 -0
  3. package/README.md +457 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +136 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +11 -0
  8. package/android/src/main/java/com/margelo/nitro/carrotquest/CarrotQuest.kt +585 -0
  9. package/android/src/main/java/com/margelo/nitro/carrotquest/CarrotQuestPackage.kt +22 -0
  10. package/android/src/main/java/com/margelo/nitro/carrotquest/CarrotQuestSetup.kt +472 -0
  11. package/ios/CarrotQuest.swift +588 -0
  12. package/ios/CarrotQuestSetup.swift +333 -0
  13. package/lib/module/CarrotQuest.nitro.js +4 -0
  14. package/lib/module/CarrotQuest.nitro.js.map +1 -0
  15. package/lib/module/carrot-quest.js +136 -0
  16. package/lib/module/carrot-quest.js.map +1 -0
  17. package/lib/module/carrot-quest.native.js +155 -0
  18. package/lib/module/carrot-quest.native.js.map +1 -0
  19. package/lib/module/index.js +6 -0
  20. package/lib/module/index.js.map +1 -0
  21. package/lib/module/package.json +1 -0
  22. package/lib/module/subscriptions.js +76 -0
  23. package/lib/module/subscriptions.js.map +1 -0
  24. package/lib/typescript/package.json +1 -0
  25. package/lib/typescript/src/CarrotQuest.nitro.d.ts +394 -0
  26. package/lib/typescript/src/CarrotQuest.nitro.d.ts.map +1 -0
  27. package/lib/typescript/src/carrot-quest.d.ts +37 -0
  28. package/lib/typescript/src/carrot-quest.d.ts.map +1 -0
  29. package/lib/typescript/src/carrot-quest.native.d.ts +37 -0
  30. package/lib/typescript/src/carrot-quest.native.d.ts.map +1 -0
  31. package/lib/typescript/src/index.d.ts +6 -0
  32. package/lib/typescript/src/index.d.ts.map +1 -0
  33. package/lib/typescript/src/subscriptions.d.ts +32 -0
  34. package/lib/typescript/src/subscriptions.d.ts.map +1 -0
  35. package/nitro.json +23 -0
  36. package/nitrogen/generated/android/c++/JCarrotQuestEventValue.cpp +30 -0
  37. package/nitrogen/generated/android/c++/JCarrotQuestEventValue.hpp +83 -0
  38. package/nitrogen/generated/android/c++/JCarrotQuestLogCategory.hpp +76 -0
  39. package/nitrogen/generated/android/c++/JCarrotQuestLogEntry.hpp +100 -0
  40. package/nitrogen/generated/android/c++/JCarrotQuestLogLevel.hpp +70 -0
  41. package/nitrogen/generated/android/c++/JCarrotQuestProperty.hpp +74 -0
  42. package/nitrogen/generated/android/c++/JCarrotQuestPropertyKind.hpp +61 -0
  43. package/nitrogen/generated/android/c++/JCarrotQuestPropertyOperation.hpp +73 -0
  44. package/nitrogen/generated/android/c++/JCarrotQuestSetupOptions.hpp +94 -0
  45. package/nitrogen/generated/android/c++/JCarrotQuestTheme.hpp +64 -0
  46. package/nitrogen/generated/android/c++/JCarrotQuestUrlSource.hpp +64 -0
  47. package/nitrogen/generated/android/c++/JCarrotQuestUserProperties.hpp +84 -0
  48. package/nitrogen/generated/android/c++/JFunc_void_CarrotQuestLogEntry.hpp +84 -0
  49. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
  50. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  51. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  52. package/nitrogen/generated/android/c++/JHybridCarrotQuestSpec.cpp +388 -0
  53. package/nitrogen/generated/android/c++/JHybridCarrotQuestSpec.hpp +96 -0
  54. package/nitrogen/generated/android/carrotquest+autolinking.cmake +82 -0
  55. package/nitrogen/generated/android/carrotquest+autolinking.gradle +27 -0
  56. package/nitrogen/generated/android/carrotquestOnLoad.cpp +62 -0
  57. package/nitrogen/generated/android/carrotquestOnLoad.hpp +34 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestEventValue.kt +75 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestLogCategory.kt +29 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestLogEntry.kt +81 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestLogLevel.kt +27 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestProperty.kt +66 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestPropertyKind.kt +24 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestPropertyOperation.kt +28 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestSetupOptions.kt +91 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestTheme.kt +25 -0
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestUrlSource.kt +25 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestUserProperties.kt +66 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_CarrotQuestLogEntry.kt +80 -0
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_bool.kt +80 -0
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_double.kt +80 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_std__string.kt +80 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/HybridCarrotQuestSpec.kt +209 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/carrotquestOnLoad.kt +35 -0
  75. package/nitrogen/generated/ios/CarrotQuest+autolinking.rb +62 -0
  76. package/nitrogen/generated/ios/CarrotQuest-Swift-Cxx-Bridge.cpp +97 -0
  77. package/nitrogen/generated/ios/CarrotQuest-Swift-Cxx-Bridge.hpp +637 -0
  78. package/nitrogen/generated/ios/CarrotQuest-Swift-Cxx-Umbrella.hpp +80 -0
  79. package/nitrogen/generated/ios/CarrotQuestAutolinking.mm +33 -0
  80. package/nitrogen/generated/ios/CarrotQuestAutolinking.swift +26 -0
  81. package/nitrogen/generated/ios/c++/HybridCarrotQuestSpecSwift.cpp +11 -0
  82. package/nitrogen/generated/ios/c++/HybridCarrotQuestSpecSwift.hpp +344 -0
  83. package/nitrogen/generated/ios/swift/CarrotQuestEventValue.swift +32 -0
  84. package/nitrogen/generated/ios/swift/CarrotQuestLogCategory.swift +64 -0
  85. package/nitrogen/generated/ios/swift/CarrotQuestLogEntry.swift +86 -0
  86. package/nitrogen/generated/ios/swift/CarrotQuestLogLevel.swift +56 -0
  87. package/nitrogen/generated/ios/swift/CarrotQuestProperty.swift +56 -0
  88. package/nitrogen/generated/ios/swift/CarrotQuestPropertyKind.swift +44 -0
  89. package/nitrogen/generated/ios/swift/CarrotQuestPropertyOperation.swift +60 -0
  90. package/nitrogen/generated/ios/swift/CarrotQuestSetupOptions.swift +172 -0
  91. package/nitrogen/generated/ios/swift/CarrotQuestTheme.swift +48 -0
  92. package/nitrogen/generated/ios/swift/CarrotQuestUrlSource.swift +48 -0
  93. package/nitrogen/generated/ios/swift/CarrotQuestUserProperties.swift +110 -0
  94. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  95. package/nitrogen/generated/ios/swift/Func_void_CarrotQuestLogEntry.swift +46 -0
  96. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  97. package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
  98. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  99. package/nitrogen/generated/ios/swift/Func_void_std__optional_double_.swift +53 -0
  100. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +53 -0
  101. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  102. package/nitrogen/generated/ios/swift/HybridCarrotQuestSpec.swift +88 -0
  103. package/nitrogen/generated/ios/swift/HybridCarrotQuestSpec_cxx.swift +674 -0
  104. package/nitrogen/generated/shared/c++/CarrotQuestLogCategory.hpp +100 -0
  105. package/nitrogen/generated/shared/c++/CarrotQuestLogEntry.hpp +114 -0
  106. package/nitrogen/generated/shared/c++/CarrotQuestLogLevel.hpp +92 -0
  107. package/nitrogen/generated/shared/c++/CarrotQuestProperty.hpp +101 -0
  108. package/nitrogen/generated/shared/c++/CarrotQuestPropertyKind.hpp +80 -0
  109. package/nitrogen/generated/shared/c++/CarrotQuestPropertyOperation.hpp +96 -0
  110. package/nitrogen/generated/shared/c++/CarrotQuestSetupOptions.hpp +121 -0
  111. package/nitrogen/generated/shared/c++/CarrotQuestTheme.hpp +84 -0
  112. package/nitrogen/generated/shared/c++/CarrotQuestUrlSource.hpp +84 -0
  113. package/nitrogen/generated/shared/c++/CarrotQuestUserProperties.hpp +97 -0
  114. package/nitrogen/generated/shared/c++/HybridCarrotQuestSpec.cpp +55 -0
  115. package/nitrogen/generated/shared/c++/HybridCarrotQuestSpec.hpp +118 -0
  116. package/package.json +140 -0
  117. package/src/CarrotQuest.nitro.ts +493 -0
  118. package/src/carrot-quest.native.tsx +241 -0
  119. package/src/carrot-quest.tsx +207 -0
  120. package/src/index.tsx +57 -0
  121. package/src/subscriptions.ts +83 -0
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// CarrotQuest-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 `CarrotQuestLogCategory` to properly resolve imports.
12
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestLogCategory; }
13
+ // Forward declaration of `CarrotQuestLogEntry` to properly resolve imports.
14
+ namespace margelo::nitro::carrotquest { struct CarrotQuestLogEntry; }
15
+ // Forward declaration of `CarrotQuestLogLevel` to properly resolve imports.
16
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestLogLevel; }
17
+ // Forward declaration of `CarrotQuestPropertyKind` to properly resolve imports.
18
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestPropertyKind; }
19
+ // Forward declaration of `CarrotQuestPropertyOperation` to properly resolve imports.
20
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestPropertyOperation; }
21
+ // Forward declaration of `CarrotQuestProperty` to properly resolve imports.
22
+ namespace margelo::nitro::carrotquest { struct CarrotQuestProperty; }
23
+ // Forward declaration of `CarrotQuestSetupOptions` to properly resolve imports.
24
+ namespace margelo::nitro::carrotquest { struct CarrotQuestSetupOptions; }
25
+ // Forward declaration of `CarrotQuestTheme` to properly resolve imports.
26
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestTheme; }
27
+ // Forward declaration of `CarrotQuestUrlSource` to properly resolve imports.
28
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestUrlSource; }
29
+ // Forward declaration of `CarrotQuestUserProperties` to properly resolve imports.
30
+ namespace margelo::nitro::carrotquest { struct CarrotQuestUserProperties; }
31
+ // Forward declaration of `HybridCarrotQuestSpec` to properly resolve imports.
32
+ namespace margelo::nitro::carrotquest { class HybridCarrotQuestSpec; }
33
+
34
+ // Include C++ defined types
35
+ #include "CarrotQuestLogCategory.hpp"
36
+ #include "CarrotQuestLogEntry.hpp"
37
+ #include "CarrotQuestLogLevel.hpp"
38
+ #include "CarrotQuestProperty.hpp"
39
+ #include "CarrotQuestPropertyKind.hpp"
40
+ #include "CarrotQuestPropertyOperation.hpp"
41
+ #include "CarrotQuestSetupOptions.hpp"
42
+ #include "CarrotQuestTheme.hpp"
43
+ #include "CarrotQuestUrlSource.hpp"
44
+ #include "CarrotQuestUserProperties.hpp"
45
+ #include "HybridCarrotQuestSpec.hpp"
46
+ #include <NitroModules/Promise.hpp>
47
+ #include <NitroModules/Result.hpp>
48
+ #include <exception>
49
+ #include <functional>
50
+ #include <memory>
51
+ #include <optional>
52
+ #include <string>
53
+ #include <unordered_map>
54
+ #include <variant>
55
+ #include <vector>
56
+
57
+ // C++ helpers for Swift
58
+ #include "CarrotQuest-Swift-Cxx-Bridge.hpp"
59
+
60
+ // Common C++ types used in Swift
61
+ #include <NitroModules/ArrayBufferHolder.hpp>
62
+ #include <NitroModules/AnyMapUtils.hpp>
63
+ #include <NitroModules/RuntimeError.hpp>
64
+ #include <NitroModules/DateToChronoDate.hpp>
65
+
66
+ // Forward declarations of Swift defined types
67
+ // Forward declaration of `HybridCarrotQuestSpec_cxx` to properly resolve imports.
68
+ namespace CarrotQuest { class HybridCarrotQuestSpec_cxx; }
69
+
70
+ // Include Swift defined types
71
+ #if __has_include("CarrotQuest-Swift.h")
72
+ // This header is generated by Xcode/Swift on every app build.
73
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "CarrotQuest".
74
+ #include "CarrotQuest-Swift.h"
75
+ // Same as above, but used when building with frameworks (`use_frameworks`)
76
+ #elif __has_include(<CarrotQuest/CarrotQuest-Swift.h>)
77
+ #include <CarrotQuest/CarrotQuest-Swift.h>
78
+ #else
79
+ #error CarrotQuest's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "CarrotQuest", and try building the app first.
80
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// CarrotQuestAutolinking.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 "CarrotQuest-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridCarrotQuestSpecSwift.hpp"
14
+
15
+ @interface CarrotQuestAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation CarrotQuestAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::carrotquest;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "CarrotQuest",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridCarrotQuestSpec> hybridObject = CarrotQuest::CarrotQuestAutolinking::createCarrotQuest();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// CarrotQuestAutolinking.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 CarrotQuestAutolinking {
13
+ public typealias bridge = margelo.nitro.carrotquest.bridge.swift
14
+
15
+ public static func createCarrotQuest() -> bridge.std__shared_ptr_HybridCarrotQuestSpec_ {
16
+ let hybridObject = CarrotQuest()
17
+ return { () -> bridge.std__shared_ptr_HybridCarrotQuestSpec_ in
18
+ let __cxxWrapped = hybridObject.getCxxWrapper()
19
+ return __cxxWrapped.getCxxPart()
20
+ }()
21
+ }
22
+
23
+ public static func isCarrotQuestRecyclable() -> Bool {
24
+ return CarrotQuest.self is any RecyclableView.Type
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridCarrotQuestSpecSwift.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 "HybridCarrotQuestSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::carrotquest {
11
+ } // namespace margelo::nitro::carrotquest
@@ -0,0 +1,344 @@
1
+ ///
2
+ /// HybridCarrotQuestSpecSwift.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 "HybridCarrotQuestSpec.hpp"
11
+
12
+ // Forward declaration of `HybridCarrotQuestSpec_cxx` to properly resolve imports.
13
+ namespace CarrotQuest { class HybridCarrotQuestSpec_cxx; }
14
+
15
+ // Forward declaration of `CarrotQuestSetupOptions` to properly resolve imports.
16
+ namespace margelo::nitro::carrotquest { struct CarrotQuestSetupOptions; }
17
+ // Forward declaration of `CarrotQuestTheme` to properly resolve imports.
18
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestTheme; }
19
+ // Forward declaration of `CarrotQuestLogLevel` to properly resolve imports.
20
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestLogLevel; }
21
+ // Forward declaration of `CarrotQuestUserProperties` to properly resolve imports.
22
+ namespace margelo::nitro::carrotquest { struct CarrotQuestUserProperties; }
23
+ // Forward declaration of `CarrotQuestProperty` to properly resolve imports.
24
+ namespace margelo::nitro::carrotquest { struct CarrotQuestProperty; }
25
+ // Forward declaration of `CarrotQuestPropertyOperation` to properly resolve imports.
26
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestPropertyOperation; }
27
+ // Forward declaration of `CarrotQuestPropertyKind` to properly resolve imports.
28
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestPropertyKind; }
29
+ // Forward declaration of `CarrotQuestUrlSource` to properly resolve imports.
30
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestUrlSource; }
31
+ // Forward declaration of `CarrotQuestLogEntry` to properly resolve imports.
32
+ namespace margelo::nitro::carrotquest { struct CarrotQuestLogEntry; }
33
+ // Forward declaration of `CarrotQuestLogCategory` to properly resolve imports.
34
+ namespace margelo::nitro::carrotquest { enum class CarrotQuestLogCategory; }
35
+
36
+ #include <NitroModules/Promise.hpp>
37
+ #include <string>
38
+ #include "CarrotQuestSetupOptions.hpp"
39
+ #include <optional>
40
+ #include "CarrotQuestTheme.hpp"
41
+ #include "CarrotQuestLogLevel.hpp"
42
+ #include <functional>
43
+ #include "CarrotQuestUserProperties.hpp"
44
+ #include <unordered_map>
45
+ #include "CarrotQuestProperty.hpp"
46
+ #include <vector>
47
+ #include "CarrotQuestPropertyOperation.hpp"
48
+ #include "CarrotQuestPropertyKind.hpp"
49
+ #include <variant>
50
+ #include "CarrotQuestUrlSource.hpp"
51
+ #include "CarrotQuestLogEntry.hpp"
52
+ #include "CarrotQuestLogCategory.hpp"
53
+
54
+ #include "CarrotQuest-Swift-Cxx-Umbrella.hpp"
55
+
56
+ namespace margelo::nitro::carrotquest {
57
+
58
+ /**
59
+ * The C++ part of HybridCarrotQuestSpec_cxx.swift.
60
+ *
61
+ * HybridCarrotQuestSpecSwift (C++) accesses HybridCarrotQuestSpec_cxx (Swift), and might
62
+ * contain some additional bridging code for C++ <> Swift interop.
63
+ *
64
+ * Since this obviously introduces an overhead, I hope at some point in
65
+ * the future, HybridCarrotQuestSpec_cxx can directly inherit from the C++ class HybridCarrotQuestSpec
66
+ * to simplify the whole structure and memory management.
67
+ */
68
+ class HybridCarrotQuestSpecSwift: public virtual HybridCarrotQuestSpec {
69
+ public:
70
+ // Constructor from a Swift instance
71
+ explicit HybridCarrotQuestSpecSwift(const CarrotQuest::HybridCarrotQuestSpec_cxx& swiftPart):
72
+ HybridObject(HybridCarrotQuestSpec::TAG),
73
+ _swiftPart(swiftPart) { }
74
+
75
+ public:
76
+ // Get the Swift part
77
+ inline CarrotQuest::HybridCarrotQuestSpec_cxx& getSwiftPart() noexcept {
78
+ return _swiftPart;
79
+ }
80
+
81
+ public:
82
+ inline size_t getExternalMemorySize() noexcept override {
83
+ return _swiftPart.getMemorySize();
84
+ }
85
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
86
+ if (auto otherCast = std::dynamic_pointer_cast<HybridCarrotQuestSpecSwift>(other)) {
87
+ return _swiftPart.equals(otherCast->_swiftPart);
88
+ }
89
+ return false;
90
+ }
91
+ void dispose() noexcept override {
92
+ _swiftPart.dispose();
93
+ }
94
+ std::string toString() override {
95
+ return _swiftPart.toString();
96
+ }
97
+
98
+ public:
99
+ // Properties
100
+ inline bool getIsConfigured() noexcept override {
101
+ return _swiftPart.isConfigured();
102
+ }
103
+ inline bool getIsChatOpen() noexcept override {
104
+ return _swiftPart.isChatOpen();
105
+ }
106
+
107
+ public:
108
+ // Methods
109
+ inline std::shared_ptr<Promise<void>> setup(const std::string& apiKey, const std::optional<CarrotQuestSetupOptions>& options) override {
110
+ auto __result = _swiftPart.setup(apiKey, options);
111
+ if (__result.hasError()) [[unlikely]] {
112
+ std::rethrow_exception(__result.error());
113
+ }
114
+ auto __value = std::move(__result.value());
115
+ return __value;
116
+ }
117
+ inline std::string getSdkVersion() override {
118
+ auto __result = _swiftPart.getSdkVersion();
119
+ if (__result.hasError()) [[unlikely]] {
120
+ std::rethrow_exception(__result.error());
121
+ }
122
+ auto __value = std::move(__result.value());
123
+ return __value;
124
+ }
125
+ inline std::shared_ptr<Promise<std::optional<std::string>>> auth(const std::string& userId, const std::string& userAuthKey) override {
126
+ auto __result = _swiftPart.auth(userId, userAuthKey);
127
+ if (__result.hasError()) [[unlikely]] {
128
+ std::rethrow_exception(__result.error());
129
+ }
130
+ auto __value = std::move(__result.value());
131
+ return __value;
132
+ }
133
+ inline std::shared_ptr<Promise<std::optional<std::string>>> hashedAuth(const std::string& userId, const std::string& hash) override {
134
+ auto __result = _swiftPart.hashedAuth(userId, hash);
135
+ if (__result.hasError()) [[unlikely]] {
136
+ std::rethrow_exception(__result.error());
137
+ }
138
+ auto __value = std::move(__result.value());
139
+ return __value;
140
+ }
141
+ inline std::shared_ptr<Promise<void>> logout() override {
142
+ auto __result = _swiftPart.logout();
143
+ if (__result.hasError()) [[unlikely]] {
144
+ std::rethrow_exception(__result.error());
145
+ }
146
+ auto __value = std::move(__result.value());
147
+ return __value;
148
+ }
149
+ inline std::shared_ptr<Promise<void>> openChat() override {
150
+ auto __result = _swiftPart.openChat();
151
+ if (__result.hasError()) [[unlikely]] {
152
+ std::rethrow_exception(__result.error());
153
+ }
154
+ auto __value = std::move(__result.value());
155
+ return __value;
156
+ }
157
+ inline std::shared_ptr<Promise<void>> closeChat() override {
158
+ auto __result = _swiftPart.closeChat();
159
+ if (__result.hasError()) [[unlikely]] {
160
+ std::rethrow_exception(__result.error());
161
+ }
162
+ auto __value = std::move(__result.value());
163
+ return __value;
164
+ }
165
+ inline void onChatVisibilityChanged(const std::function<void(bool /* visible */)>& listener) override {
166
+ auto __result = _swiftPart.onChatVisibilityChanged(listener);
167
+ if (__result.hasError()) [[unlikely]] {
168
+ std::rethrow_exception(__result.error());
169
+ }
170
+ }
171
+ inline void setTheme(CarrotQuestTheme theme) override {
172
+ auto __result = _swiftPart.setTheme(static_cast<int>(theme));
173
+ if (__result.hasError()) [[unlikely]] {
174
+ std::rethrow_exception(__result.error());
175
+ }
176
+ }
177
+ inline std::shared_ptr<Promise<double>> getUnreadConversationsCount() override {
178
+ auto __result = _swiftPart.getUnreadConversationsCount();
179
+ if (__result.hasError()) [[unlikely]] {
180
+ std::rethrow_exception(__result.error());
181
+ }
182
+ auto __value = std::move(__result.value());
183
+ return __value;
184
+ }
185
+ inline std::shared_ptr<Promise<std::optional<double>>> getUnreadMessagesCount() override {
186
+ auto __result = _swiftPart.getUnreadMessagesCount();
187
+ if (__result.hasError()) [[unlikely]] {
188
+ std::rethrow_exception(__result.error());
189
+ }
190
+ auto __value = std::move(__result.value());
191
+ return __value;
192
+ }
193
+ inline void onUnreadConversationsChanged(const std::function<void(double /* count */)>& listener) override {
194
+ auto __result = _swiftPart.onUnreadConversationsChanged(listener);
195
+ if (__result.hasError()) [[unlikely]] {
196
+ std::rethrow_exception(__result.error());
197
+ }
198
+ }
199
+ inline void setUserProperties(const CarrotQuestUserProperties& properties) override {
200
+ auto __result = _swiftPart.setUserProperties(std::forward<decltype(properties)>(properties));
201
+ if (__result.hasError()) [[unlikely]] {
202
+ std::rethrow_exception(__result.error());
203
+ }
204
+ }
205
+ inline void setProperties(const std::vector<CarrotQuestProperty>& properties) override {
206
+ auto __result = _swiftPart.setProperties(properties);
207
+ if (__result.hasError()) [[unlikely]] {
208
+ std::rethrow_exception(__result.error());
209
+ }
210
+ }
211
+ inline void trackEvent(const std::string& name, const std::optional<std::unordered_map<std::string, std::variant<bool, std::string, double>>>& params) override {
212
+ auto __result = _swiftPart.trackEvent(name, params);
213
+ if (__result.hasError()) [[unlikely]] {
214
+ std::rethrow_exception(__result.error());
215
+ }
216
+ }
217
+ inline void trackScreen(const std::string& name) override {
218
+ auto __result = _swiftPart.trackScreen(name);
219
+ if (__result.hasError()) [[unlikely]] {
220
+ std::rethrow_exception(__result.error());
221
+ }
222
+ }
223
+ inline void trackUtm(const std::string& url) override {
224
+ auto __result = _swiftPart.trackUtm(url);
225
+ if (__result.hasError()) [[unlikely]] {
226
+ std::rethrow_exception(__result.error());
227
+ }
228
+ }
229
+ inline void setPushToken(const std::string& token) override {
230
+ auto __result = _swiftPart.setPushToken(token);
231
+ if (__result.hasError()) [[unlikely]] {
232
+ std::rethrow_exception(__result.error());
233
+ }
234
+ }
235
+ inline void deletePushToken() override {
236
+ auto __result = _swiftPart.deletePushToken();
237
+ if (__result.hasError()) [[unlikely]] {
238
+ std::rethrow_exception(__result.error());
239
+ }
240
+ }
241
+ inline std::shared_ptr<Promise<void>> pushNotificationsUnsubscribe() override {
242
+ auto __result = _swiftPart.pushNotificationsUnsubscribe();
243
+ if (__result.hasError()) [[unlikely]] {
244
+ std::rethrow_exception(__result.error());
245
+ }
246
+ auto __value = std::move(__result.value());
247
+ return __value;
248
+ }
249
+ inline std::shared_ptr<Promise<void>> pushCampaignsUnsubscribe() override {
250
+ auto __result = _swiftPart.pushCampaignsUnsubscribe();
251
+ if (__result.hasError()) [[unlikely]] {
252
+ std::rethrow_exception(__result.error());
253
+ }
254
+ auto __value = std::move(__result.value());
255
+ return __value;
256
+ }
257
+ inline bool isCarrotPush(const std::string& payloadJson) override {
258
+ auto __result = _swiftPart.isCarrotPush(payloadJson);
259
+ if (__result.hasError()) [[unlikely]] {
260
+ std::rethrow_exception(__result.error());
261
+ }
262
+ auto __value = std::move(__result.value());
263
+ return __value;
264
+ }
265
+ inline bool isAutoMessage(const std::string& payloadJson) override {
266
+ auto __result = _swiftPart.isAutoMessage(payloadJson);
267
+ if (__result.hasError()) [[unlikely]] {
268
+ std::rethrow_exception(__result.error());
269
+ }
270
+ auto __value = std::move(__result.value());
271
+ return __value;
272
+ }
273
+ inline void handlePushNotification(const std::string& payloadJson) override {
274
+ auto __result = _swiftPart.handlePushNotification(payloadJson);
275
+ if (__result.hasError()) [[unlikely]] {
276
+ std::rethrow_exception(__result.error());
277
+ }
278
+ }
279
+ inline void handlePushClick(const std::string& payloadJson, bool openLink) override {
280
+ auto __result = _swiftPart.handlePushClick(payloadJson, std::forward<decltype(openLink)>(openLink));
281
+ if (__result.hasError()) [[unlikely]] {
282
+ std::rethrow_exception(__result.error());
283
+ }
284
+ }
285
+ inline std::optional<std::string> getPushLink(const std::string& payloadJson) override {
286
+ auto __result = _swiftPart.getPushLink(payloadJson);
287
+ if (__result.hasError()) [[unlikely]] {
288
+ std::rethrow_exception(__result.error());
289
+ }
290
+ auto __value = std::move(__result.value());
291
+ return __value;
292
+ }
293
+ inline std::shared_ptr<Promise<bool>> wasPushShownEarlier(const std::string& payloadJson) override {
294
+ auto __result = _swiftPart.wasPushShownEarlier(payloadJson);
295
+ if (__result.hasError()) [[unlikely]] {
296
+ std::rethrow_exception(__result.error());
297
+ }
298
+ auto __value = std::move(__result.value());
299
+ return __value;
300
+ }
301
+ inline void onUrlOpen(CarrotQuestUrlSource source, const std::function<void(const std::string& /* url */)>& listener) override {
302
+ auto __result = _swiftPart.onUrlOpen(static_cast<int>(source), listener);
303
+ if (__result.hasError()) [[unlikely]] {
304
+ std::rethrow_exception(__result.error());
305
+ }
306
+ }
307
+ inline void openBrowserLink(const std::string& url) override {
308
+ auto __result = _swiftPart.openBrowserLink(url);
309
+ if (__result.hasError()) [[unlikely]] {
310
+ std::rethrow_exception(__result.error());
311
+ }
312
+ }
313
+ inline void openUniversalLink(const std::string& url) override {
314
+ auto __result = _swiftPart.openUniversalLink(url);
315
+ if (__result.hasError()) [[unlikely]] {
316
+ std::rethrow_exception(__result.error());
317
+ }
318
+ }
319
+ inline std::optional<std::string> getDiagnostics() override {
320
+ auto __result = _swiftPart.getDiagnostics();
321
+ if (__result.hasError()) [[unlikely]] {
322
+ std::rethrow_exception(__result.error());
323
+ }
324
+ auto __value = std::move(__result.value());
325
+ return __value;
326
+ }
327
+ inline void onLog(const std::function<void(const CarrotQuestLogEntry& /* entry */)>& listener) override {
328
+ auto __result = _swiftPart.onLog(listener);
329
+ if (__result.hasError()) [[unlikely]] {
330
+ std::rethrow_exception(__result.error());
331
+ }
332
+ }
333
+ inline void offLog() override {
334
+ auto __result = _swiftPart.offLog();
335
+ if (__result.hasError()) [[unlikely]] {
336
+ std::rethrow_exception(__result.error());
337
+ }
338
+ }
339
+
340
+ private:
341
+ CarrotQuest::HybridCarrotQuestSpec_cxx _swiftPart;
342
+ };
343
+
344
+ } // namespace margelo::nitro::carrotquest
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// CarrotQuestEventValue.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
+
9
+
10
+ /**
11
+ * An Swift enum with associated values representing a Variant/Union type.
12
+ * JS type: `boolean | string | number`
13
+ */
14
+ @frozen
15
+ public enum CarrotQuestEventValue {
16
+ case first(Bool)
17
+ case second(String)
18
+ case third(Double)
19
+ }
20
+
21
+ public extension CarrotQuestEventValue {
22
+ func asType<T>(_ type: T.Type = T.self) -> T? {
23
+ switch self {
24
+ case .first(let value): return value as? T
25
+ case .second(let value): return value as? T
26
+ case .third(let value): return value as? T
27
+ }
28
+ }
29
+ func isType<T>(_ type: T.Type = T.self) -> Bool {
30
+ return self.asType(type) != nil
31
+ }
32
+ }
@@ -0,0 +1,64 @@
1
+ ///
2
+ /// CarrotQuestLogCategory.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
+ /**
9
+ * Represents the JS union `CarrotQuestLogCategory`, backed by a C++ enum.
10
+ */
11
+ public typealias CarrotQuestLogCategory = margelo.nitro.carrotquest.CarrotQuestLogCategory
12
+
13
+ public extension CarrotQuestLogCategory {
14
+ /**
15
+ * Get a CarrotQuestLogCategory for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "push":
21
+ self = .push
22
+ case "general":
23
+ self = .general
24
+ case "network":
25
+ self = .network
26
+ case "connectivity":
27
+ self = .connectivity
28
+ case "auth":
29
+ self = .auth
30
+ case "realtime":
31
+ self = .realtime
32
+ case "lifecycle":
33
+ self = .lifecycle
34
+ case "database":
35
+ self = .database
36
+ default:
37
+ return nil
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Get the String value this CarrotQuestLogCategory represents.
43
+ */
44
+ var stringValue: String {
45
+ switch self {
46
+ case .push:
47
+ return "push"
48
+ case .general:
49
+ return "general"
50
+ case .network:
51
+ return "network"
52
+ case .connectivity:
53
+ return "connectivity"
54
+ case .auth:
55
+ return "auth"
56
+ case .realtime:
57
+ return "realtime"
58
+ case .lifecycle:
59
+ return "lifecycle"
60
+ case .database:
61
+ return "database"
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,86 @@
1
+ ///
2
+ /// CarrotQuestLogEntry.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
+ /**
11
+ * Represents an instance of `CarrotQuestLogEntry`, backed by a C++ struct.
12
+ */
13
+ public typealias CarrotQuestLogEntry = margelo.nitro.carrotquest.CarrotQuestLogEntry
14
+
15
+ public extension CarrotQuestLogEntry {
16
+ private typealias bridge = margelo.nitro.carrotquest.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `CarrotQuestLogEntry`.
20
+ */
21
+ init(timestampMs: Double, level: CarrotQuestLogLevel, category: CarrotQuestLogCategory, tag: String, message: String, fields: Dictionary<String, String>, error: String?) {
22
+ self.init(timestampMs, level, category, std.string(tag), std.string(message), { () -> bridge.std__unordered_map_std__string__std__string_ in
23
+ var __map = bridge.create_std__unordered_map_std__string__std__string_(fields.count)
24
+ for (__k, __v) in fields {
25
+ bridge.emplace_std__unordered_map_std__string__std__string_(&__map, std.string(__k), std.string(__v))
26
+ }
27
+ return __map
28
+ }(), { () -> bridge.std__optional_std__string_ in
29
+ if let __unwrappedValue = error {
30
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
31
+ } else {
32
+ return .init()
33
+ }
34
+ }())
35
+ }
36
+
37
+ @inline(__always)
38
+ var timestampMs: Double {
39
+ return self.__timestampMs
40
+ }
41
+
42
+ @inline(__always)
43
+ var level: CarrotQuestLogLevel {
44
+ return self.__level
45
+ }
46
+
47
+ @inline(__always)
48
+ var category: CarrotQuestLogCategory {
49
+ return self.__category
50
+ }
51
+
52
+ @inline(__always)
53
+ var tag: String {
54
+ return String(self.__tag)
55
+ }
56
+
57
+ @inline(__always)
58
+ var message: String {
59
+ return String(self.__message)
60
+ }
61
+
62
+ @inline(__always)
63
+ var fields: Dictionary<String, String> {
64
+ return { () -> Dictionary<String, String> in
65
+ var __dictionary = Dictionary<String, String>(minimumCapacity: self.__fields.size())
66
+ let __keys = bridge.get_std__unordered_map_std__string__std__string__keys(self.__fields)
67
+ for __key in __keys {
68
+ let __value = bridge.get_std__unordered_map_std__string__std__string__value(self.__fields, __key)
69
+ __dictionary[String(__key)] = String(__value)
70
+ }
71
+ return __dictionary
72
+ }()
73
+ }
74
+
75
+ @inline(__always)
76
+ var error: String? {
77
+ return { () -> String? in
78
+ if bridge.has_value_std__optional_std__string_(self.__error) {
79
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__error)
80
+ return String(__unwrapped)
81
+ } else {
82
+ return nil
83
+ }
84
+ }()
85
+ }
86
+ }