@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,87 @@
1
+ ///
2
+ /// HapticCurveControlPoint.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
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+
34
+
35
+ namespace margelo::nitro::tickle {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (HapticCurveControlPoint).
39
+ */
40
+ struct HapticCurveControlPoint final {
41
+ public:
42
+ double relativeTime SWIFT_PRIVATE;
43
+ double value SWIFT_PRIVATE;
44
+
45
+ public:
46
+ HapticCurveControlPoint() = default;
47
+ explicit HapticCurveControlPoint(double relativeTime, double value): relativeTime(relativeTime), value(value) {}
48
+
49
+ public:
50
+ friend bool operator==(const HapticCurveControlPoint& lhs, const HapticCurveControlPoint& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::tickle
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ HapticCurveControlPoint <> JS HapticCurveControlPoint (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::tickle::HapticCurveControlPoint> final {
60
+ static inline margelo::nitro::tickle::HapticCurveControlPoint fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::tickle::HapticCurveControlPoint(
63
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "relativeTime"))),
64
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::tickle::HapticCurveControlPoint& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "relativeTime"), JSIConverter<double>::toJSI(runtime, arg.relativeTime));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter<double>::toJSI(runtime, arg.value));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "relativeTime")))) return false;
82
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,101 @@
1
+ ///
2
+ /// HapticEvent.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
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `HapticEventType` to properly resolve imports.
32
+ namespace margelo::nitro::tickle { enum class HapticEventType; }
33
+ // Forward declaration of `HapticEventParameter` to properly resolve imports.
34
+ namespace margelo::nitro::tickle { struct HapticEventParameter; }
35
+
36
+ #include "HapticEventType.hpp"
37
+ #include "HapticEventParameter.hpp"
38
+ #include <vector>
39
+ #include <optional>
40
+
41
+ namespace margelo::nitro::tickle {
42
+
43
+ /**
44
+ * A struct which can be represented as a JavaScript object (HapticEvent).
45
+ */
46
+ struct HapticEvent final {
47
+ public:
48
+ HapticEventType type SWIFT_PRIVATE;
49
+ std::vector<HapticEventParameter> parameters SWIFT_PRIVATE;
50
+ double relativeTime SWIFT_PRIVATE;
51
+ std::optional<double> duration SWIFT_PRIVATE;
52
+
53
+ public:
54
+ HapticEvent() = default;
55
+ explicit HapticEvent(HapticEventType type, std::vector<HapticEventParameter> parameters, double relativeTime, std::optional<double> duration): type(type), parameters(parameters), relativeTime(relativeTime), duration(duration) {}
56
+
57
+ public:
58
+ friend bool operator==(const HapticEvent& lhs, const HapticEvent& rhs) = default;
59
+ };
60
+
61
+ } // namespace margelo::nitro::tickle
62
+
63
+ namespace margelo::nitro {
64
+
65
+ // C++ HapticEvent <> JS HapticEvent (object)
66
+ template <>
67
+ struct JSIConverter<margelo::nitro::tickle::HapticEvent> final {
68
+ static inline margelo::nitro::tickle::HapticEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
69
+ jsi::Object obj = arg.asObject(runtime);
70
+ return margelo::nitro::tickle::HapticEvent(
71
+ JSIConverter<margelo::nitro::tickle::HapticEventType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
72
+ JSIConverter<std::vector<margelo::nitro::tickle::HapticEventParameter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parameters"))),
73
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "relativeTime"))),
74
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))
75
+ );
76
+ }
77
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::tickle::HapticEvent& arg) {
78
+ jsi::Object obj(runtime);
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::tickle::HapticEventType>::toJSI(runtime, arg.type));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "parameters"), JSIConverter<std::vector<margelo::nitro::tickle::HapticEventParameter>>::toJSI(runtime, arg.parameters));
81
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "relativeTime"), JSIConverter<double>::toJSI(runtime, arg.relativeTime));
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.duration));
83
+ return obj;
84
+ }
85
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
86
+ if (!value.isObject()) {
87
+ return false;
88
+ }
89
+ jsi::Object obj = value.getObject(runtime);
90
+ if (!nitro::isPlainObject(runtime, obj)) {
91
+ return false;
92
+ }
93
+ if (!JSIConverter<margelo::nitro::tickle::HapticEventType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
94
+ if (!JSIConverter<std::vector<margelo::nitro::tickle::HapticEventParameter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parameters")))) return false;
95
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "relativeTime")))) return false;
96
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
97
+ return true;
98
+ }
99
+ };
100
+
101
+ } // namespace margelo::nitro
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// HapticEventParameter.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
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `HapticParameterType` to properly resolve imports.
32
+ namespace margelo::nitro::tickle { enum class HapticParameterType; }
33
+
34
+ #include "HapticParameterType.hpp"
35
+
36
+ namespace margelo::nitro::tickle {
37
+
38
+ /**
39
+ * A struct which can be represented as a JavaScript object (HapticEventParameter).
40
+ */
41
+ struct HapticEventParameter final {
42
+ public:
43
+ HapticParameterType type SWIFT_PRIVATE;
44
+ double value SWIFT_PRIVATE;
45
+
46
+ public:
47
+ HapticEventParameter() = default;
48
+ explicit HapticEventParameter(HapticParameterType type, double value): type(type), value(value) {}
49
+
50
+ public:
51
+ friend bool operator==(const HapticEventParameter& lhs, const HapticEventParameter& rhs) = default;
52
+ };
53
+
54
+ } // namespace margelo::nitro::tickle
55
+
56
+ namespace margelo::nitro {
57
+
58
+ // C++ HapticEventParameter <> JS HapticEventParameter (object)
59
+ template <>
60
+ struct JSIConverter<margelo::nitro::tickle::HapticEventParameter> final {
61
+ static inline margelo::nitro::tickle::HapticEventParameter fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
62
+ jsi::Object obj = arg.asObject(runtime);
63
+ return margelo::nitro::tickle::HapticEventParameter(
64
+ JSIConverter<margelo::nitro::tickle::HapticParameterType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
65
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))
66
+ );
67
+ }
68
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::tickle::HapticEventParameter& arg) {
69
+ jsi::Object obj(runtime);
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::tickle::HapticParameterType>::toJSI(runtime, arg.type));
71
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter<double>::toJSI(runtime, arg.value));
72
+ return obj;
73
+ }
74
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
75
+ if (!value.isObject()) {
76
+ return false;
77
+ }
78
+ jsi::Object obj = value.getObject(runtime);
79
+ if (!nitro::isPlainObject(runtime, obj)) {
80
+ return false;
81
+ }
82
+ if (!JSIConverter<margelo::nitro::tickle::HapticParameterType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
83
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))) return false;
84
+ return true;
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// HapticEventType.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
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::tickle {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (HapticEventType).
30
+ */
31
+ enum class HapticEventType {
32
+ TRANSIENT SWIFT_NAME(transient) = 0,
33
+ CONTINUOUS SWIFT_NAME(continuous) = 1,
34
+ } CLOSED_ENUM;
35
+
36
+ } // namespace margelo::nitro::tickle
37
+
38
+ namespace margelo::nitro {
39
+
40
+ // C++ HapticEventType <> JS HapticEventType (union)
41
+ template <>
42
+ struct JSIConverter<margelo::nitro::tickle::HapticEventType> final {
43
+ static inline margelo::nitro::tickle::HapticEventType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
44
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
45
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
46
+ case hashString("transient"): return margelo::nitro::tickle::HapticEventType::TRANSIENT;
47
+ case hashString("continuous"): return margelo::nitro::tickle::HapticEventType::CONTINUOUS;
48
+ default: [[unlikely]]
49
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum HapticEventType - invalid value!");
50
+ }
51
+ }
52
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::tickle::HapticEventType arg) {
53
+ switch (arg) {
54
+ case margelo::nitro::tickle::HapticEventType::TRANSIENT: return JSIConverter<std::string>::toJSI(runtime, "transient");
55
+ case margelo::nitro::tickle::HapticEventType::CONTINUOUS: return JSIConverter<std::string>::toJSI(runtime, "continuous");
56
+ default: [[unlikely]]
57
+ throw std::invalid_argument("Cannot convert HapticEventType to JS - invalid value: "
58
+ + std::to_string(static_cast<int>(arg)) + "!");
59
+ }
60
+ }
61
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
62
+ if (!value.isString()) {
63
+ return false;
64
+ }
65
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
66
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
67
+ case hashString("transient"):
68
+ case hashString("continuous"):
69
+ return true;
70
+ default:
71
+ return false;
72
+ }
73
+ }
74
+ };
75
+
76
+ } // namespace margelo::nitro
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// HapticImpactStyle.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
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::tickle {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (HapticImpactStyle).
30
+ */
31
+ enum class HapticImpactStyle {
32
+ RIGID SWIFT_NAME(rigid) = 0,
33
+ HEAVY SWIFT_NAME(heavy) = 1,
34
+ MEDIUM SWIFT_NAME(medium) = 2,
35
+ LIGHT SWIFT_NAME(light) = 3,
36
+ SOFT SWIFT_NAME(soft) = 4,
37
+ } CLOSED_ENUM;
38
+
39
+ } // namespace margelo::nitro::tickle
40
+
41
+ namespace margelo::nitro {
42
+
43
+ // C++ HapticImpactStyle <> JS HapticImpactStyle (union)
44
+ template <>
45
+ struct JSIConverter<margelo::nitro::tickle::HapticImpactStyle> final {
46
+ static inline margelo::nitro::tickle::HapticImpactStyle fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
48
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
49
+ case hashString("rigid"): return margelo::nitro::tickle::HapticImpactStyle::RIGID;
50
+ case hashString("heavy"): return margelo::nitro::tickle::HapticImpactStyle::HEAVY;
51
+ case hashString("medium"): return margelo::nitro::tickle::HapticImpactStyle::MEDIUM;
52
+ case hashString("light"): return margelo::nitro::tickle::HapticImpactStyle::LIGHT;
53
+ case hashString("soft"): return margelo::nitro::tickle::HapticImpactStyle::SOFT;
54
+ default: [[unlikely]]
55
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum HapticImpactStyle - invalid value!");
56
+ }
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::tickle::HapticImpactStyle arg) {
59
+ switch (arg) {
60
+ case margelo::nitro::tickle::HapticImpactStyle::RIGID: return JSIConverter<std::string>::toJSI(runtime, "rigid");
61
+ case margelo::nitro::tickle::HapticImpactStyle::HEAVY: return JSIConverter<std::string>::toJSI(runtime, "heavy");
62
+ case margelo::nitro::tickle::HapticImpactStyle::MEDIUM: return JSIConverter<std::string>::toJSI(runtime, "medium");
63
+ case margelo::nitro::tickle::HapticImpactStyle::LIGHT: return JSIConverter<std::string>::toJSI(runtime, "light");
64
+ case margelo::nitro::tickle::HapticImpactStyle::SOFT: return JSIConverter<std::string>::toJSI(runtime, "soft");
65
+ default: [[unlikely]]
66
+ throw std::invalid_argument("Cannot convert HapticImpactStyle to JS - invalid value: "
67
+ + std::to_string(static_cast<int>(arg)) + "!");
68
+ }
69
+ }
70
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
71
+ if (!value.isString()) {
72
+ return false;
73
+ }
74
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
75
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
76
+ case hashString("rigid"):
77
+ case hashString("heavy"):
78
+ case hashString("medium"):
79
+ case hashString("light"):
80
+ case hashString("soft"):
81
+ return true;
82
+ default:
83
+ return false;
84
+ }
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// HapticNotificationType.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
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::tickle {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (HapticNotificationType).
30
+ */
31
+ enum class HapticNotificationType {
32
+ ERROR SWIFT_NAME(error) = 0,
33
+ SUCCESS SWIFT_NAME(success) = 1,
34
+ WARNING SWIFT_NAME(warning) = 2,
35
+ } CLOSED_ENUM;
36
+
37
+ } // namespace margelo::nitro::tickle
38
+
39
+ namespace margelo::nitro {
40
+
41
+ // C++ HapticNotificationType <> JS HapticNotificationType (union)
42
+ template <>
43
+ struct JSIConverter<margelo::nitro::tickle::HapticNotificationType> final {
44
+ static inline margelo::nitro::tickle::HapticNotificationType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
45
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
46
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
47
+ case hashString("error"): return margelo::nitro::tickle::HapticNotificationType::ERROR;
48
+ case hashString("success"): return margelo::nitro::tickle::HapticNotificationType::SUCCESS;
49
+ case hashString("warning"): return margelo::nitro::tickle::HapticNotificationType::WARNING;
50
+ default: [[unlikely]]
51
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum HapticNotificationType - invalid value!");
52
+ }
53
+ }
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::tickle::HapticNotificationType arg) {
55
+ switch (arg) {
56
+ case margelo::nitro::tickle::HapticNotificationType::ERROR: return JSIConverter<std::string>::toJSI(runtime, "error");
57
+ case margelo::nitro::tickle::HapticNotificationType::SUCCESS: return JSIConverter<std::string>::toJSI(runtime, "success");
58
+ case margelo::nitro::tickle::HapticNotificationType::WARNING: return JSIConverter<std::string>::toJSI(runtime, "warning");
59
+ default: [[unlikely]]
60
+ throw std::invalid_argument("Cannot convert HapticNotificationType to JS - invalid value: "
61
+ + std::to_string(static_cast<int>(arg)) + "!");
62
+ }
63
+ }
64
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
65
+ if (!value.isString()) {
66
+ return false;
67
+ }
68
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
69
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
70
+ case hashString("error"):
71
+ case hashString("success"):
72
+ case hashString("warning"):
73
+ return true;
74
+ default:
75
+ return false;
76
+ }
77
+ }
78
+ };
79
+
80
+ } // namespace margelo::nitro
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// HapticParameterType.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
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::tickle {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (HapticParameterType).
30
+ */
31
+ enum class HapticParameterType {
32
+ INTENSITY SWIFT_NAME(intensity) = 0,
33
+ SHARPNESS SWIFT_NAME(sharpness) = 1,
34
+ } CLOSED_ENUM;
35
+
36
+ } // namespace margelo::nitro::tickle
37
+
38
+ namespace margelo::nitro {
39
+
40
+ // C++ HapticParameterType <> JS HapticParameterType (union)
41
+ template <>
42
+ struct JSIConverter<margelo::nitro::tickle::HapticParameterType> final {
43
+ static inline margelo::nitro::tickle::HapticParameterType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
44
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
45
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
46
+ case hashString("intensity"): return margelo::nitro::tickle::HapticParameterType::INTENSITY;
47
+ case hashString("sharpness"): return margelo::nitro::tickle::HapticParameterType::SHARPNESS;
48
+ default: [[unlikely]]
49
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum HapticParameterType - invalid value!");
50
+ }
51
+ }
52
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::tickle::HapticParameterType arg) {
53
+ switch (arg) {
54
+ case margelo::nitro::tickle::HapticParameterType::INTENSITY: return JSIConverter<std::string>::toJSI(runtime, "intensity");
55
+ case margelo::nitro::tickle::HapticParameterType::SHARPNESS: return JSIConverter<std::string>::toJSI(runtime, "sharpness");
56
+ default: [[unlikely]]
57
+ throw std::invalid_argument("Cannot convert HapticParameterType to JS - invalid value: "
58
+ + std::to_string(static_cast<int>(arg)) + "!");
59
+ }
60
+ }
61
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
62
+ if (!value.isString()) {
63
+ return false;
64
+ }
65
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
66
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
67
+ case hashString("intensity"):
68
+ case hashString("sharpness"):
69
+ return true;
70
+ default:
71
+ return false;
72
+ }
73
+ }
74
+ };
75
+
76
+ } // namespace margelo::nitro
@@ -0,0 +1,34 @@
1
+ ///
2
+ /// HybridTickleSpec.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 "HybridTickleSpec.hpp"
9
+
10
+ namespace margelo::nitro::tickle {
11
+
12
+ void HybridTickleSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("startHaptic", &HybridTickleSpec::startHaptic);
18
+ prototype.registerHybridMethod("stopAllHaptics", &HybridTickleSpec::stopAllHaptics);
19
+ prototype.registerHybridMethod("initializeEngine", &HybridTickleSpec::initializeEngine);
20
+ prototype.registerHybridMethod("destroyEngine", &HybridTickleSpec::destroyEngine);
21
+ prototype.registerHybridMethod("createContinuousPlayer", &HybridTickleSpec::createContinuousPlayer);
22
+ prototype.registerHybridMethod("startContinuousPlayer", &HybridTickleSpec::startContinuousPlayer);
23
+ prototype.registerHybridMethod("updateContinuousPlayer", &HybridTickleSpec::updateContinuousPlayer);
24
+ prototype.registerHybridMethod("stopContinuousPlayer", &HybridTickleSpec::stopContinuousPlayer);
25
+ prototype.registerHybridMethod("destroyContinuousPlayer", &HybridTickleSpec::destroyContinuousPlayer);
26
+ prototype.registerHybridMethod("setHapticsEnabled", &HybridTickleSpec::setHapticsEnabled);
27
+ prototype.registerHybridMethod("getHapticsEnabled", &HybridTickleSpec::getHapticsEnabled);
28
+ prototype.registerHybridMethod("triggerImpact", &HybridTickleSpec::triggerImpact);
29
+ prototype.registerHybridMethod("triggerNotification", &HybridTickleSpec::triggerNotification);
30
+ prototype.registerHybridMethod("triggerSelection", &HybridTickleSpec::triggerSelection);
31
+ });
32
+ }
33
+
34
+ } // namespace margelo::nitro::tickle