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
+ /// Func_void_bool.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.carrotquest
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
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(visible: boolean) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_bool: (Boolean) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(visible: Boolean): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(visible: boolean) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_bool_cxx: Func_void_bool {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(visible: Boolean): Unit
60
+ = invoke_cxx(visible)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(visible: Boolean): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(visible: boolean) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(Boolean) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_bool_java(private val function: (Boolean) -> Unit): Func_void_bool {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(visible: Boolean): Unit {
78
+ return this.function(visible)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_double.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.carrotquest
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
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(count: number) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_double: (Double) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(count: Double): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(count: number) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_double_cxx: Func_void_double {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(count: Double): Unit
60
+ = invoke_cxx(count)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(count: Double): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(count: number) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(Double) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_double_java(private val function: (Double) -> Unit): Func_void_double {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(count: Double): Unit {
78
+ return this.function(count)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_std__string.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.carrotquest
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
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(url: string) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_std__string: (String) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(url: String): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(url: string) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_std__string_cxx: Func_void_std__string {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(url: String): Unit
60
+ = invoke_cxx(url)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(url: String): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(url: string) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(String) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_std__string_java(private val function: (String) -> Unit): Func_void_std__string {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(url: String): Unit {
78
+ return this.function(url)
79
+ }
80
+ }
@@ -0,0 +1,209 @@
1
+ ///
2
+ /// HybridCarrotQuestSpec.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.carrotquest
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 CarrotQuest HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of CarrotQuest.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
27
+ abstract class HybridCarrotQuestSpec: HybridObject() {
28
+ // Properties
29
+ @get:DoNotStrip
30
+ @get:Keep
31
+ abstract val isConfigured: Boolean
32
+
33
+ @get:DoNotStrip
34
+ @get:Keep
35
+ abstract val isChatOpen: Boolean
36
+
37
+ // Methods
38
+ @DoNotStrip
39
+ @Keep
40
+ abstract fun setup(apiKey: String, options: CarrotQuestSetupOptions?): Promise<Unit>
41
+
42
+ @DoNotStrip
43
+ @Keep
44
+ abstract fun getSdkVersion(): String
45
+
46
+ @DoNotStrip
47
+ @Keep
48
+ abstract fun auth(userId: String, userAuthKey: String): Promise<String?>
49
+
50
+ @DoNotStrip
51
+ @Keep
52
+ abstract fun hashedAuth(userId: String, hash: String): Promise<String?>
53
+
54
+ @DoNotStrip
55
+ @Keep
56
+ abstract fun logout(): Promise<Unit>
57
+
58
+ @DoNotStrip
59
+ @Keep
60
+ abstract fun openChat(): Promise<Unit>
61
+
62
+ @DoNotStrip
63
+ @Keep
64
+ abstract fun closeChat(): Promise<Unit>
65
+
66
+ abstract fun onChatVisibilityChanged(listener: (visible: Boolean) -> Unit): Unit
67
+
68
+ @DoNotStrip
69
+ @Keep
70
+ private fun onChatVisibilityChanged_cxx(listener: Func_void_bool): Unit {
71
+ val __result = onChatVisibilityChanged(listener)
72
+ return __result
73
+ }
74
+
75
+ @DoNotStrip
76
+ @Keep
77
+ abstract fun setTheme(theme: CarrotQuestTheme): Unit
78
+
79
+ @DoNotStrip
80
+ @Keep
81
+ abstract fun getUnreadConversationsCount(): Promise<Double>
82
+
83
+ @DoNotStrip
84
+ @Keep
85
+ abstract fun getUnreadMessagesCount(): Promise<Double?>
86
+
87
+ abstract fun onUnreadConversationsChanged(listener: (count: Double) -> Unit): Unit
88
+
89
+ @DoNotStrip
90
+ @Keep
91
+ private fun onUnreadConversationsChanged_cxx(listener: Func_void_double): Unit {
92
+ val __result = onUnreadConversationsChanged(listener)
93
+ return __result
94
+ }
95
+
96
+ @DoNotStrip
97
+ @Keep
98
+ abstract fun setUserProperties(properties: CarrotQuestUserProperties): Unit
99
+
100
+ @DoNotStrip
101
+ @Keep
102
+ abstract fun setProperties(properties: Array<CarrotQuestProperty>): Unit
103
+
104
+ @DoNotStrip
105
+ @Keep
106
+ abstract fun trackEvent(name: String, params: Map<String, CarrotQuestEventValue>?): Unit
107
+
108
+ @DoNotStrip
109
+ @Keep
110
+ abstract fun trackScreen(name: String): Unit
111
+
112
+ @DoNotStrip
113
+ @Keep
114
+ abstract fun trackUtm(url: String): Unit
115
+
116
+ @DoNotStrip
117
+ @Keep
118
+ abstract fun setPushToken(token: String): Unit
119
+
120
+ @DoNotStrip
121
+ @Keep
122
+ abstract fun deletePushToken(): Unit
123
+
124
+ @DoNotStrip
125
+ @Keep
126
+ abstract fun pushNotificationsUnsubscribe(): Promise<Unit>
127
+
128
+ @DoNotStrip
129
+ @Keep
130
+ abstract fun pushCampaignsUnsubscribe(): Promise<Unit>
131
+
132
+ @DoNotStrip
133
+ @Keep
134
+ abstract fun isCarrotPush(payloadJson: String): Boolean
135
+
136
+ @DoNotStrip
137
+ @Keep
138
+ abstract fun isAutoMessage(payloadJson: String): Boolean
139
+
140
+ @DoNotStrip
141
+ @Keep
142
+ abstract fun handlePushNotification(payloadJson: String): Unit
143
+
144
+ @DoNotStrip
145
+ @Keep
146
+ abstract fun handlePushClick(payloadJson: String, openLink: Boolean): Unit
147
+
148
+ @DoNotStrip
149
+ @Keep
150
+ abstract fun getPushLink(payloadJson: String): String?
151
+
152
+ @DoNotStrip
153
+ @Keep
154
+ abstract fun wasPushShownEarlier(payloadJson: String): Promise<Boolean>
155
+
156
+ abstract fun onUrlOpen(source: CarrotQuestUrlSource, listener: (url: String) -> Unit): Unit
157
+
158
+ @DoNotStrip
159
+ @Keep
160
+ private fun onUrlOpen_cxx(source: CarrotQuestUrlSource, listener: Func_void_std__string): Unit {
161
+ val __result = onUrlOpen(source, listener)
162
+ return __result
163
+ }
164
+
165
+ @DoNotStrip
166
+ @Keep
167
+ abstract fun openBrowserLink(url: String): Unit
168
+
169
+ @DoNotStrip
170
+ @Keep
171
+ abstract fun openUniversalLink(url: String): Unit
172
+
173
+ @DoNotStrip
174
+ @Keep
175
+ abstract fun getDiagnostics(): String?
176
+
177
+ abstract fun onLog(listener: (entry: CarrotQuestLogEntry) -> Unit): Unit
178
+
179
+ @DoNotStrip
180
+ @Keep
181
+ private fun onLog_cxx(listener: Func_void_CarrotQuestLogEntry): Unit {
182
+ val __result = onLog(listener)
183
+ return __result
184
+ }
185
+
186
+ @DoNotStrip
187
+ @Keep
188
+ abstract fun offLog(): Unit
189
+
190
+ // Default implementation of `HybridObject.toString()`
191
+ override fun toString(): String {
192
+ return "[HybridObject CarrotQuest]"
193
+ }
194
+
195
+ // C++ backing class
196
+ @DoNotStrip
197
+ @Keep
198
+ protected open class CxxPart(javaPart: HybridCarrotQuestSpec): HybridObject.CxxPart(javaPart) {
199
+ // C++ JHybridCarrotQuestSpec::CxxPart::initHybrid(...)
200
+ external override fun initHybrid(): HybridData
201
+ }
202
+ override fun createCxxPart(): CxxPart {
203
+ return CxxPart(this)
204
+ }
205
+
206
+ companion object {
207
+ protected const val TAG = "HybridCarrotQuestSpec"
208
+ }
209
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// carrotquestOnLoad.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.carrotquest
9
+
10
+ import android.util.Log
11
+
12
+ internal class carrotquestOnLoad {
13
+ companion object {
14
+ private const val TAG = "carrotquestOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "carrotquest".
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 carrotquest C++ library...")
25
+ System.loadLibrary("carrotquest")
26
+ Log.i(TAG, "Successfully loaded carrotquest C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load carrotquest 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
+ # CarrotQuest+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/CarrotQuest+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 CarrotQuest 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/CarrotQuest-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,97 @@
1
+ ///
2
+ /// CarrotQuest-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 "CarrotQuest-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "CarrotQuest-Swift-Cxx-Umbrella.hpp"
12
+ #include "HybridCarrotQuestSpecSwift.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::carrotquest::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void()>
18
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = CarrotQuest::Func_void::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
21
+ swiftClosure.call();
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 = CarrotQuest::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::function<void(const std::optional<std::string>& /* result */)>
34
+ Func_void_std__optional_std__string_ create_Func_void_std__optional_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
35
+ auto swiftClosure = CarrotQuest::Func_void_std__optional_std__string_::fromUnsafe(swiftClosureWrapper);
36
+ return [swiftClosure = std::move(swiftClosure)](const std::optional<std::string>& result) mutable -> void {
37
+ swiftClosure.call(result);
38
+ };
39
+ }
40
+
41
+ // pragma MARK: std::function<void(bool /* visible */)>
42
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
43
+ auto swiftClosure = CarrotQuest::Func_void_bool::fromUnsafe(swiftClosureWrapper);
44
+ return [swiftClosure = std::move(swiftClosure)](bool visible) mutable -> void {
45
+ swiftClosure.call(visible);
46
+ };
47
+ }
48
+
49
+ // pragma MARK: std::function<void(double /* result */)>
50
+ Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
51
+ auto swiftClosure = CarrotQuest::Func_void_double::fromUnsafe(swiftClosureWrapper);
52
+ return [swiftClosure = std::move(swiftClosure)](double result) mutable -> void {
53
+ swiftClosure.call(result);
54
+ };
55
+ }
56
+
57
+ // pragma MARK: std::function<void(std::optional<double> /* result */)>
58
+ Func_void_std__optional_double_ create_Func_void_std__optional_double_(void* NON_NULL swiftClosureWrapper) noexcept {
59
+ auto swiftClosure = CarrotQuest::Func_void_std__optional_double_::fromUnsafe(swiftClosureWrapper);
60
+ return [swiftClosure = std::move(swiftClosure)](std::optional<double> result) mutable -> void {
61
+ swiftClosure.call(result);
62
+ };
63
+ }
64
+
65
+ // pragma MARK: std::function<void(const std::string& /* url */)>
66
+ Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
67
+ auto swiftClosure = CarrotQuest::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
68
+ return [swiftClosure = std::move(swiftClosure)](const std::string& url) mutable -> void {
69
+ swiftClosure.call(url);
70
+ };
71
+ }
72
+
73
+ // pragma MARK: std::function<void(const CarrotQuestLogEntry& /* entry */)>
74
+ Func_void_CarrotQuestLogEntry create_Func_void_CarrotQuestLogEntry(void* NON_NULL swiftClosureWrapper) noexcept {
75
+ auto swiftClosure = CarrotQuest::Func_void_CarrotQuestLogEntry::fromUnsafe(swiftClosureWrapper);
76
+ return [swiftClosure = std::move(swiftClosure)](const CarrotQuestLogEntry& entry) mutable -> void {
77
+ swiftClosure.call(entry);
78
+ };
79
+ }
80
+
81
+ // pragma MARK: std::shared_ptr<HybridCarrotQuestSpec>
82
+ std::shared_ptr<HybridCarrotQuestSpec> create_std__shared_ptr_HybridCarrotQuestSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
83
+ CarrotQuest::HybridCarrotQuestSpec_cxx swiftPart = CarrotQuest::HybridCarrotQuestSpec_cxx::fromUnsafe(swiftUnsafePointer);
84
+ return std::make_shared<margelo::nitro::carrotquest::HybridCarrotQuestSpecSwift>(swiftPart);
85
+ }
86
+ void* NON_NULL get_std__shared_ptr_HybridCarrotQuestSpec_(std__shared_ptr_HybridCarrotQuestSpec_ cppType) {
87
+ std::shared_ptr<margelo::nitro::carrotquest::HybridCarrotQuestSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::carrotquest::HybridCarrotQuestSpecSwift>(cppType);
88
+ #ifdef NITRO_DEBUG
89
+ if (swiftWrapper == nullptr) [[unlikely]] {
90
+ throw std::runtime_error("Class \"HybridCarrotQuestSpec\" is not implemented in Swift!");
91
+ }
92
+ #endif
93
+ CarrotQuest::HybridCarrotQuestSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
94
+ return swiftPart.toUnsafe();
95
+ }
96
+
97
+ } // namespace margelo::nitro::carrotquest::bridge::swift