| 961 | auto* runtimeManagerWrapper = getRuntimeManagerWrapper(runtimeManagerHandle); |
| 962 | runtimeManagerWrapper->getRuntimeManager().registerModuleFactoriesProvider( |
| 963 | djinni_generated_client::valdi_core::NativeModuleFactoriesProvider::toCpp(env, moduleFactoriesProvider)); |
| 964 | } |
| 965 | |
| 966 | jboolean ValdiAndroid::NativeBridge::isViewNodeLayoutDirectionHorizontal( // NOLINT |
| 967 | fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT |
| 968 | jlong viewNodeHandle) { |
| 969 | auto viewNode = getViewNode(viewNodeHandle); |
| 970 | if (viewNode == nullptr) { |
| 971 | return static_cast<jboolean>(false); |
| 972 | } |
| 973 | |
| 974 | return static_cast<jboolean>(viewNode->isHorizontal()); |
| 975 | } |
| 976 | |
| 977 | jlong ValdiAndroid::NativeBridge::getViewNodePoint( // NOLINT |
| 978 | fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT |
| 979 | jlong runtimeHandle, |
| 980 | jlong viewNodeHandle, |
| 981 | jint x, |
| 982 | jint y, |
| 983 | jint mode, |
| 984 | jboolean fromBoundsOrigin) { |
| 985 | static constexpr jint kModeDirectionAgnosticRelative = 1; |
| 986 | static constexpr jint kModeDirectionAgnosticAbsolute = 2; |
| 987 | static constexpr jint kModeVisualRelative = 3; |
| 988 | static constexpr jint kModeVisualAbsolute = 4; |
| 989 | static constexpr jint kModeViewportRelative = 5; |
| 990 | static constexpr jint kModeViewportAbsolute = 6; |
| 991 | |
| 992 | auto* runtimeWrapper = getRuntimeWrapper(runtimeHandle); |
| 993 | auto viewNode = getViewNode(viewNodeHandle); |
| 994 | if (viewNode == nullptr || runtimeWrapper == nullptr) { |
| 995 | return 0; |
| 996 | } |
| 997 | |
| 998 | auto pointScale = runtimeWrapper->getPointScale(); |
| 999 | |
| 1000 | Valdi::Point input = Valdi::Point(Valdi::pixelsToPoints(static_cast<int32_t>(x), pointScale), |
| 1001 | Valdi::pixelsToPoints(static_cast<int32_t>(y), pointScale)); |
| 1002 | |
| 1003 | if (static_cast<bool>(fromBoundsOrigin)) { |
| 1004 | input = input.withOffset(viewNode->getBoundsOriginPoint()); |
| 1005 | } |
| 1006 | |
| 1007 | Valdi::Point output; |
| 1008 | |
| 1009 | if (mode == kModeDirectionAgnosticRelative) { |
| 1010 | output = viewNode->convertPointToRelativeDirectionAgnostic(input); |
| 1011 | } else if (mode == kModeDirectionAgnosticAbsolute) { |
| 1012 | output = viewNode->convertPointToAbsoluteDirectionAgnostic(input); |
| 1013 | } else if (mode == kModeVisualRelative) { |
| 1014 | output = viewNode->convertSelfVisualToParentVisual(input); |
| 1015 | } else if (mode == kModeVisualAbsolute) { |
| 1016 | output = viewNode->convertSelfVisualToRootVisual(input); |
| 1017 | } else if (mode == kModeViewportRelative) { |
nothing calls this directly
no test coverage detected