nitrowind-native 0.0.0-stage → 0.1.1
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.
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/Package.swift +104 -0
- package/README.md +39 -2
- package/android/src/main/java/com/margelo/nitro/nitrowind/HybridReducedMotion.kt +79 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/HybridThemeCover.kt +38 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/NitroWindCoverLog.kt +36 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/ThemeCoverActivityInitializer.kt +11 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/ThemeCoverController.kt +619 -0
- package/ios/HybridReducedMotion.swift +50 -0
- package/ios/HybridThemeCover.swift +46 -0
- package/ios/NitroWindCoverLog.swift +40 -0
- package/ios/ThemeCoverWindow.swift +324 -0
- package/nitro.json +13 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroWindNative+autolinking.cmake +34 -0
- package/nitrogen/generated/android/NitroWindNative+autolinking.gradle +10 -0
- package/nitrogen/generated/android/NitroWindNativeOnLoad.cpp +25 -0
- package/nitrogen/generated/android/c++/JCallback_void.cpp +54 -0
- package/nitrogen/generated/android/c++/JCallback_void_bool.cpp +56 -0
- package/nitrogen/generated/android/c++/JCoverRequest.cpp +42 -0
- package/nitrogen/generated/android/c++/JHybridReducedMotionSpec.cpp +84 -0
- package/nitrogen/generated/android/c++/JHybridThemeCoverSpec.cpp +114 -0
- package/nitrogen/generated/android/c++/JListenerSubscription.cpp +34 -0
- package/nitrogen/generated/android/c++/JThemeTransitionDirection.cpp +52 -0
- package/nitrogen/generated/android/c++/JThemeTransitionStyle.cpp +58 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCallback_void.hpp +53 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCallback_void_bool.hpp +55 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCoverRequest.hpp +73 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridReducedMotionSpec.hpp +90 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridReducedMotionSpecJavaPart.hpp +26 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridThemeCoverSpec.hpp +96 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridThemeCoverSpecJavaPart.hpp +26 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JListenerSubscription.hpp +49 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionDirection.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionStyle.hpp +82 -0
- package/nitrogen/generated/android/include/NitroWindNative/private/NitroWindNativeOnLoad.hpp +13 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/Callback_void.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/Callback_void_bool.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/CoverRequest.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/HybridReducedMotionSpec.kt +89 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/HybridThemeCoverSpec.kt +107 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ListenerSubscription.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/NitroWindNativeOnLoad.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ThemeTransitionDirection.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ThemeTransitionStyle.kt +52 -0
- package/nitrogen/generated/apple/NitroWindNative-Swift-Cxx-Bridge.cpp +68 -0
- package/nitrogen/generated/apple/NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.cpp +9 -0
- package/nitrogen/generated/apple/NitroWindNativeAppleCxx/include/NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.h +64 -0
- package/nitrogen/generated/apple/NitroWindNativeAutolinking.cpp +22 -0
- package/nitrogen/generated/apple/NitroWindNativeAutolinking.mm +24 -0
- package/nitrogen/generated/apple/c++/CoverRequest-Swift.cpp +36 -0
- package/nitrogen/generated/apple/c++/HybridReducedMotionSpecSwift.cpp +62 -0
- package/nitrogen/generated/apple/c++/HybridReducedMotionSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/HybridThemeCoverSpecSwift.cpp +104 -0
- package/nitrogen/generated/apple/c++/HybridThemeCoverSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/ListenerSubscription-Swift.cpp +37 -0
- package/nitrogen/generated/apple/c++/ThemeTransitionDirection-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/ThemeTransitionStyle-Swift.cpp +52 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/NitroWindNativeAutolinking.hpp +13 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/CoverRequest-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridReducedMotionSpecSwift.hpp +74 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridReducedMotionSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridThemeCoverSpecSwift.hpp +79 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridThemeCoverSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ListenerSubscription-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/NitroWindNative-Swift-Cxx-Umbrella.hpp +41 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ThemeTransitionDirection-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ThemeTransitionStyle-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/module.modulemap +12 -0
- package/nitrogen/generated/apple/swift/Callback_void.swift +60 -0
- package/nitrogen/generated/apple/swift/Callback_void_bool.swift +60 -0
- package/nitrogen/generated/apple/swift/CoverRequest.swift +56 -0
- package/nitrogen/generated/apple/swift/HybridReducedMotionSpec.swift +66 -0
- package/nitrogen/generated/apple/swift/HybridReducedMotionSpec_cxx.swift +164 -0
- package/nitrogen/generated/apple/swift/HybridThemeCoverSpec.swift +70 -0
- package/nitrogen/generated/apple/swift/HybridThemeCoverSpec_cxx.swift +207 -0
- package/nitrogen/generated/apple/swift/ListenerSubscription.swift +29 -0
- package/nitrogen/generated/apple/swift/Promise_bool.swift +100 -0
- package/nitrogen/generated/apple/swift/Promise_void.swift +100 -0
- package/nitrogen/generated/apple/swift/ThemeTransitionDirection.swift +54 -0
- package/nitrogen/generated/apple/swift/ThemeTransitionStyle.swift +64 -0
- package/nitrogen/generated/hybrid-classes.json +33 -0
- package/nitrogen/generated/shared/c++/NitroWindNativeCxxModule.cpp +2 -0
- package/nitrogen/generated/shared/c++/include/NitroWindNative/NitroWindNativeCxxModule.hpp +2 -0
- package/nitrogen/generated/shared/javascript/ReducedMotion.cjs +19 -0
- package/nitrogen/generated/shared/javascript/ReducedMotion.d.cts +9 -0
- package/nitrogen/generated/shared/javascript/ThemeCover.cjs +19 -0
- package/nitrogen/generated/shared/javascript/ThemeCover.d.cts +9 -0
- package/package.json +69 -4
- package/src/index.ts +59 -0
- package/src/specs/ListenerSubscription.ts +3 -0
- package/src/specs/ReducedMotion.nitro.ts +19 -0
- package/src/specs/ThemeCover.nitro.ts +49 -0
- package/src/testing.ts +18 -0
package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridThemeCoverSpec.hpp
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridThemeCoverSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <NitroModules/HybridClass.hpp>
|
|
12
|
+
#include <fbjni/fbjni.h>
|
|
13
|
+
#include <stdexcept>
|
|
14
|
+
#include <NitroWindNative/private/JHybridThemeCoverSpecJavaPart.hpp>
|
|
15
|
+
#include <NitroModules/JNIConverter+Primitives.hpp>
|
|
16
|
+
#include <NitroModules/JSIConverter+JNIPrimitives.hpp>
|
|
17
|
+
#include <NitroModules/JNIConverter+Promise.hpp>
|
|
18
|
+
#include <NitroModules/JSIConverter+JTypedPromise.hpp>
|
|
19
|
+
#include <NitroModules/JNIConverter+String.hpp>
|
|
20
|
+
#include <NitroModules/JSIConverter+JString.hpp>
|
|
21
|
+
#include <NitroWindNative/private/JCoverRequest.hpp>
|
|
22
|
+
#include <NitroWindNative/private/JHybridThemeCoverSpec.hpp>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include <NitroModules/JNIConverter+HybridObject.hpp>
|
|
25
|
+
// Forward declaration of `JHybridThemeCoverSpec` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::nitrowind { class JHybridThemeCoverSpec; }
|
|
27
|
+
|
|
28
|
+
namespace margelo::nitro::nitrowind {
|
|
29
|
+
|
|
30
|
+
namespace jni = facebook::jni;
|
|
31
|
+
|
|
32
|
+
class JHybridThemeCoverSpec final : public JHybridObject {
|
|
33
|
+
public:
|
|
34
|
+
struct Class {
|
|
35
|
+
using Base = JHybridObject::Class;
|
|
36
|
+
static constexpr const char* name = "ThemeCover";
|
|
37
|
+
static const std::shared_ptr<const HybridClass>& get();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
using JavaPart = JHybridThemeCoverSpecJavaPart;
|
|
42
|
+
struct CxxPart : public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
43
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrowind/HybridThemeCoverSpec$CxxPart;";
|
|
44
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
45
|
+
static void registerNatives();
|
|
46
|
+
static jni::alias_ref<jni::JClass> getClass();
|
|
47
|
+
using HybridBase::HybridBase;
|
|
48
|
+
protected:
|
|
49
|
+
std::shared_ptr<JHybridObject> createHybridObject(jni::alias_ref<JHybridObject::JavaPart> javaPart) override;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
explicit JHybridThemeCoverSpec(jni::alias_ref<JHybridThemeCoverSpec::JavaPart> javaPart):
|
|
54
|
+
JHybridObject(javaPart),
|
|
55
|
+
_javaPart(jni::static_ref_cast<JavaPart>(JHybridObject::getJavaPart())) {
|
|
56
|
+
#ifdef NITRO_DEBUG
|
|
57
|
+
if (!jni::isSameObject(_javaPart->getClass(), CxxPart::getClass())) [[unlikely]] {
|
|
58
|
+
throw std::runtime_error("ThemeCover requires its configured implementation when inheritance and multiple implementations are disabled.");
|
|
59
|
+
}
|
|
60
|
+
#endif
|
|
61
|
+
}
|
|
62
|
+
// Defined in the owning library so RTTI has one identity across modules.
|
|
63
|
+
~JHybridThemeCoverSpec() override;
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
inline jni::alias_ref<JHybridThemeCoverSpec::JavaPart> getJavaPart() const noexcept {
|
|
67
|
+
return _javaPart;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
// Properties
|
|
72
|
+
jboolean getIsSyncCaptureSupported();
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
// Methods
|
|
76
|
+
jboolean captureCoverSync(const jni::local_ref<JCoverRequest>& request);
|
|
77
|
+
jni::local_ref<JTypedPromise<jni::local_ref<jni::JBoolean>>> captureCoverAsync(const jni::local_ref<JCoverRequest>& request);
|
|
78
|
+
jni::local_ref<JTypedPromise<void>> finishCover();
|
|
79
|
+
void cancelCover();
|
|
80
|
+
jboolean isCoverActive();
|
|
81
|
+
jni::local_ref<jni::JString> lastCaptureOutcome();
|
|
82
|
+
|
|
83
|
+
public:
|
|
84
|
+
// Constructor and static members
|
|
85
|
+
static std::shared_ptr<JHybridThemeCoverSpec> constructor();
|
|
86
|
+
|
|
87
|
+
protected:
|
|
88
|
+
const std::shared_ptr<const HybridClass>& getHybridClass() override {
|
|
89
|
+
return Class::get();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private:
|
|
93
|
+
jni::alias_ref<JHybridThemeCoverSpec::JavaPart> _javaPart;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
} // namespace margelo::nitro::nitrowind
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridThemeCoverSpecJavaPart.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include <memory>
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro::nitrowind {
|
|
15
|
+
|
|
16
|
+
namespace jni = facebook::jni;
|
|
17
|
+
|
|
18
|
+
class JHybridThemeCoverSpec;
|
|
19
|
+
|
|
20
|
+
struct JHybridThemeCoverSpecJavaPart : public jni::JavaClass<JHybridThemeCoverSpecJavaPart, JHybridObject::JavaPart> {
|
|
21
|
+
using HybridType = JHybridThemeCoverSpec;
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrowind/HybridThemeCoverSpec;";
|
|
23
|
+
std::shared_ptr<JHybridThemeCoverSpec> getJHybridThemeCoverSpec();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
} // namespace margelo::nitro::nitrowind
|
package/nitrogen/generated/android/c++/include/NitroWindNative/private/JListenerSubscription.hpp
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JListenerSubscription.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#include <NitroWindNative/private/JCallback_void.hpp>
|
|
13
|
+
#include <NitroModules/JNIConverter+Callback.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::nitrowind {
|
|
16
|
+
|
|
17
|
+
namespace jni = facebook::jni;
|
|
18
|
+
|
|
19
|
+
/** JNI access to the Kotlin data class ListenerSubscription. */
|
|
20
|
+
struct JListenerSubscription final : public jni::JavaClass<JListenerSubscription> {
|
|
21
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrowind/ListenerSubscription;";
|
|
22
|
+
|
|
23
|
+
static jni::local_ref<JListenerSubscription> create(jni::alias_ref<JCallback<margelo::nitro::nitrowind::JCallback_void::JavaPart>> remove) {
|
|
24
|
+
static const auto clazz = javaClassStatic();
|
|
25
|
+
static const auto create = clazz->getStaticMethod<JListenerSubscription(jni::alias_ref<JCallback<margelo::nitro::nitrowind::JCallback_void::JavaPart>>)>("fromCpp");
|
|
26
|
+
return create(clazz, remove);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
jni::local_ref<JCallback<margelo::nitro::nitrowind::JCallback_void::JavaPart>> getRemove() const {
|
|
30
|
+
static const auto field = javaClassStatic()->getField<JCallback<margelo::nitro::nitrowind::JCallback_void::JavaPart>>("remove");
|
|
31
|
+
return getFieldValue(field);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
} // namespace margelo::nitro::nitrowind
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro {
|
|
38
|
+
|
|
39
|
+
namespace jni = facebook::jni;
|
|
40
|
+
namespace jsi = facebook::jsi;
|
|
41
|
+
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<jni::local_ref<margelo::nitro::nitrowind::JListenerSubscription>> {
|
|
44
|
+
static jni::local_ref<margelo::nitro::nitrowind::JListenerSubscription> fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
45
|
+
static jsi::Value toJSI(jsi::Runtime& runtime, jni::alias_ref<margelo::nitro::nitrowind::JListenerSubscription> value);
|
|
46
|
+
static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro
|
package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionDirection.hpp
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JThemeTransitionDirection.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#include <stdexcept>
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro::nitrowind {
|
|
15
|
+
|
|
16
|
+
namespace jni = facebook::jni;
|
|
17
|
+
|
|
18
|
+
/** JNI access to the Kotlin enum ThemeTransitionDirection. */
|
|
19
|
+
struct JThemeTransitionDirection final : public jni::JavaClass<JThemeTransitionDirection> {
|
|
20
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrowind/ThemeTransitionDirection;";
|
|
21
|
+
|
|
22
|
+
int32_t value() const {
|
|
23
|
+
static const auto field = javaClassStatic()->getField<jint>("value");
|
|
24
|
+
return getFieldValue(field);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static jni::local_ref<JThemeTransitionDirection> fromValue(int32_t value) {
|
|
28
|
+
return jni::make_local(borrowedFromValue(value));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static jni::alias_ref<JThemeTransitionDirection> borrowedFromValue(int32_t value) {
|
|
32
|
+
static const auto clazz = javaClassStatic();
|
|
33
|
+
switch (value) {
|
|
34
|
+
case 0: {
|
|
35
|
+
static const auto field_LEFT = clazz->getStaticField<JThemeTransitionDirection>("LEFT");
|
|
36
|
+
static const auto instance_LEFT = jni::make_global(clazz->getStaticFieldValue(field_LEFT));
|
|
37
|
+
return instance_LEFT;
|
|
38
|
+
}
|
|
39
|
+
case 1: {
|
|
40
|
+
static const auto field_RIGHT = clazz->getStaticField<JThemeTransitionDirection>("RIGHT");
|
|
41
|
+
static const auto instance_RIGHT = jni::make_global(clazz->getStaticFieldValue(field_RIGHT));
|
|
42
|
+
return instance_RIGHT;
|
|
43
|
+
}
|
|
44
|
+
default: [[unlikely]]
|
|
45
|
+
throw std::invalid_argument("Invalid ThemeTransitionDirection value: " + std::to_string(value));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
} // namespace margelo::nitro::nitrowind
|
|
51
|
+
|
|
52
|
+
namespace margelo::nitro {
|
|
53
|
+
|
|
54
|
+
namespace jni = facebook::jni;
|
|
55
|
+
namespace jsi = facebook::jsi;
|
|
56
|
+
|
|
57
|
+
template <>
|
|
58
|
+
struct JSIConverter<jni::local_ref<margelo::nitro::nitrowind::JThemeTransitionDirection>> {
|
|
59
|
+
static jni::local_ref<margelo::nitro::nitrowind::JThemeTransitionDirection> fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
60
|
+
static jsi::Value toJSI(jsi::Runtime& runtime, jni::alias_ref<margelo::nitro::nitrowind::JThemeTransitionDirection> value);
|
|
61
|
+
static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value);
|
|
62
|
+
protected:
|
|
63
|
+
static int32_t valueFromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// These aliases borrow the immutable singleton owners in borrowedFromValue().
|
|
67
|
+
template <>
|
|
68
|
+
struct JSIConverter<jni::alias_ref<margelo::nitro::nitrowind::JThemeTransitionDirection>> : JSIConverter<jni::local_ref<margelo::nitro::nitrowind::JThemeTransitionDirection>> {
|
|
69
|
+
static jni::alias_ref<margelo::nitro::nitrowind::JThemeTransitionDirection> fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
} // namespace margelo::nitro
|
package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionStyle.hpp
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JThemeTransitionStyle.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#include <stdexcept>
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro::nitrowind {
|
|
15
|
+
|
|
16
|
+
namespace jni = facebook::jni;
|
|
17
|
+
|
|
18
|
+
/** JNI access to the Kotlin enum ThemeTransitionStyle. */
|
|
19
|
+
struct JThemeTransitionStyle final : public jni::JavaClass<JThemeTransitionStyle> {
|
|
20
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitrowind/ThemeTransitionStyle;";
|
|
21
|
+
|
|
22
|
+
int32_t value() const {
|
|
23
|
+
static const auto field = javaClassStatic()->getField<jint>("value");
|
|
24
|
+
return getFieldValue(field);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static jni::local_ref<JThemeTransitionStyle> fromValue(int32_t value) {
|
|
28
|
+
return jni::make_local(borrowedFromValue(value));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static jni::alias_ref<JThemeTransitionStyle> borrowedFromValue(int32_t value) {
|
|
32
|
+
static const auto clazz = javaClassStatic();
|
|
33
|
+
switch (value) {
|
|
34
|
+
case 0: {
|
|
35
|
+
static const auto field_FADE = clazz->getStaticField<JThemeTransitionStyle>("FADE");
|
|
36
|
+
static const auto instance_FADE = jni::make_global(clazz->getStaticFieldValue(field_FADE));
|
|
37
|
+
return instance_FADE;
|
|
38
|
+
}
|
|
39
|
+
case 1: {
|
|
40
|
+
static const auto field_CIRCLE = clazz->getStaticField<JThemeTransitionStyle>("CIRCLE");
|
|
41
|
+
static const auto instance_CIRCLE = jni::make_global(clazz->getStaticFieldValue(field_CIRCLE));
|
|
42
|
+
return instance_CIRCLE;
|
|
43
|
+
}
|
|
44
|
+
case 2: {
|
|
45
|
+
static const auto field_SLIDE = clazz->getStaticField<JThemeTransitionStyle>("SLIDE");
|
|
46
|
+
static const auto instance_SLIDE = jni::make_global(clazz->getStaticFieldValue(field_SLIDE));
|
|
47
|
+
return instance_SLIDE;
|
|
48
|
+
}
|
|
49
|
+
case 3: {
|
|
50
|
+
static const auto field_BLUR = clazz->getStaticField<JThemeTransitionStyle>("BLUR");
|
|
51
|
+
static const auto instance_BLUR = jni::make_global(clazz->getStaticFieldValue(field_BLUR));
|
|
52
|
+
return instance_BLUR;
|
|
53
|
+
}
|
|
54
|
+
default: [[unlikely]]
|
|
55
|
+
throw std::invalid_argument("Invalid ThemeTransitionStyle value: " + std::to_string(value));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
} // namespace margelo::nitro::nitrowind
|
|
61
|
+
|
|
62
|
+
namespace margelo::nitro {
|
|
63
|
+
|
|
64
|
+
namespace jni = facebook::jni;
|
|
65
|
+
namespace jsi = facebook::jsi;
|
|
66
|
+
|
|
67
|
+
template <>
|
|
68
|
+
struct JSIConverter<jni::local_ref<margelo::nitro::nitrowind::JThemeTransitionStyle>> {
|
|
69
|
+
static jni::local_ref<margelo::nitro::nitrowind::JThemeTransitionStyle> fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
70
|
+
static jsi::Value toJSI(jsi::Runtime& runtime, jni::alias_ref<margelo::nitro::nitrowind::JThemeTransitionStyle> value);
|
|
71
|
+
static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value);
|
|
72
|
+
protected:
|
|
73
|
+
static int32_t valueFromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// These aliases borrow the immutable singleton owners in borrowedFromValue().
|
|
77
|
+
template <>
|
|
78
|
+
struct JSIConverter<jni::alias_ref<margelo::nitro::nitrowind::JThemeTransitionStyle>> : JSIConverter<jni::local_ref<margelo::nitro::nitrowind::JThemeTransitionStyle>> {
|
|
79
|
+
static jni::alias_ref<margelo::nitro::nitrowind::JThemeTransitionStyle> fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroWindNativeOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrowind {
|
|
11
|
+
// Call inside facebook::jni::initialize() from JNI_OnLoad.
|
|
12
|
+
void registerAllNatives();
|
|
13
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Callback_void.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nitrowind
|
|
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.Callback
|
|
14
|
+
import com.margelo.nitro.core.Promise
|
|
15
|
+
import com.margelo.nitro.core.CxxCallback
|
|
16
|
+
import com.margelo.nitro.core.callSync
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The JNI representation of `Callback<() -> Unit>`, for the JavaScript callback `() => void`.
|
|
20
|
+
* It holds a C++ `Callback<...>`, which calls either a JS function or a native function.
|
|
21
|
+
* Use `Callback<() -> Unit>` instead of this class in your code.
|
|
22
|
+
*/
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
@Suppress(
|
|
26
|
+
"KotlinJniMissingFunction", "unused",
|
|
27
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
28
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
29
|
+
"PARAMETER_NAME_CHANGED_ON_OVERRIDE",
|
|
30
|
+
)
|
|
31
|
+
class Callback_void @DoNotStrip @Keep private constructor(hybridData: HybridData): CxxCallback(hybridData), Callback.Arity0<Unit> {
|
|
32
|
+
override fun callSync(): Unit {
|
|
33
|
+
callSync_cxx()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun callAsync(): Promise<Unit> {
|
|
37
|
+
return callAsync_cxx()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun callAndForget(): Unit {
|
|
41
|
+
callAndForget_cxx()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Lets C++ call a callback implemented in Kotlin through a JNI entry point.
|
|
46
|
+
* C++ creates it when such a callback crosses JNI.
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
private class Function_cxx(private val callback: Callback<() -> Unit>) {
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
fun call(): Unit {
|
|
54
|
+
this.callback.callSync()
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
private external fun callSync_cxx(): Unit
|
|
61
|
+
|
|
62
|
+
@DoNotStrip
|
|
63
|
+
@Keep
|
|
64
|
+
private external fun callAsync_cxx(): Promise<Unit>
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
private external fun callAndForget_cxx(): Unit
|
|
69
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Callback_void_bool.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nitrowind
|
|
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.Callback
|
|
14
|
+
import com.margelo.nitro.core.Promise
|
|
15
|
+
import com.margelo.nitro.core.CxxCallback
|
|
16
|
+
import com.margelo.nitro.core.callSync
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The JNI representation of `Callback<(reducedMotion: Boolean) -> Unit>`, for the JavaScript callback `(reducedMotion: boolean) => void`.
|
|
20
|
+
* It holds a C++ `Callback<...>`, which calls either a JS function or a native function.
|
|
21
|
+
* Use `Callback<(reducedMotion: Boolean) -> Unit>` instead of this class in your code.
|
|
22
|
+
*/
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
@Suppress(
|
|
26
|
+
"KotlinJniMissingFunction", "unused",
|
|
27
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
28
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
29
|
+
"PARAMETER_NAME_CHANGED_ON_OVERRIDE",
|
|
30
|
+
)
|
|
31
|
+
class Callback_void_bool @DoNotStrip @Keep private constructor(hybridData: HybridData): CxxCallback(hybridData), Callback.Arity1<Boolean, Unit> {
|
|
32
|
+
override fun callSync(reducedMotion: Boolean): Unit {
|
|
33
|
+
callSync_cxx(reducedMotion)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun callAsync(reducedMotion: Boolean): Promise<Unit> {
|
|
37
|
+
return callAsync_cxx(reducedMotion)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun callAndForget(reducedMotion: Boolean): Unit {
|
|
41
|
+
callAndForget_cxx(reducedMotion)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Lets C++ call a callback implemented in Kotlin through a JNI entry point.
|
|
46
|
+
* C++ creates it when such a callback crosses JNI.
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
private class Function_cxx(private val callback: Callback<(reducedMotion: Boolean) -> Unit>) {
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
fun call(reducedMotion: Boolean): Unit {
|
|
54
|
+
this.callback.callSync(reducedMotion)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
private external fun callSync_cxx(reducedMotion: Boolean): Unit
|
|
61
|
+
|
|
62
|
+
@DoNotStrip
|
|
63
|
+
@Keep
|
|
64
|
+
private external fun callAsync_cxx(reducedMotion: Boolean): Promise<Unit>
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
private external fun callAndForget_cxx(reducedMotion: Boolean): Unit
|
|
69
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CoverRequest.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nitrowind
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "CoverRequest".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class CoverRequest(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val style: ThemeTransitionStyle,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val durationMs: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val originX: Double?,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val originY: Double?,
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
val direction: ThemeTransitionDirection?
|
|
35
|
+
) {
|
|
36
|
+
override fun equals(other: Any?): Boolean {
|
|
37
|
+
if (this === other) return true
|
|
38
|
+
if (other !is CoverRequest) return false
|
|
39
|
+
return this.style == other.style
|
|
40
|
+
&& this.durationMs.toBits() == other.durationMs.toBits()
|
|
41
|
+
&& (this.originX == null && other.originX == null || this.originX != null && other.originX != null && this.originX.toBits() == other.originX.toBits())
|
|
42
|
+
&& (this.originY == null && other.originY == null || this.originY != null && other.originY != null && this.originY.toBits() == other.originY.toBits())
|
|
43
|
+
&& (this.direction == null && other.direction == null || this.direction != null && other.direction != null && this.direction == other.direction)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override fun hashCode(): Int {
|
|
47
|
+
var result = this.style.hashCode()
|
|
48
|
+
result = 31 * result + this.durationMs.hashCode()
|
|
49
|
+
result = 31 * result + (if (this.originX != null) this.originX.hashCode() else 0)
|
|
50
|
+
result = 31 * result + (if (this.originY != null) this.originY.hashCode() else 0)
|
|
51
|
+
result = 31 * result + (if (this.direction != null) this.direction.hashCode() else 0)
|
|
52
|
+
return result
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
companion object {
|
|
56
|
+
/**
|
|
57
|
+
* Constructor called from C++
|
|
58
|
+
*/
|
|
59
|
+
@DoNotStrip
|
|
60
|
+
@Keep
|
|
61
|
+
@Suppress("unused")
|
|
62
|
+
@JvmStatic
|
|
63
|
+
private fun fromCpp(style: ThemeTransitionStyle, durationMs: Double, originX: Double?, originY: Double?, direction: ThemeTransitionDirection?): CoverRequest {
|
|
64
|
+
return CoverRequest(style, durationMs, originX, originY, direction)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/HybridReducedMotionSpec.kt
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReducedMotionSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nitrowind
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.core.Callback
|
|
15
|
+
import com.margelo.nitro.nitrowind.HybridReducedMotion
|
|
16
|
+
import com.margelo.nitro.core.HybridObject
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A Kotlin class representing the ReducedMotion HybridObject.
|
|
20
|
+
* Implement this abstract class to create Kotlin-based instances of ReducedMotion.
|
|
21
|
+
*/
|
|
22
|
+
@DoNotStrip
|
|
23
|
+
@Keep
|
|
24
|
+
@Suppress(
|
|
25
|
+
"KotlinJniMissingFunction", "unused",
|
|
26
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
27
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
28
|
+
)
|
|
29
|
+
abstract class HybridReducedMotionSpec: HybridObject() {
|
|
30
|
+
// Properties
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// Methods
|
|
34
|
+
@DoNotStrip
|
|
35
|
+
@Keep
|
|
36
|
+
abstract fun isReducedMotionEnabled(): Boolean
|
|
37
|
+
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
abstract fun addOnReducedMotionChangedListener(listener: Callback<(reducedMotion: Boolean) -> Unit>): ListenerSubscription
|
|
41
|
+
|
|
42
|
+
// Default implementation of `HybridObject.toString()`
|
|
43
|
+
override fun toString(): String {
|
|
44
|
+
return "[HybridObject ReducedMotion]"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// C++ backing class
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
protected open class CxxPart(javaPart: HybridReducedMotionSpec): HybridObject.CxxPart(javaPart) {
|
|
51
|
+
// C++ JHybridReducedMotionSpec::CxxPart::initHybrid(...)
|
|
52
|
+
@FastNative
|
|
53
|
+
external override fun initHybrid(): HybridData
|
|
54
|
+
|
|
55
|
+
companion object {
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
@JvmField
|
|
59
|
+
val implementationClass_cxx: Class<out HybridReducedMotionSpec> = HybridReducedMotion::class.java
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
override fun createCxxPart(): CxxPart {
|
|
63
|
+
return CxxPart(this)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface Companion {
|
|
67
|
+
// Static Properties
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// Static Methods
|
|
71
|
+
/** Creates an instance for JavaScript's `new ReducedMotion(...)`. */
|
|
72
|
+
fun constructor(): HybridReducedMotion
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected companion object Bridge {
|
|
76
|
+
protected const val TAG = "HybridReducedMotionSpec"
|
|
77
|
+
|
|
78
|
+
private val implementationCompanion: Companion
|
|
79
|
+
get() = HybridReducedMotion
|
|
80
|
+
|
|
81
|
+
// Constructor
|
|
82
|
+
@JvmStatic
|
|
83
|
+
@DoNotStrip
|
|
84
|
+
@Keep
|
|
85
|
+
private fun constructor_cxx(): HybridReducedMotionSpec {
|
|
86
|
+
return HybridReducedMotion.constructor()
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|