@renegades/react-native-tickle 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 (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +352 -0
  3. package/Tickle.podspec +29 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +126 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/tickle/Tickle.kt +71 -0
  10. package/android/src/main/java/com/margelo/nitro/tickle/TicklePackage.kt +22 -0
  11. package/ios/Tickle.swift +185 -0
  12. package/ios/TickleUtils.swift +404 -0
  13. package/lib/module/Tickle.nitro.js +4 -0
  14. package/lib/module/Tickle.nitro.js.map +1 -0
  15. package/lib/module/index.js +254 -0
  16. package/lib/module/index.js.map +1 -0
  17. package/lib/module/package.json +1 -0
  18. package/lib/typescript/package.json +1 -0
  19. package/lib/typescript/src/Tickle.nitro.d.ts +63 -0
  20. package/lib/typescript/src/Tickle.nitro.d.ts.map +1 -0
  21. package/lib/typescript/src/index.d.ts +148 -0
  22. package/lib/typescript/src/index.d.ts.map +1 -0
  23. package/nitro.json +17 -0
  24. package/nitrogen/generated/android/c++/JHapticCurve.hpp +87 -0
  25. package/nitrogen/generated/android/c++/JHapticCurveControlPoint.hpp +61 -0
  26. package/nitrogen/generated/android/c++/JHapticEvent.hpp +94 -0
  27. package/nitrogen/generated/android/c++/JHapticEventParameter.hpp +62 -0
  28. package/nitrogen/generated/android/c++/JHapticEventType.hpp +58 -0
  29. package/nitrogen/generated/android/c++/JHapticImpactStyle.hpp +67 -0
  30. package/nitrogen/generated/android/c++/JHapticNotificationType.hpp +61 -0
  31. package/nitrogen/generated/android/c++/JHapticParameterType.hpp +58 -0
  32. package/nitrogen/generated/android/c++/JHybridTickleSpec.cpp +162 -0
  33. package/nitrogen/generated/android/c++/JHybridTickleSpec.hpp +79 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticCurve.kt +44 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticCurveControlPoint.kt +41 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticEvent.kt +47 -0
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticEventParameter.kt +41 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticEventType.kt +23 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticImpactStyle.kt +26 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticNotificationType.kt +24 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticParameterType.kt +23 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HybridTickleSpec.kt +109 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/tickleOnLoad.kt +35 -0
  44. package/nitrogen/generated/android/tickle+autolinking.cmake +81 -0
  45. package/nitrogen/generated/android/tickle+autolinking.gradle +27 -0
  46. package/nitrogen/generated/android/tickleOnLoad.cpp +44 -0
  47. package/nitrogen/generated/android/tickleOnLoad.hpp +25 -0
  48. package/nitrogen/generated/ios/Tickle+autolinking.rb +60 -0
  49. package/nitrogen/generated/ios/Tickle-Swift-Cxx-Bridge.cpp +33 -0
  50. package/nitrogen/generated/ios/Tickle-Swift-Cxx-Bridge.hpp +139 -0
  51. package/nitrogen/generated/ios/Tickle-Swift-Cxx-Umbrella.hpp +70 -0
  52. package/nitrogen/generated/ios/TickleAutolinking.mm +33 -0
  53. package/nitrogen/generated/ios/TickleAutolinking.swift +25 -0
  54. package/nitrogen/generated/ios/c++/HybridTickleSpecSwift.cpp +11 -0
  55. package/nitrogen/generated/ios/c++/HybridTickleSpecSwift.hpp +185 -0
  56. package/nitrogen/generated/ios/swift/HapticCurve.swift +46 -0
  57. package/nitrogen/generated/ios/swift/HapticCurveControlPoint.swift +35 -0
  58. package/nitrogen/generated/ios/swift/HapticEvent.swift +57 -0
  59. package/nitrogen/generated/ios/swift/HapticEventParameter.swift +35 -0
  60. package/nitrogen/generated/ios/swift/HapticEventType.swift +40 -0
  61. package/nitrogen/generated/ios/swift/HapticImpactStyle.swift +52 -0
  62. package/nitrogen/generated/ios/swift/HapticNotificationType.swift +44 -0
  63. package/nitrogen/generated/ios/swift/HapticParameterType.swift +40 -0
  64. package/nitrogen/generated/ios/swift/HybridTickleSpec.swift +69 -0
  65. package/nitrogen/generated/ios/swift/HybridTickleSpec_cxx.swift +282 -0
  66. package/nitrogen/generated/shared/c++/HapticCurve.hpp +96 -0
  67. package/nitrogen/generated/shared/c++/HapticCurveControlPoint.hpp +87 -0
  68. package/nitrogen/generated/shared/c++/HapticEvent.hpp +101 -0
  69. package/nitrogen/generated/shared/c++/HapticEventParameter.hpp +88 -0
  70. package/nitrogen/generated/shared/c++/HapticEventType.hpp +76 -0
  71. package/nitrogen/generated/shared/c++/HapticImpactStyle.hpp +88 -0
  72. package/nitrogen/generated/shared/c++/HapticNotificationType.hpp +80 -0
  73. package/nitrogen/generated/shared/c++/HapticParameterType.hpp +76 -0
  74. package/nitrogen/generated/shared/c++/HybridTickleSpec.cpp +34 -0
  75. package/nitrogen/generated/shared/c++/HybridTickleSpec.hpp +87 -0
  76. package/package.json +179 -0
  77. package/react-native.config.js +8 -0
  78. package/src/Tickle.nitro.ts +84 -0
  79. package/src/index.tsx +306 -0
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// HapticCurve.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "HapticCurve".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class HapticCurve(
20
+ @DoNotStrip
21
+ @Keep
22
+ val type: HapticParameterType,
23
+ @DoNotStrip
24
+ @Keep
25
+ val controlPoints: Array<HapticCurveControlPoint>,
26
+ @DoNotStrip
27
+ @Keep
28
+ val relativeTime: Double
29
+ ) {
30
+ /* primary constructor */
31
+
32
+ companion object {
33
+ /**
34
+ * Constructor called from C++
35
+ */
36
+ @DoNotStrip
37
+ @Keep
38
+ @Suppress("unused")
39
+ @JvmStatic
40
+ private fun fromCpp(type: HapticParameterType, controlPoints: Array<HapticCurveControlPoint>, relativeTime: Double): HapticCurve {
41
+ return HapticCurve(type, controlPoints, relativeTime)
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// HapticCurveControlPoint.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "HapticCurveControlPoint".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class HapticCurveControlPoint(
20
+ @DoNotStrip
21
+ @Keep
22
+ val relativeTime: Double,
23
+ @DoNotStrip
24
+ @Keep
25
+ val value: Double
26
+ ) {
27
+ /* primary constructor */
28
+
29
+ companion object {
30
+ /**
31
+ * Constructor called from C++
32
+ */
33
+ @DoNotStrip
34
+ @Keep
35
+ @Suppress("unused")
36
+ @JvmStatic
37
+ private fun fromCpp(relativeTime: Double, value: Double): HapticCurveControlPoint {
38
+ return HapticCurveControlPoint(relativeTime, value)
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// HapticEvent.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "HapticEvent".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class HapticEvent(
20
+ @DoNotStrip
21
+ @Keep
22
+ val type: HapticEventType,
23
+ @DoNotStrip
24
+ @Keep
25
+ val parameters: Array<HapticEventParameter>,
26
+ @DoNotStrip
27
+ @Keep
28
+ val relativeTime: Double,
29
+ @DoNotStrip
30
+ @Keep
31
+ val duration: Double?
32
+ ) {
33
+ /* primary constructor */
34
+
35
+ companion object {
36
+ /**
37
+ * Constructor called from C++
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress("unused")
42
+ @JvmStatic
43
+ private fun fromCpp(type: HapticEventType, parameters: Array<HapticEventParameter>, relativeTime: Double, duration: Double?): HapticEvent {
44
+ return HapticEvent(type, parameters, relativeTime, duration)
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// HapticEventParameter.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "HapticEventParameter".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class HapticEventParameter(
20
+ @DoNotStrip
21
+ @Keep
22
+ val type: HapticParameterType,
23
+ @DoNotStrip
24
+ @Keep
25
+ val value: Double
26
+ ) {
27
+ /* primary constructor */
28
+
29
+ companion object {
30
+ /**
31
+ * Constructor called from C++
32
+ */
33
+ @DoNotStrip
34
+ @Keep
35
+ @Suppress("unused")
36
+ @JvmStatic
37
+ private fun fromCpp(type: HapticParameterType, value: Double): HapticEventParameter {
38
+ return HapticEventParameter(type, value)
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,23 @@
1
+ ///
2
+ /// HapticEventType.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "HapticEventType".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class HapticEventType(@DoNotStrip @Keep val value: Int) {
19
+ TRANSIENT(0),
20
+ CONTINUOUS(1);
21
+
22
+ companion object
23
+ }
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// HapticImpactStyle.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "HapticImpactStyle".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class HapticImpactStyle(@DoNotStrip @Keep val value: Int) {
19
+ RIGID(0),
20
+ HEAVY(1),
21
+ MEDIUM(2),
22
+ LIGHT(3),
23
+ SOFT(4);
24
+
25
+ companion object
26
+ }
@@ -0,0 +1,24 @@
1
+ ///
2
+ /// HapticNotificationType.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "HapticNotificationType".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class HapticNotificationType(@DoNotStrip @Keep val value: Int) {
19
+ ERROR(0),
20
+ SUCCESS(1),
21
+ WARNING(2);
22
+
23
+ companion object
24
+ }
@@ -0,0 +1,23 @@
1
+ ///
2
+ /// HapticParameterType.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.tickle
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "HapticParameterType".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class HapticParameterType(@DoNotStrip @Keep val value: Int) {
19
+ INTENSITY(0),
20
+ SHARPNESS(1);
21
+
22
+ companion object
23
+ }
@@ -0,0 +1,109 @@
1
+ ///
2
+ /// HybridTickleSpec.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.tickle
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.HybridObject
14
+
15
+ /**
16
+ * A Kotlin class representing the Tickle HybridObject.
17
+ * Implement this abstract class to create Kotlin-based instances of Tickle.
18
+ */
19
+ @DoNotStrip
20
+ @Keep
21
+ @Suppress(
22
+ "KotlinJniMissingFunction", "unused",
23
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
24
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
+ )
26
+ abstract class HybridTickleSpec: HybridObject() {
27
+ @DoNotStrip
28
+ private var mHybridData: HybridData = initHybrid()
29
+
30
+ init {
31
+ super.updateNative(mHybridData)
32
+ }
33
+
34
+ override fun updateNative(hybridData: HybridData) {
35
+ mHybridData = hybridData
36
+ super.updateNative(hybridData)
37
+ }
38
+
39
+ // Default implementation of `HybridObject.toString()`
40
+ override fun toString(): String {
41
+ return "[HybridObject Tickle]"
42
+ }
43
+
44
+ // Properties
45
+
46
+
47
+ // Methods
48
+ @DoNotStrip
49
+ @Keep
50
+ abstract fun startHaptic(events: Array<HapticEvent>, curves: Array<HapticCurve>): Unit
51
+
52
+ @DoNotStrip
53
+ @Keep
54
+ abstract fun stopAllHaptics(): Unit
55
+
56
+ @DoNotStrip
57
+ @Keep
58
+ abstract fun initializeEngine(): Unit
59
+
60
+ @DoNotStrip
61
+ @Keep
62
+ abstract fun destroyEngine(): Unit
63
+
64
+ @DoNotStrip
65
+ @Keep
66
+ abstract fun createContinuousPlayer(playerId: String, initialIntensity: Double, initialSharpness: Double): Unit
67
+
68
+ @DoNotStrip
69
+ @Keep
70
+ abstract fun startContinuousPlayer(playerId: String): Unit
71
+
72
+ @DoNotStrip
73
+ @Keep
74
+ abstract fun updateContinuousPlayer(playerId: String, intensityControl: Double, sharpnessControl: Double): Unit
75
+
76
+ @DoNotStrip
77
+ @Keep
78
+ abstract fun stopContinuousPlayer(playerId: String): Unit
79
+
80
+ @DoNotStrip
81
+ @Keep
82
+ abstract fun destroyContinuousPlayer(playerId: String): Unit
83
+
84
+ @DoNotStrip
85
+ @Keep
86
+ abstract fun setHapticsEnabled(enabled: Boolean): Unit
87
+
88
+ @DoNotStrip
89
+ @Keep
90
+ abstract fun getHapticsEnabled(): Boolean
91
+
92
+ @DoNotStrip
93
+ @Keep
94
+ abstract fun triggerImpact(style: HapticImpactStyle): Unit
95
+
96
+ @DoNotStrip
97
+ @Keep
98
+ abstract fun triggerNotification(type: HapticNotificationType): Unit
99
+
100
+ @DoNotStrip
101
+ @Keep
102
+ abstract fun triggerSelection(): Unit
103
+
104
+ private external fun initHybrid(): HybridData
105
+
106
+ companion object {
107
+ protected const val TAG = "HybridTickleSpec"
108
+ }
109
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// tickleOnLoad.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.tickle
9
+
10
+ import android.util.Log
11
+
12
+ internal class tickleOnLoad {
13
+ companion object {
14
+ private const val TAG = "tickleOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "tickle".
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 tickle C++ library...")
25
+ System.loadLibrary("tickle")
26
+ Log.i(TAG, "Successfully loaded tickle C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load tickle 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,81 @@
1
+ #
2
+ # tickle+autolinking.cmake
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 CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/tickle+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_TICKLE_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ tickle PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/tickleOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridTickleSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridTickleSpec.cpp
39
+ )
40
+
41
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
42
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
43
+ target_compile_definitions(
44
+ tickle PRIVATE
45
+ -DFOLLY_NO_CONFIG=1
46
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
47
+ -DFOLLY_USE_LIBCPP=1
48
+ -DFOLLY_CFG_NO_COROUTINES=1
49
+ -DFOLLY_MOBILE=1
50
+ -DFOLLY_HAVE_RECVMMSG=1
51
+ -DFOLLY_HAVE_PTHREAD=1
52
+ # Once we target android-23 above, we can comment
53
+ # the following line. NDK uses GNU style stderror_r() after API 23.
54
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
55
+ )
56
+
57
+ # Add all libraries required by the generated specs
58
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
59
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
60
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
61
+
62
+ # Link all libraries together
63
+ target_link_libraries(
64
+ tickle
65
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
66
+ ReactAndroid::jsi # <-- RN: JSI
67
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
68
+ )
69
+
70
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
71
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
72
+ target_link_libraries(
73
+ tickle
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ tickle
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// tickle+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/tickle+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 tickle 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,44 @@
1
+ ///
2
+ /// tickleOnLoad.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_TICKLE_WITH_GENERATED_CMAKE_PROJECT
9
+ #error tickleOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "tickleOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridTickleSpec.hpp"
19
+ #include <NitroModules/DefaultConstructableObject.hpp>
20
+
21
+ namespace margelo::nitro::tickle {
22
+
23
+ int initialize(JavaVM* vm) {
24
+ using namespace margelo::nitro;
25
+ using namespace margelo::nitro::tickle;
26
+ using namespace facebook;
27
+
28
+ return facebook::jni::initialize(vm, [] {
29
+ // Register native JNI methods
30
+ margelo::nitro::tickle::JHybridTickleSpec::registerNatives();
31
+
32
+ // Register Nitro Hybrid Objects
33
+ HybridObjectRegistry::registerHybridObjectConstructor(
34
+ "Tickle",
35
+ []() -> std::shared_ptr<HybridObject> {
36
+ static DefaultConstructableObject<JHybridTickleSpec::javaobject> object("com/margelo/nitro/tickle/Tickle");
37
+ auto instance = object.create();
38
+ return instance->cthis()->shared();
39
+ }
40
+ );
41
+ });
42
+ }
43
+
44
+ } // namespace margelo::nitro::tickle
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// tickleOnLoad.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 <NitroModules/NitroDefines.hpp>
10
+
11
+ namespace margelo::nitro::tickle {
12
+
13
+ /**
14
+ * Initializes the native (C++) part of tickle, and autolinks all Hybrid Objects.
15
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
16
+ * Example:
17
+ * ```cpp (cpp-adapter.cpp)
18
+ * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
+ * return margelo::nitro::tickle::initialize(vm);
20
+ * }
21
+ * ```
22
+ */
23
+ int initialize(JavaVM* vm);
24
+
25
+ } // namespace margelo::nitro::tickle
@@ -0,0 +1,60 @@
1
+ #
2
+ # Tickle+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/Tickle+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 Tickle 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/Tickle-Swift-Cxx-Bridge.hpp"
41
+ ]
42
+
43
+ current_private_header_files = Array(spec.attributes_hash['private_header_files'])
44
+ spec.private_header_files = current_private_header_files + [
45
+ # iOS specific specs
46
+ "nitrogen/generated/ios/c++/**/*.{h,hpp}",
47
+ # Views are framework-specific and should be private
48
+ "nitrogen/generated/shared/**/views/**/*"
49
+ ]
50
+
51
+ current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
52
+ spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
+ # Use C++ 20
54
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ })
60
+ end