@onekeyfe/react-native-image 6.7.0-alpha.409 → 6.7.0-alpha.412
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/README.md +12 -0
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyIcon.kt +93 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImageGlideRegistry.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImagePackage.kt +2 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyNamedSVG.kt +217 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeySVG.kt +31 -0
- package/ios/OneKeyIcon.swift +90 -0
- package/ios/OneKeyImageCoderBridge.h +4 -0
- package/ios/OneKeyImageCoderBridge.m +9 -0
- package/ios/OneKeyNamedSVG.swift +282 -0
- package/ios/tests/OneKeyIconTests.swift +484 -0
- package/lib/module/OneKeyIcon.nitro.js +4 -0
- package/lib/module/icon/assetUrls.js +7 -0
- package/lib/module/icon/dom.js +21 -0
- package/lib/module/icon/index.js +29 -0
- package/lib/module/icon/index.web.js +32 -0
- package/lib/module/icon/props.js +22 -0
- package/lib/module/package.json +6 -1
- package/lib/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.cpp +67 -0
- package/lib/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.hpp +66 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.cpp +79 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.hpp +54 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyIconSpec.kt +65 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconManager.kt +96 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/android/onekeyimage+autolinking.cmake +4 -0
- package/lib/nitrogen/generated/android/onekeyimageOnLoad.cpp +18 -0
- package/lib/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.cpp +17 -0
- package/lib/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.hpp +32 -15
- package/lib/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Umbrella.hpp +5 -0
- package/lib/nitrogen/generated/ios/OneKeyImageAutolinking.mm +8 -0
- package/lib/nitrogen/generated/ios/OneKeyImageAutolinking.swift +12 -0
- package/lib/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.hpp +89 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridOneKeyIconComponent.mm +150 -0
- package/lib/nitrogen/generated/ios/swift/HybridOneKeyIconSpec.swift +56 -0
- package/lib/nitrogen/generated/ios/swift/HybridOneKeyIconSpec_cxx.swift +193 -0
- package/lib/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.cpp +24 -0
- package/lib/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.hpp +66 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.cpp +36 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.hpp +88 -0
- package/lib/nitrogen/generated/shared/json/OneKeyIconConfig.json +11 -0
- package/lib/typescript/src/OneKeyIcon.nitro.d.ts +7 -0
- package/lib/typescript/src/icon/assetUrls.d.ts +2 -0
- package/lib/typescript/src/icon/dom.d.ts +3 -0
- package/lib/typescript/src/icon/index.d.ts +140 -0
- package/lib/typescript/src/icon/index.web.d.ts +134 -0
- package/lib/typescript/src/icon/props.d.ts +8 -0
- package/nitro.json +10 -0
- package/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.cpp +67 -0
- package/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.cpp +79 -0
- package/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyIconSpec.kt +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconStateUpdater.kt +23 -0
- package/nitrogen/generated/android/onekeyimage+autolinking.cmake +4 -0
- package/nitrogen/generated/android/onekeyimageOnLoad.cpp +18 -0
- package/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.hpp +32 -15
- package/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/OneKeyImageAutolinking.mm +8 -0
- package/nitrogen/generated/ios/OneKeyImageAutolinking.swift +12 -0
- package/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.hpp +89 -0
- package/nitrogen/generated/ios/c++/views/HybridOneKeyIconComponent.mm +150 -0
- package/nitrogen/generated/ios/swift/HybridOneKeyIconSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridOneKeyIconSpec_cxx.swift +193 -0
- package/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.cpp +36 -0
- package/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.hpp +88 -0
- package/nitrogen/generated/shared/json/OneKeyIconConfig.json +11 -0
- package/package.json +40 -7
- package/scripts/configure-icon-imports.mjs +7 -0
- package/scripts/icon-fixtures.test.mjs +398 -0
- package/src/OneKeyIcon.nitro.ts +8 -0
- package/src/icon/assetUrls.ts +4 -0
- package/src/icon/dom.ts +21 -0
- package/src/icon/index.tsx +38 -0
- package/src/icon/index.web.tsx +36 -0
- package/src/icon/props.ts +38 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridOneKeyIconSpec.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 "JHybridOneKeyIconSpec.hpp"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#include <string>
|
|
13
|
+
#include <optional>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::onekeyimage {
|
|
16
|
+
|
|
17
|
+
std::shared_ptr<JHybridOneKeyIconSpec> JHybridOneKeyIconSpec::JavaPart::getJHybridOneKeyIconSpec() {
|
|
18
|
+
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
19
|
+
auto castHybridObject = std::dynamic_pointer_cast<JHybridOneKeyIconSpec>(hybridObject);
|
|
20
|
+
if (castHybridObject == nullptr) [[unlikely]] {
|
|
21
|
+
throw std::runtime_error("Failed to downcast JHybridObject to JHybridOneKeyIconSpec!");
|
|
22
|
+
}
|
|
23
|
+
return castHybridObject;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
jni::local_ref<JHybridOneKeyIconSpec::CxxPart::jhybriddata> JHybridOneKeyIconSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
27
|
+
return makeCxxInstance(jThis);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
std::shared_ptr<JHybridObject> JHybridOneKeyIconSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
31
|
+
auto castJavaPart = jni::dynamic_ref_cast<JHybridOneKeyIconSpec::JavaPart>(javaPart);
|
|
32
|
+
if (castJavaPart == nullptr) [[unlikely]] {
|
|
33
|
+
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridOneKeyIconSpec::JavaPart!");
|
|
34
|
+
}
|
|
35
|
+
return std::make_shared<JHybridOneKeyIconSpec>(castJavaPart);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void JHybridOneKeyIconSpec::CxxPart::registerNatives() {
|
|
39
|
+
registerHybrid({
|
|
40
|
+
makeNativeMethod("initHybrid", JHybridOneKeyIconSpec::CxxPart::initHybrid),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Properties
|
|
45
|
+
std::optional<std::string> JHybridOneKeyIconSpec::getIconName() {
|
|
46
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getIconName");
|
|
47
|
+
auto __result = method(_javaPart);
|
|
48
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
49
|
+
}
|
|
50
|
+
void JHybridOneKeyIconSpec::setIconName(const std::optional<std::string>& iconName) {
|
|
51
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* iconName */)>("setIconName");
|
|
52
|
+
method(_javaPart, iconName.has_value() ? jni::make_jstring(iconName.value()) : nullptr);
|
|
53
|
+
}
|
|
54
|
+
std::optional<std::string> JHybridOneKeyIconSpec::getResolvedColor() {
|
|
55
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getResolvedColor");
|
|
56
|
+
auto __result = method(_javaPart);
|
|
57
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
58
|
+
}
|
|
59
|
+
void JHybridOneKeyIconSpec::setResolvedColor(const std::optional<std::string>& resolvedColor) {
|
|
60
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* resolvedColor */)>("setResolvedColor");
|
|
61
|
+
method(_javaPart, resolvedColor.has_value() ? jni::make_jstring(resolvedColor.value()) : nullptr);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Methods
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::onekeyimage
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOneKeyIconSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridOneKeyIconSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::onekeyimage {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridOneKeyIconSpec: public virtual HybridOneKeyIconSpec, public virtual JHybridObject {
|
|
22
|
+
public:
|
|
23
|
+
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/onekeyimage/HybridOneKeyIconSpec;";
|
|
25
|
+
std::shared_ptr<JHybridOneKeyIconSpec> getJHybridOneKeyIconSpec();
|
|
26
|
+
};
|
|
27
|
+
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/onekeyimage/HybridOneKeyIconSpec$CxxPart;";
|
|
29
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
+
static void registerNatives();
|
|
31
|
+
using HybridBase::HybridBase;
|
|
32
|
+
protected:
|
|
33
|
+
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
explicit JHybridOneKeyIconSpec(const jni::local_ref<JHybridOneKeyIconSpec::JavaPart>& javaPart):
|
|
38
|
+
HybridObject(HybridOneKeyIconSpec::TAG),
|
|
39
|
+
JHybridObject(javaPart),
|
|
40
|
+
_javaPart(jni::make_global(javaPart)) {}
|
|
41
|
+
~JHybridOneKeyIconSpec() override {
|
|
42
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
43
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridOneKeyIconSpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
std::optional<std::string> getIconName() override;
|
|
54
|
+
void setIconName(const std::optional<std::string>& iconName) override;
|
|
55
|
+
std::optional<std::string> getResolvedColor() override;
|
|
56
|
+
void setResolvedColor(const std::optional<std::string>& resolvedColor) override;
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
// Methods
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
private:
|
|
63
|
+
jni::global_ref<JHybridOneKeyIconSpec::JavaPart> _javaPart;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace margelo::nitro::onekeyimage
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridOneKeyIconStateUpdater.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 "JHybridOneKeyIconStateUpdater.hpp"
|
|
9
|
+
#include "views/HybridOneKeyIconComponent.hpp"
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::onekeyimage::views {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
using ConcreteStateData = react::ConcreteState<HybridOneKeyIconState>;
|
|
17
|
+
|
|
18
|
+
std::shared_ptr<const HybridOneKeyIconProps> JHybridOneKeyIconStateUpdater::getPropsFromStateWrapper(
|
|
19
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapper) {
|
|
20
|
+
if (stateWrapper.get() == nullptr) {
|
|
21
|
+
return nullptr;
|
|
22
|
+
}
|
|
23
|
+
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
24
|
+
jobject rawStateWrapper = stateWrapper.get();
|
|
25
|
+
if (!stateWrapper->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
27
|
+
}
|
|
28
|
+
auto stateWrapperImpl = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
29
|
+
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)
|
|
30
|
+
};
|
|
31
|
+
std::shared_ptr<const react::State> state = stateWrapperImpl->cthis()->getState();
|
|
32
|
+
if (state == nullptr) {
|
|
33
|
+
return nullptr;
|
|
34
|
+
}
|
|
35
|
+
auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
|
|
36
|
+
const HybridOneKeyIconState& data = concreteState->getData();
|
|
37
|
+
const std::shared_ptr<const HybridOneKeyIconProps>& props = data.getProps();
|
|
38
|
+
if (props == nullptr) [[unlikely]] {
|
|
39
|
+
throw std::runtime_error("HybridOneKeyIconState's data doesn't contain any props!");
|
|
40
|
+
}
|
|
41
|
+
return props;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
void JHybridOneKeyIconStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
45
|
+
jni::alias_ref<JHybridOneKeyIconSpec::JavaPart> javaView,
|
|
46
|
+
jni::alias_ref<JStateWrapper::javaobject> newState,
|
|
47
|
+
jni::alias_ref<JStateWrapper::javaobject> oldState) {
|
|
48
|
+
std::shared_ptr<JHybridOneKeyIconSpec> hybridView = javaView->getJHybridOneKeyIconSpec();
|
|
49
|
+
std::shared_ptr<const HybridOneKeyIconProps> newProps = getPropsFromStateWrapper(newState);
|
|
50
|
+
std::shared_ptr<const HybridOneKeyIconProps> oldProps = getPropsFromStateWrapper(oldState);
|
|
51
|
+
if (newProps == nullptr) [[unlikely]] {
|
|
52
|
+
throw std::runtime_error("Current StateWrapper doesn't contain any props!");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Update only props that differ from the previous State snapshot.
|
|
56
|
+
if (oldProps == nullptr
|
|
57
|
+
? newProps->iconName.isProvided()
|
|
58
|
+
: !newProps->iconName.hasSameValue(oldProps->iconName)) {
|
|
59
|
+
hybridView->setIconName(newProps->iconName.get());
|
|
60
|
+
}
|
|
61
|
+
if (oldProps == nullptr
|
|
62
|
+
? newProps->resolvedColor.isProvided()
|
|
63
|
+
: !newProps->resolvedColor.hasSameValue(oldProps->resolvedColor)) {
|
|
64
|
+
hybridView->setResolvedColor(newProps->resolvedColor.get());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Update hybridRef if it changed
|
|
68
|
+
if (oldProps == nullptr
|
|
69
|
+
? newProps->hybridRef.isProvided()
|
|
70
|
+
: !newProps->hybridRef.hasSameValue(oldProps->hybridRef)) {
|
|
71
|
+
// hybridRef changed - call it with new this
|
|
72
|
+
const auto& maybeFunc = newProps->hybridRef.get();
|
|
73
|
+
if (maybeFunc.has_value()) {
|
|
74
|
+
maybeFunc.value()(hybridView);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro::onekeyimage::views
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridOneKeyIconStateUpdater.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
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error onekeyimage was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
16
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridOneKeyIconSpec.hpp"
|
|
21
|
+
#include "views/HybridOneKeyIconComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::onekeyimage::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridOneKeyIconStateUpdater final: public jni::JavaClass<JHybridOneKeyIconStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/onekeyimage/views/HybridOneKeyIconStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridOneKeyIconSpec::JavaPart> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> newState,
|
|
35
|
+
jni::alias_ref<JStateWrapper::javaobject> oldState);
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
static std::shared_ptr<const HybridOneKeyIconProps> getPropsFromStateWrapper(
|
|
39
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapper);
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
static void registerNatives() {
|
|
43
|
+
// Register JNI calls
|
|
44
|
+
javaClassStatic()->registerNatives({
|
|
45
|
+
makeNativeMethod("updateViewProps", JHybridOneKeyIconStateUpdater::updateViewProps),
|
|
46
|
+
});
|
|
47
|
+
// Register React Native view component descriptor
|
|
48
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridOneKeyIconComponentDescriptor>();
|
|
49
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
50
|
+
providerRegistry->add(provider);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::onekeyimage::views
|
package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyIconSpec.kt
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOneKeyIconSpec.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.onekeyimage
|
|
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.HybridObject
|
|
15
|
+
import com.margelo.nitro.views.HybridView
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the OneKeyIcon HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of OneKeyIcon.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridOneKeyIconSpec: HybridView() {
|
|
29
|
+
// Properties
|
|
30
|
+
@get:DoNotStrip
|
|
31
|
+
@get:Keep
|
|
32
|
+
@set:DoNotStrip
|
|
33
|
+
@set:Keep
|
|
34
|
+
abstract var iconName: String?
|
|
35
|
+
|
|
36
|
+
@get:DoNotStrip
|
|
37
|
+
@get:Keep
|
|
38
|
+
@set:DoNotStrip
|
|
39
|
+
@set:Keep
|
|
40
|
+
abstract var resolvedColor: String?
|
|
41
|
+
|
|
42
|
+
// Methods
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// Default implementation of `HybridObject.toString()`
|
|
46
|
+
override fun toString(): String {
|
|
47
|
+
return "[HybridObject OneKeyIcon]"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// C++ backing class
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
protected open class CxxPart(javaPart: HybridOneKeyIconSpec): HybridObject.CxxPart(javaPart) {
|
|
54
|
+
// C++ JHybridOneKeyIconSpec::CxxPart::initHybrid(...)
|
|
55
|
+
@FastNative
|
|
56
|
+
external override fun initHybrid(): HybridData
|
|
57
|
+
}
|
|
58
|
+
override fun createCxxPart(): CxxPart {
|
|
59
|
+
return CxxPart(this)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
companion object {
|
|
63
|
+
protected const val TAG = "HybridOneKeyIconSpec"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOneKeyIconManager.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.onekeyimage.views
|
|
9
|
+
|
|
10
|
+
import android.view.View
|
|
11
|
+
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
12
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
13
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
14
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
|
+
import com.margelo.nitro.R.id.associated_hybrid_view_tag
|
|
16
|
+
import com.margelo.nitro.views.RecyclableView
|
|
17
|
+
import com.margelo.nitro.onekeyimage.*
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents the React Native `ViewManager` for the "OneKeyIcon" Nitro HybridView.
|
|
21
|
+
*/
|
|
22
|
+
public class HybridOneKeyIconManager: SimpleViewManager<View>() {
|
|
23
|
+
/**
|
|
24
|
+
* Represents the View and its last state snapshot (mutable)
|
|
25
|
+
*/
|
|
26
|
+
private class HybridViewHolder(
|
|
27
|
+
val hybridView: HybridOneKeyIcon,
|
|
28
|
+
var lastState: StateWrapper? = null,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
if (RecyclableView::class.java.isAssignableFrom(HybridOneKeyIcon::class.java)) {
|
|
33
|
+
// Enable view recycling
|
|
34
|
+
super.setupViewRecycling()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun getName(): String {
|
|
39
|
+
return "OneKeyIcon"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
|
43
|
+
val hybridView = HybridOneKeyIcon(reactContext)
|
|
44
|
+
val view = hybridView.view
|
|
45
|
+
view.setTag(associated_hybrid_view_tag, HybridViewHolder(hybridView))
|
|
46
|
+
return view
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
50
|
+
val holder = getHybridViewHolder(view)
|
|
51
|
+
?: throw Error("Couldn't find view $view in local views table!")
|
|
52
|
+
val hybridView = holder.hybridView
|
|
53
|
+
val oldState = holder.lastState
|
|
54
|
+
val newState = stateWrapper
|
|
55
|
+
|
|
56
|
+
// 1. Update each prop individually
|
|
57
|
+
hybridView.beforeUpdate()
|
|
58
|
+
HybridOneKeyIconStateUpdater.updateViewProps(hybridView, newState, oldState)
|
|
59
|
+
hybridView.afterUpdate()
|
|
60
|
+
holder.lastState = newState
|
|
61
|
+
|
|
62
|
+
// 2. Continue in base View props
|
|
63
|
+
return super.updateState(view, props, newState)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override fun onDropViewInstance(view: View) {
|
|
67
|
+
val holder = getHybridViewHolder(view)
|
|
68
|
+
holder?.lastState = null
|
|
69
|
+
holder?.hybridView?.onDropView()
|
|
70
|
+
return super.onDropViewInstance(view)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
74
|
+
val preparedView = super.prepareToRecycleView(reactContext, view)
|
|
75
|
+
?: return null
|
|
76
|
+
val holder = getHybridViewHolder(preparedView)
|
|
77
|
+
?: return null
|
|
78
|
+
val hybridView = holder.hybridView
|
|
79
|
+
holder.lastState = null
|
|
80
|
+
|
|
81
|
+
@Suppress("USELESS_IS_CHECK")
|
|
82
|
+
if (hybridView is RecyclableView) {
|
|
83
|
+
// Recycle in it's implementation
|
|
84
|
+
hybridView.prepareForRecycle()
|
|
85
|
+
|
|
86
|
+
// Maybe update the view if it changed
|
|
87
|
+
return hybridView.view
|
|
88
|
+
} else {
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private fun getHybridViewHolder(view: View): HybridViewHolder? {
|
|
94
|
+
return view.getTag(associated_hybrid_view_tag) as? HybridViewHolder
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOneKeyIconStateUpdater.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.onekeyimage.views
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
11
|
+
import com.margelo.nitro.onekeyimage.*
|
|
12
|
+
|
|
13
|
+
internal class HybridOneKeyIconStateUpdater {
|
|
14
|
+
companion object {
|
|
15
|
+
/**
|
|
16
|
+
* Updates the props for [view] through C++.
|
|
17
|
+
* The [newState] prop is expected to contain [view]'s props as wrapped Fabric state.
|
|
18
|
+
*/
|
|
19
|
+
@Suppress("KotlinJniMissingFunction")
|
|
20
|
+
@JvmStatic
|
|
21
|
+
external fun updateViewProps(view: HybridOneKeyIconSpec, newState: StateWrapper, oldState: StateWrapper?)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -33,10 +33,14 @@ target_sources(
|
|
|
33
33
|
# Autolinking Setup
|
|
34
34
|
../nitrogen/generated/android/onekeyimageOnLoad.cpp
|
|
35
35
|
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridOneKeyIconSpec.cpp
|
|
37
|
+
../nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.cpp
|
|
36
38
|
../nitrogen/generated/shared/c++/HybridOneKeyImageCacheSpec.cpp
|
|
37
39
|
../nitrogen/generated/shared/c++/HybridOneKeyImageSpec.cpp
|
|
38
40
|
../nitrogen/generated/shared/c++/views/HybridOneKeyImageComponent.cpp
|
|
39
41
|
# Android-specific Nitrogen C++ sources
|
|
42
|
+
../nitrogen/generated/android/c++/JHybridOneKeyIconSpec.cpp
|
|
43
|
+
../nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.cpp
|
|
40
44
|
../nitrogen/generated/android/c++/JHybridOneKeyImageCacheSpec.cpp
|
|
41
45
|
../nitrogen/generated/android/c++/JHybridOneKeyImageSpec.cpp
|
|
42
46
|
../nitrogen/generated/android/c++/views/JHybridOneKeyImageStateUpdater.cpp
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
#include <fbjni/fbjni.h>
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
|
+
#include "JHybridOneKeyIconSpec.hpp"
|
|
19
|
+
#include "views/JHybridOneKeyIconStateUpdater.hpp"
|
|
18
20
|
#include "JHybridOneKeyImageCacheSpec.hpp"
|
|
19
21
|
#include "JHybridOneKeyImageSpec.hpp"
|
|
20
22
|
#include "JFunc_void.hpp"
|
|
@@ -47,12 +49,22 @@ struct JHybridOneKeyImageCacheSpecImpl: public jni::JavaClass<JHybridOneKeyImage
|
|
|
47
49
|
return javaPart->getJHybridOneKeyImageCacheSpec();
|
|
48
50
|
}
|
|
49
51
|
};
|
|
52
|
+
struct JHybridOneKeyIconSpecImpl: public jni::JavaClass<JHybridOneKeyIconSpecImpl, JHybridOneKeyIconSpec::JavaPart> {
|
|
53
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/onekeyimage/HybridOneKeyIcon;";
|
|
54
|
+
static std::shared_ptr<JHybridOneKeyIconSpec> create() {
|
|
55
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridOneKeyIconSpecImpl::javaobject()>();
|
|
56
|
+
jni::local_ref<JHybridOneKeyIconSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
57
|
+
return javaPart->getJHybridOneKeyIconSpec();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
50
60
|
|
|
51
61
|
void registerAllNatives() {
|
|
52
62
|
using namespace margelo::nitro;
|
|
53
63
|
using namespace margelo::nitro::onekeyimage;
|
|
54
64
|
|
|
55
65
|
// Register native JNI methods
|
|
66
|
+
margelo::nitro::onekeyimage::JHybridOneKeyIconSpec::CxxPart::registerNatives();
|
|
67
|
+
margelo::nitro::onekeyimage::views::JHybridOneKeyIconStateUpdater::registerNatives();
|
|
56
68
|
margelo::nitro::onekeyimage::JHybridOneKeyImageCacheSpec::CxxPart::registerNatives();
|
|
57
69
|
margelo::nitro::onekeyimage::JHybridOneKeyImageSpec::CxxPart::registerNatives();
|
|
58
70
|
margelo::nitro::onekeyimage::JFunc_void_cxx::registerNatives();
|
|
@@ -73,6 +85,12 @@ void registerAllNatives() {
|
|
|
73
85
|
return JHybridOneKeyImageCacheSpecImpl::create();
|
|
74
86
|
}
|
|
75
87
|
);
|
|
88
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
89
|
+
"OneKeyIcon",
|
|
90
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
91
|
+
return JHybridOneKeyIconSpecImpl::create();
|
|
92
|
+
}
|
|
93
|
+
);
|
|
76
94
|
}
|
|
77
95
|
|
|
78
96
|
} // namespace margelo::nitro::onekeyimage
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "OneKeyImage-Swift-Cxx-Bridge.hpp"
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridOneKeyIconSpecSwift.hpp"
|
|
11
12
|
#include "HybridOneKeyImageCacheSpecSwift.hpp"
|
|
12
13
|
#include "HybridOneKeyImageSpecSwift.hpp"
|
|
13
14
|
#include "OneKeyImage-Swift-Cxx-Umbrella.hpp"
|
|
@@ -15,6 +16,22 @@
|
|
|
15
16
|
|
|
16
17
|
namespace margelo::nitro::onekeyimage::bridge::swift {
|
|
17
18
|
|
|
19
|
+
// pragma MARK: std::shared_ptr<HybridOneKeyIconSpec>
|
|
20
|
+
std::shared_ptr<HybridOneKeyIconSpec> create_std__shared_ptr_HybridOneKeyIconSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
21
|
+
OneKeyImage::HybridOneKeyIconSpec_cxx swiftPart = OneKeyImage::HybridOneKeyIconSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
22
|
+
return std::make_shared<margelo::nitro::onekeyimage::HybridOneKeyIconSpecSwift>(swiftPart);
|
|
23
|
+
}
|
|
24
|
+
void* NON_NULL get_std__shared_ptr_HybridOneKeyIconSpec_(std__shared_ptr_HybridOneKeyIconSpec_ cppType) {
|
|
25
|
+
std::shared_ptr<margelo::nitro::onekeyimage::HybridOneKeyIconSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::onekeyimage::HybridOneKeyIconSpecSwift>(cppType);
|
|
26
|
+
#ifdef NITRO_DEBUG
|
|
27
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
28
|
+
throw std::runtime_error("Class \"HybridOneKeyIconSpec\" is not implemented in Swift!");
|
|
29
|
+
}
|
|
30
|
+
#endif
|
|
31
|
+
OneKeyImage::HybridOneKeyIconSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
32
|
+
return swiftPart.toUnsafe();
|
|
33
|
+
}
|
|
34
|
+
|
|
18
35
|
// pragma MARK: std::function<void(bool /* result */)>
|
|
19
36
|
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
20
37
|
auto swiftClosure = OneKeyImage::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridOneKeyIconSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::onekeyimage { class HybridOneKeyIconSpec; }
|
|
11
13
|
// Forward declaration of `HybridOneKeyImageCacheSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::onekeyimage { class HybridOneKeyImageCacheSpec; }
|
|
13
15
|
// Forward declaration of `HybridOneKeyImageSpec` to properly resolve imports.
|
|
@@ -26,12 +28,15 @@ namespace margelo::nitro::onekeyimage { struct OneKeyImagePreloadSource; }
|
|
|
26
28
|
namespace margelo::nitro::onekeyimage { enum class OneKeyImageVariant; }
|
|
27
29
|
|
|
28
30
|
// Forward declarations of Swift defined types
|
|
31
|
+
// Forward declaration of `HybridOneKeyIconSpec_cxx` to properly resolve imports.
|
|
32
|
+
namespace OneKeyImage { class HybridOneKeyIconSpec_cxx; }
|
|
29
33
|
// Forward declaration of `HybridOneKeyImageCacheSpec_cxx` to properly resolve imports.
|
|
30
34
|
namespace OneKeyImage { class HybridOneKeyImageCacheSpec_cxx; }
|
|
31
35
|
// Forward declaration of `HybridOneKeyImageSpec_cxx` to properly resolve imports.
|
|
32
36
|
namespace OneKeyImage { class HybridOneKeyImageSpec_cxx; }
|
|
33
37
|
|
|
34
38
|
// Include C++ defined types
|
|
39
|
+
#include "HybridOneKeyIconSpec.hpp"
|
|
35
40
|
#include "HybridOneKeyImageCacheSpec.hpp"
|
|
36
41
|
#include "HybridOneKeyImageSpec.hpp"
|
|
37
42
|
#include "OneKeyImageCachePolicy.hpp"
|
|
@@ -56,6 +61,33 @@ namespace OneKeyImage { class HybridOneKeyImageSpec_cxx; }
|
|
|
56
61
|
*/
|
|
57
62
|
namespace margelo::nitro::onekeyimage::bridge::swift {
|
|
58
63
|
|
|
64
|
+
// pragma MARK: std::optional<std::string>
|
|
65
|
+
/**
|
|
66
|
+
* Specialized version of `std::optional<std::string>`.
|
|
67
|
+
*/
|
|
68
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
69
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
70
|
+
return std::optional<std::string>(value);
|
|
71
|
+
}
|
|
72
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
73
|
+
return optional.has_value();
|
|
74
|
+
}
|
|
75
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
76
|
+
return optional.value();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// pragma MARK: std::shared_ptr<HybridOneKeyIconSpec>
|
|
80
|
+
/**
|
|
81
|
+
* Specialized version of `std::shared_ptr<HybridOneKeyIconSpec>`.
|
|
82
|
+
*/
|
|
83
|
+
using std__shared_ptr_HybridOneKeyIconSpec_ = std::shared_ptr<HybridOneKeyIconSpec>;
|
|
84
|
+
std::shared_ptr<HybridOneKeyIconSpec> create_std__shared_ptr_HybridOneKeyIconSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
85
|
+
void* NON_NULL get_std__shared_ptr_HybridOneKeyIconSpec_(std__shared_ptr_HybridOneKeyIconSpec_ cppType);
|
|
86
|
+
|
|
87
|
+
// pragma MARK: std::weak_ptr<HybridOneKeyIconSpec>
|
|
88
|
+
using std__weak_ptr_HybridOneKeyIconSpec_ = std::weak_ptr<HybridOneKeyIconSpec>;
|
|
89
|
+
inline std__weak_ptr_HybridOneKeyIconSpec_ weakify_std__shared_ptr_HybridOneKeyIconSpec_(const std::shared_ptr<HybridOneKeyIconSpec>& strong) noexcept { return strong; }
|
|
90
|
+
|
|
59
91
|
// pragma MARK: std::shared_ptr<Promise<bool>>
|
|
60
92
|
/**
|
|
61
93
|
* Specialized version of `std::shared_ptr<Promise<bool>>`.
|
|
@@ -112,21 +144,6 @@ namespace margelo::nitro::onekeyimage::bridge::swift {
|
|
|
112
144
|
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
113
145
|
}
|
|
114
146
|
|
|
115
|
-
// pragma MARK: std::optional<std::string>
|
|
116
|
-
/**
|
|
117
|
-
* Specialized version of `std::optional<std::string>`.
|
|
118
|
-
*/
|
|
119
|
-
using std__optional_std__string_ = std::optional<std::string>;
|
|
120
|
-
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
121
|
-
return std::optional<std::string>(value);
|
|
122
|
-
}
|
|
123
|
-
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
124
|
-
return optional.has_value();
|
|
125
|
-
}
|
|
126
|
-
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
127
|
-
return optional.value();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
147
|
// pragma MARK: std::optional<OneKeyImageCachePolicy>
|
|
131
148
|
/**
|
|
132
149
|
* Specialized version of `std::optional<OneKeyImageCachePolicy>`.
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridOneKeyIconSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::onekeyimage { class HybridOneKeyIconSpec; }
|
|
11
13
|
// Forward declaration of `HybridOneKeyImageCacheSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::onekeyimage { class HybridOneKeyImageCacheSpec; }
|
|
13
15
|
// Forward declaration of `HybridOneKeyImageSpec` to properly resolve imports.
|
|
@@ -26,6 +28,7 @@ namespace margelo::nitro::onekeyimage { struct OneKeyImagePreloadSource; }
|
|
|
26
28
|
namespace margelo::nitro::onekeyimage { enum class OneKeyImageVariant; }
|
|
27
29
|
|
|
28
30
|
// Include C++ defined types
|
|
31
|
+
#include "HybridOneKeyIconSpec.hpp"
|
|
29
32
|
#include "HybridOneKeyImageCacheSpec.hpp"
|
|
30
33
|
#include "HybridOneKeyImageSpec.hpp"
|
|
31
34
|
#include "OneKeyImageCachePolicy.hpp"
|
|
@@ -53,6 +56,8 @@ namespace margelo::nitro::onekeyimage { enum class OneKeyImageVariant; }
|
|
|
53
56
|
#include <NitroModules/DateToChronoDate.hpp>
|
|
54
57
|
|
|
55
58
|
// Forward declarations of Swift defined types
|
|
59
|
+
// Forward declaration of `HybridOneKeyIconSpec_cxx` to properly resolve imports.
|
|
60
|
+
namespace OneKeyImage { class HybridOneKeyIconSpec_cxx; }
|
|
56
61
|
// Forward declaration of `HybridOneKeyImageCacheSpec_cxx` to properly resolve imports.
|
|
57
62
|
namespace OneKeyImage { class HybridOneKeyImageCacheSpec_cxx; }
|
|
58
63
|
// Forward declaration of `HybridOneKeyImageSpec_cxx` to properly resolve imports.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#include "HybridOneKeyImageSpecSwift.hpp"
|
|
14
14
|
#include "HybridOneKeyImageCacheSpecSwift.hpp"
|
|
15
|
+
#include "HybridOneKeyIconSpecSwift.hpp"
|
|
15
16
|
|
|
16
17
|
@interface OneKeyImageAutolinking : NSObject
|
|
17
18
|
@end
|
|
@@ -36,6 +37,13 @@
|
|
|
36
37
|
return hybridObject;
|
|
37
38
|
}
|
|
38
39
|
);
|
|
40
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
41
|
+
"OneKeyIcon",
|
|
42
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
43
|
+
std::shared_ptr<HybridOneKeyIconSpec> hybridObject = OneKeyImage::OneKeyImageAutolinking::createOneKeyIcon();
|
|
44
|
+
return hybridObject;
|
|
45
|
+
}
|
|
46
|
+
);
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
@end
|