diff --git a/frameworks/bridge/arkts_frontend/BUILD.gn b/frameworks/bridge/arkts_frontend/BUILD.gn index bd949a7c027029621f890123f2c9e7a1555aa93e..c45924eb3a15fa0e4f8ca916717a46324cbfe72e 100644 --- a/frameworks/bridge/arkts_frontend/BUILD.gn +++ b/frameworks/bridge/arkts_frontend/BUILD.gn @@ -58,7 +58,6 @@ template("arkts_frontend") { "ani_context_module.cpp", "ani_graphics_module.cpp", "ani_list_module.cpp", - "ani_water_flow_module.cpp", "arkts_ani_utils.cpp", "arkts_frontend.cpp", "arkts_plugin_frontend.cpp", diff --git a/frameworks/bridge/arkts_frontend/ani_water_flow_module.cpp b/frameworks/bridge/arkts_frontend/ani_water_flow_module.cpp deleted file mode 100644 index a5dcee403431cd09efcce87d5f530aa8f0979157..0000000000000000000000000000000000000000 --- a/frameworks/bridge/arkts_frontend/ani_water_flow_module.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "bridge/arkts_frontend/ani_water_flow_module.h" - -#include -#include -#include - -#include "ani_water_flow_module.h" - -#include "base/geometry/calc_dimension.h" -#include "base/utils/string_utils.h" -#include "core/components_ng/base/frame_node.h" -#include "core/components_ng/property/calc_length.h" -#include "core/components_ng/property/measure_property.h" - -namespace { -using namespace OHOS::Ace; - -ani_object CreateDouble(ani_env* env, double value) -{ - CHECK_NULL_RETURN(env, nullptr); - static const char* className = "std.core.Double"; - ani_class doubleCls; - if (ANI_OK != env->FindClass(className, &doubleCls)) { - return nullptr; - } - ani_method doubleCtor; - if (ANI_OK != env->Class_FindMethod(doubleCls, "", "D:V", &doubleCtor)) { - return nullptr; - } - ani_object doubleObj; - if (ANI_OK != env->Object_New(doubleCls, doubleCtor, &doubleObj, static_cast(value))) { - return nullptr; - } - return doubleObj; -} - -std::string ANIUtils_ANIStringToStdString(ani_env* env, ani_string ani_str) -{ - ani_size strSize; - env->String_GetUTF8Size(ani_str, &strSize); - - std::vector buffer(strSize + 1); - char* utf8Buffer = buffer.data(); - - ani_size bytesWritten = 0; - env->String_GetUTF8(ani_str, utf8Buffer, strSize + 1, &bytesWritten); - utf8Buffer[bytesWritten] = '\0'; - std::string content = std::string(utf8Buffer); - return content; -} - -std::optional ParseDimension(ani_env* env, ani_ref dimensionRef) -{ - std::optional res; - ani_class doubleClass; - if (env->FindClass("Lstd/core/Double;", &doubleClass) != ANI_OK) { - return res; - } - ani_class stringClass; - if (env->FindClass("Lstd/core/String;", &stringClass) != ANI_OK) { - return res; - } - - ani_boolean isDouble; - env->Object_InstanceOf(static_cast(dimensionRef), doubleClass, &isDouble); - if (isDouble) { - ani_double dimension; - env->Object_CallMethodByName_Double(static_cast(dimensionRef), "unboxed", ":D", &dimension); - if (dimension < 0) { - dimension = 0; - } - res = CalcDimension(dimension, DimensionUnit::VP); - } - - ani_boolean isString; - env->Object_InstanceOf(static_cast(dimensionRef), stringClass, &isString); - if (isString) { - auto stringDimension = ANIUtils_ANIStringToStdString(env, static_cast(dimensionRef)); - res = StringUtils::StringToDimension(stringDimension, true); - if (res->Value() < 0) { - res->SetValue(0.0); - } - } - return res; -} - -NG::MarginProperty ParsePadding(ani_env* env, ani_ref paddingRef) -{ - NG::MarginProperty res; - std::optional left; - std::optional right; - std::optional top; - std::optional bottom; - - ani_ref leftRef; - env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "left", &leftRef); - left = ParseDimension(env, leftRef); - if (left.has_value()) { - if (left.value().Unit() == DimensionUnit::CALC) { - res.left = NG::CalcLength(left.value().CalcValue()); - } else { - res.left = NG::CalcLength(left.value()); - } - } - - ani_ref rightRef; - env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "right", &rightRef); - right = ParseDimension(env, rightRef); - if (right.has_value()) { - if (right.value().Unit() == DimensionUnit::CALC) { - res.right = NG::CalcLength(right.value().CalcValue()); - } else { - res.right = NG::CalcLength(right.value()); - } - } - - ani_ref topRef; - env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "top", &topRef); - top = ParseDimension(env, topRef); - if (top.has_value()) { - if (top.value().Unit() == DimensionUnit::CALC) { - res.top = NG::CalcLength(top.value().CalcValue()); - } else { - res.top = NG::CalcLength(top.value()); - } - } - - ani_ref bottomRef; - env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "bottom", &bottomRef); - bottom = ParseDimension(env, bottomRef); - if (bottom.has_value()) { - if (bottom.value().Unit() == DimensionUnit::CALC) { - res.bottom = NG::CalcLength(bottom.value().CalcValue()); - } else { - res.bottom = NG::CalcLength(bottom.value()); - } - } - return res; -} - -std::optional ParseMargin(ani_env* env, ani_ref marginRef) -{ - NG::MarginProperty res; - ani_class paddingClass; - if (env->FindClass("Larkui/component/units/Padding;", &paddingClass) != ANI_OK) { - return std::make_optional(res); - } - - ani_boolean isPadding; - env->Object_InstanceOf(static_cast(marginRef), paddingClass, &isPadding); - if (isPadding) { - res = ParsePadding(env, marginRef); - } else { - std::optional length = ParseDimension(env, marginRef); - if (length->Unit() == DimensionUnit::CALC) { - res.SetEdges(NG::CalcLength(length->CalcValue())); - } else { - res.SetEdges(NG::CalcLength(length.value())); - } - } - return std::make_optional(res); -} -} // namespace - -namespace OHOS::Ace::Framework { - -NG::WaterFlowSections::Section AniWaterFlowModule::ParseSectionOptions(ani_env* env, ani_ref section) -{ - NG::WaterFlowSections::Section curSection; - ani_double itemsCount; - if (env->Object_GetPropertyByName_Double(static_cast(section), "itemsCount", &itemsCount) != ANI_OK) { - return curSection; - } - curSection.itemsCount = static_cast(itemsCount); - - ani_ref crossCount; - if (env->Object_GetPropertyByName_Ref(static_cast(section), "crossCount", &crossCount) != ANI_OK) { - curSection.crossCount = 1; - } - ani_boolean isUndefined = false; - if (env->Reference_IsUndefined(crossCount, &isUndefined) != ANI_OK) { - curSection.crossCount = 1; - } - if (!isUndefined) { - ani_double crossCnt; - env->Object_CallMethodByName_Double(static_cast(crossCount), "unboxed", ":D", &crossCnt); - if (crossCnt <= 0) { - crossCnt = 1; - } - curSection.crossCount = static_cast(crossCnt); - } - - ani_ref columnsGap; - env->Object_GetPropertyByName_Ref(static_cast(section), "columnsGap", &columnsGap); - isUndefined = false; - env->Reference_IsUndefined(columnsGap, &isUndefined); - if (!isUndefined) { - curSection.columnsGap = ParseDimension(env, columnsGap); - } - - ani_ref rowsGap; - env->Object_GetPropertyByName_Ref(static_cast(section), "rowsGap", &rowsGap); - isUndefined = false; - env->Reference_IsUndefined(rowsGap, &isUndefined); - if (!isUndefined) { - curSection.rowsGap = ParseDimension(env, rowsGap); - } - - ani_ref margin; - env->Object_GetPropertyByName_Ref(static_cast(section), "margin", &margin); - isUndefined = false; - env->Reference_IsUndefined(margin, &isUndefined); - if (!isUndefined) { - curSection.margin = ParseMargin(env, margin); - } - - ani_ref func; - env->Object_GetPropertyByName_Ref(static_cast(section), "onGetItemMainSizeByIndex", &func); - - ani_class ClassGetItemMainSizeByIndex; - env->FindClass("Lstd/core/Function1;", &ClassGetItemMainSizeByIndex); - ani_boolean isGetItemMainSizeByIndex; - env->Object_InstanceOf(static_cast(func), ClassGetItemMainSizeByIndex, &isGetItemMainSizeByIndex); - - isUndefined = false; - env->Reference_IsUndefined(func, &isUndefined); - - if (isGetItemMainSizeByIndex && !isUndefined) { - ani_ref fnObjGlobalRef = nullptr; - env->GlobalReference_Create(func, &fnObjGlobalRef); - auto onGetItemMainSizeByIndex = [fnObjGlobalRef, env](int32_t index) { - ani_ref aniRes; - ani_ref aniIdx = CreateDouble(env, ani_double(index)); - - env->FunctionalObject_Call(static_cast(fnObjGlobalRef), 1, &aniIdx, &aniRes); - ani_double res; - env->Object_CallMethodByName_Double(static_cast(aniRes), "unboxed", ":D", &res); - return static_cast(res); - }; - curSection.onGetItemMainSizeByIndex = std::move(onGetItemMainSizeByIndex); - } - - return curSection; -} - -void AniWaterFlowModule::ParseWaterFlowSections(ani_env* env, ani_ref sections, NG::FrameNode* frameNode) -{ - auto waterFlowSections = NG::WaterFlowModelNG::GetOrCreateWaterFlowSections(frameNode); - CHECK_NULL_VOID(waterFlowSections); - - ani_ref changeArray; - if (env->Object_GetPropertyByName_Ref(static_cast(sections), "changeArray", &changeArray) != ANI_OK) { - return; - } - ani_size changeArrayLength; - if (env->Array_GetLength(static_cast(changeArray), &changeArrayLength) != ANI_OK) { - } - - ani_class sectionChangeInfo; - if (env->FindClass("Larkui/component/waterFlow/SectionChangeInfo;", §ionChangeInfo) != ANI_OK) { - return; - } - - ani_class sectionOptions; - if (env->FindClass("Larkui/component/waterFlow/SectionOptions;", §ionOptions) != ANI_OK) { - return; - } - - for (int32_t i = 0; i < changeArrayLength; i++) { - ani_ref change; - if (env->Array_Get_Ref(static_cast(changeArray), i, &change) != ANI_OK) { - continue; - } - - ani_boolean isSectionChangeInfo; - env->Object_InstanceOf(static_cast(change), sectionChangeInfo, &isSectionChangeInfo); - if (!isSectionChangeInfo) { - continue; - } - - ani_double start = 0.0; - if (env->Object_GetPropertyByName_Double(static_cast(change), "start", &start) != ANI_OK) { - continue; - } - ani_double deleteCount = 0.0; - if (env->Object_GetPropertyByName_Double(static_cast(change), "deleteCount", &deleteCount) != - ANI_OK) { - continue; - } - - ani_ref sectionOptionsArray; - env->Object_GetPropertyByName_Ref(static_cast(change), "sections", §ionOptionsArray); - - ani_size aniLength; - if (env->Array_GetLength(static_cast(sectionOptionsArray), &aniLength) != ANI_OK) { - continue; - } - - int32_t length = static_cast(aniLength); - std::vector newSections; - for (int32_t j = 0; j < length; j++) { - ani_ref section; - if (env->Array_Get_Ref(static_cast(sectionOptionsArray), j, §ion) != ANI_OK) { - continue; - } - ani_boolean isSectionOptions; - env->Object_InstanceOf(static_cast(section), sectionOptions, &isSectionOptions); - if (!isSectionOptions) { - continue; - } - NG::WaterFlowSections::Section curSection = ParseSectionOptions(env, section); - if (curSection.itemsCount < 0) { - continue; - } - newSections.emplace_back(curSection); - } - waterFlowSections->ChangeData(start, deleteCount, newSections); - } -} - -void AniWaterFlowModule::SetWaterFlowSection(ani_env* env, ani_long ptr, ani_object obj) -{ - auto* frameNode = reinterpret_cast(ptr); - CHECK_NULL_VOID(frameNode); - - ani_ref sections; - if (env->Object_GetPropertyByName_Ref(obj, "sections", §ions) != ANI_OK) { - return; - } - - ani_class waterflowSections; - if (env->FindClass("Larkui/component/waterFlow/WaterFlowSections;", &waterflowSections) != ANI_OK) { - return; - } - - ani_boolean isNumber; - env->Object_InstanceOf(static_cast(sections), waterflowSections, &isNumber); - if (isNumber) { - ParseWaterFlowSections(env, sections, frameNode); - } -} -} // namespace OHOS::Ace::Framework diff --git a/frameworks/bridge/arkts_frontend/ani_water_flow_module.h b/frameworks/bridge/arkts_frontend/ani_water_flow_module.h deleted file mode 100644 index 1ea6f1095e025ca742397ca93e4b3b3e284497b9..0000000000000000000000000000000000000000 --- a/frameworks/bridge/arkts_frontend/ani_water_flow_module.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FOUNDATION_ACE_FRAMEWORKS_BRIDGE_ARKTS_FRONTEND_ANI_WATER_FLOW_MODULE_H -#define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_ARKTS_FRONTEND_ANI_WATER_FLOW_MODULE_H - -#include -#include "core/components_ng/pattern/waterflow/water_flow_sections.h" -#include "core/components_ng/pattern/waterflow/water_flow_model_ng.h" - -typedef class __ani_object* ani_object; -typedef struct __ani_env ani_env; -typedef int64_t ani_long; -typedef class __ani_fn_object* ani_fn_object; -typedef class __ani_ref* ani_ref; - -namespace OHOS::Ace::Framework { - -class AniWaterFlowModule { -public: - static void SetWaterFlowSection(ani_env* env, ani_long ptr, ani_object obj); - static void ParseWaterFlowSections(ani_env* env, ani_ref sections, NG::FrameNode* frameNode); - static NG::WaterFlowSections::Section ParseSectionOptions(ani_env* env, ani_ref section); -}; - -} // namespace OHOS::Ace::Framework -#endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_ARKTS_FRONTEND_ANI_WATER_FLOW_MODULE_H diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ComponentContent.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ComponentContent.ts index 10afc1aa7a6a4eb0ba99a30712684791d349203e..90da9c1880809db15c7dedb47899e40c54efcffc 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ComponentContent.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ComponentContent.ts @@ -23,7 +23,7 @@ import { Content } from "./Content" import { KPointer, pointer } from "@koalaui/interop" export interface ComponentContentBase extends Content { - + getNodePtr(): KPointer | undefined; } export class ComponentContent implements ComponentContentBase { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts index f5bba43fea78ca15cfb288db9049d05b47308213..af4667d50257a848eea09ec7c990304270232a2e 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts @@ -62,7 +62,8 @@ export class ArkUIAniModule { native static _SetDrawCallback(ptr: KPointer, callback: ((context: DrawContext) => void)): void native static _SetDrawModifier(ptr: KPointer, flag: KInt, drawModifier: DrawModifier): void native static _Invalidate(ptr: KPointer): void - native static _SetWaterFlowOptions(ptr: KPointer, options: WaterFlowOptions): void + native static _SetWaterFlowSection(ptr: KPointer, sections: WaterFlowSections): void + native static _SetWaterFlowFooterContent(ptr: KPointer, footerContent: KPointer): void native static _SetListChildrenMainSize(ptr: KPointer, value: ChildrenMainSize): void native static _LazyForEachNode_Construct(id: KInt): KPointer native static _SetOverlay_ComponentContent(node: KPointer, buildNodePtr: KPointer, options?: OverlayOptions): void diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn index ded9ab40dca7c27832bdc2ee5a342a4e6495fa65..76e311129538bc8fda485b1b8d153c94da37e741 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn @@ -49,7 +49,7 @@ ohos_shared_library("arkoala_native_ani") { "video/video_module_methods.cpp", "rich_editor/rich_editor_module.cpp", "stateMgmt/stateMgmt_module.cpp", - "water_flow/waterFlowSection_module.cpp", + "water_flow/water_flow_module.cpp", "list/list_children_main_size_module.cpp", "web/web_module_methods.cpp", "xcomponent/xcomponent_module_methods.cpp", diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp index 424e2766f179c95e26bbde0e44f19ba045d20dd0..29b46f2632ca387c42fdefd680e7601da19665f0 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp @@ -32,7 +32,7 @@ #include "load.h" #include "log/log.h" #include "utils/convert_utils.h" -#include "water_flow/waterFlowSection_module.h" +#include "water_flow/water_flow_module.h" #include "interop/interop_module.h" #include "web/web_module_methods.h" #include "video/video_module_methods.h" @@ -372,9 +372,14 @@ ANI_EXPORT ani_status ANI_Constructor(ani_vm* vm, uint32_t* result) reinterpret_cast(OHOS::Ace::Ani::SetOverlayComponentContent) }, ani_native_function { - "_SetWaterFlowOptions", - "JLarkui/component/waterFlow/WaterFlowOptions;:V", - reinterpret_cast(OHOS::Ace::Ani::SetWaterFlowOptions) + "_SetWaterFlowSection", + "JLarkui/component/waterFlow/WaterFlowSections;:V", + reinterpret_cast(OHOS::Ace::Ani::SetWaterFlowSection) + }, + ani_native_function { + "_SetWaterFlowFooterContent", + "JJ:V", + reinterpret_cast(OHOS::Ace::Ani::SetWaterFlowFooterContent) }, ani_native_function { "_SetListChildrenMainSize", diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/waterFlowSection_module.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/water_flow_module.cpp similarity index 55% rename from frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/waterFlowSection_module.cpp rename to frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/water_flow_module.cpp index 416bd18ec486d8c750a27206ff0d5b04ac11f9b6..cc5feba36ae2212a9e8e0564fc57747b0829f608 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/waterFlowSection_module.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/water_flow_module.cpp @@ -1,31 +1,37 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "waterFlowSection_module.h" - -#include - -#include "common/common_module.h" -#include "load.h" -#include "utils/ani_utils.h" - -namespace OHOS::Ace::Ani { -void SetWaterFlowOptions(ani_env* env, [[maybe_unused]] ani_object aniClass, ani_long ptr, ani_object waterFlowOptions) -{ - const auto* modifier = GetNodeAniModifier(); - CHECK_NULL_VOID(modifier); - modifier->getArkUIAniWaterFlowModifier()->setWaterFlowOptions(env, ptr, waterFlowOptions); -} -} // namespace OHOS::Ace::Ani +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "water_flow_module.h" +#include "base/utils/utils.h" +#include "load.h" +#include "base/log/log.h" + + +namespace OHOS::Ace::Ani { +void SetWaterFlowSection(ani_env* env, [[maybe_unused]] ani_object aniClass, ani_long ptr, ani_object waterFlowSection) +{ + const auto* modifier = GetNodeAniModifier(); + CHECK_NULL_VOID(modifier); + modifier->getArkUIAniWaterFlowModifier()->setWaterFlowSection(env, ptr, waterFlowSection); +} + +void SetWaterFlowFooterContent(ani_env* env, [[maybe_unused]] ani_object aniClass, ani_long ptr, ani_long footerContent) +{ + const auto* modifier = GetNodeAniModifier(); + CHECK_NULL_VOID(modifier); + modifier->getArkUIAniWaterFlowModifier()->setWaterFlowFooterContent(env, ptr, footerContent); +} +} // namespace OHOS::Ace::Ani diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/waterFlowSection_module.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/water_flow_module.h similarity index 78% rename from frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/waterFlowSection_module.h rename to frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/water_flow_module.h index 5cefd387c9a276026589ae0c1483e0694b709995..d69e976795b80940ac5ce485603e4fb0de0cf1f1 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/waterFlowSection_module.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/water_flow/water_flow_module.h @@ -19,7 +19,9 @@ #include "ani.h" namespace OHOS::Ace::Ani { -void SetWaterFlowOptions(ani_env* env, [[maybe_unused]] ani_object aniClass, ani_long ptr, ani_object waterFlowOptions); +void SetWaterFlowSection(ani_env* env, [[maybe_unused]] ani_object aniClass, ani_long ptr, ani_object waterFlowSection); +void SetWaterFlowFooterContent( + ani_env* env, [[maybe_unused]] ani_object aniClass, ani_long ptr, ani_long footerContent); } // namespace OHOS::Ace::Ani #endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_WATER_FLOW_MODULE diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts index bf011f12e9063c6473c90566a43b249f72f25f67..9829f755873fea5793cb8cbe0ec79395607f91d5 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts @@ -12957,9 +12957,9 @@ export class Deserializer extends DeserializerBase { let footerContent_buf : ComponentContent | undefined if ((RuntimeType.UNDEFINED) != (footerContent_buf_runtimeType)) { - footerContent_buf = (valueDeserializer.readComponentContent() as ComponentContent) + footerContent_buf = undefined } - const footerContent_result : ComponentContent | undefined = footerContent_buf + const footerContent_result : ComponentContent | undefined = undefined const scroller_buf_runtimeType = (valueDeserializer.readInt8() as int32) let scroller_buf : Scroller | undefined if ((RuntimeType.UNDEFINED) != (scroller_buf_runtimeType)) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/waterFlow.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/waterFlow.ts index da6538ca9bc06214045d9b84e2a3d628edd8e60c..d031e6f3610f1a0881fcd8102f36edcda971a7e5 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/waterFlow.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/waterFlow.ts @@ -32,9 +32,9 @@ import { Resource } from "global.resource" import { Callback_Number_ScrollState_Literal_Number_offsetRemain, Literal_Number_offsetRemain, Callback_Number_Number_Void } from "./grid" import { ScrollState } from "./list" import { NodeAttach, remember } from "@koalaui/runtime" -import { ComponentContent } from "./arkui-custom" +import { ComponentContentBase } from "../ComponentContent" import { Scroller, OnScrollFrameBeginCallback } from "./scroll" -import { WaterFlowHandWritten } from "../handwritten/WaterFlowImpl" +import { hookWaterFlowOptionsImpl } from "../handwritten/WaterFlowImpl" export class ArkWaterFlowPeer extends ArkScrollableCommonMethodPeer { protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { @@ -48,7 +48,7 @@ export class ArkWaterFlowPeer extends ArkScrollableCommonMethodPeer { return _peer } setWaterFlowOptionsAttribute(options?: WaterFlowOptions): void { - WaterFlowHandWritten.hookWaterFlowOptionsImpl(this, options); + hookWaterFlowOptionsImpl(this, options); const thisSerializer : Serializer = Serializer.hold() let options_type : int32 = RuntimeType.UNDEFINED options_type = runtimeType(options) @@ -301,7 +301,7 @@ export enum WaterFlowLayoutMode { } export interface WaterFlowOptions { footer?: CustomBuilder; - footerContent?: ComponentContent; + footerContent?: ComponentContentBase; scroller?: Scroller; sections?: WaterFlowSections; layoutMode?: WaterFlowLayoutMode; diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/WaterFlowImpl.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/WaterFlowImpl.ts index 1af697dbea18459b00eeae1d29fbdfe65bff40e7..51a542aaaa8e0f6400ea5539d2fdc257aadfbfda 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/WaterFlowImpl.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/WaterFlowImpl.ts @@ -13,14 +13,20 @@ * limitations under the License. */ -import { WaterFlowOptions } from "../component/waterFlow" +import { WaterFlowOptions, ArkWaterFlowPeer } from "../component/waterFlow" import { PeerNode } from "../PeerNode" import { ArkUIAniModule } from "arkui.ani" -export class WaterFlowHandWritten { - static hookWaterFlowOptionsImpl(peer: PeerNode, options: WaterFlowOptions | undefined): void { - if (options !== undefined && options.sections !== undefined) { - ArkUIAniModule._SetWaterFlowOptions(peer.peer.ptr, options) - } +export function hookWaterFlowOptionsImpl(peer: ArkWaterFlowPeer, options: WaterFlowOptions | undefined): void { + if (options === undefined) { + return; + } + + if (options.sections !== undefined) { + ArkUIAniModule._SetWaterFlowSection(peer.peer.ptr, options.sections!) + options.footer = undefined; + } else if (options.footerContent !== undefined) { + ArkUIAniModule._SetWaterFlowFooterContent(peer.peer.ptr, options.footerContent!.getNodePtr()!) + options.footer = undefined; } } \ No newline at end of file diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/waterFlow.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/waterFlow.ts index 3c95d557795ea55d764d0b2a1b9cee2ab8564bc7..69c59c31b46bd05460e4cd7e4e92f61b41a70664 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/waterFlow.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/waterFlow.ts @@ -103,8 +103,7 @@ export class WaterFlowSections implements MaterializedBase { if (deleteCount === undefined && sections === undefined) { intDeleteCount = oldLength - intStart; - } - else if(deleteCount !== undefined) { + } else if (deleteCount !== undefined) { intDeleteCount = Math.trunc(deleteCount); if (intDeleteCount > oldLength - intStart) { intDeleteCount = oldLength - intStart; diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h index ee690a1f938aa8507f34db8590a3c3fd0d5b1c0d..a54de1dac9b78e1ca4948dad0b5e5e73466647d5 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h @@ -100454,7 +100454,7 @@ class Deserializer : public DeserializerBase { footer_buf.value = {valueDeserializer.readCallbackResource(), reinterpret_cast(valueDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_CustomNodeBuilder)))), reinterpret_cast(valueDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_CustomNodeBuilder))))}; } value.footer = footer_buf; - const auto footerContent_buf_runtimeType = static_cast(valueDeserializer.readInt8()); + const auto footerContent_buf_runtimeType = INTEROP_RUNTIME_UNDEFINED; Opt_ComponentContent footerContent_buf = {}; footerContent_buf.tag = footerContent_buf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; if ((INTEROP_RUNTIME_UNDEFINED) != (footerContent_buf_runtimeType)) diff --git a/frameworks/core/components_ng/pattern/waterflow/water_flow_model_static.cpp b/frameworks/core/components_ng/pattern/waterflow/water_flow_model_static.cpp index 1b379ef20a232c6b737e8382923def9b5c5a172e..c3ef70ddbda4d48b6d131cb3db26333ab8292759 100644 --- a/frameworks/core/components_ng/pattern/waterflow/water_flow_model_static.cpp +++ b/frameworks/core/components_ng/pattern/waterflow/water_flow_model_static.cpp @@ -179,7 +179,7 @@ void WaterFlowModelStatic::SetItemMinHeight(FrameNode* frameNode, const std::opt auto layoutProperty = frameNode->GetLayoutProperty(); CHECK_NULL_VOID(layoutProperty); if (minHeight) { - layoutProperty->UpdateItemMinSize(CalcSize(CalcLength(minHeight.value()), std::nullopt)); + layoutProperty->UpdateItemMinSize(CalcSize(std::nullopt, CalcLength(minHeight.value()))); } } @@ -189,7 +189,7 @@ void WaterFlowModelStatic::SetItemMaxWidth(FrameNode* frameNode, const std::opti auto layoutProperty = frameNode->GetLayoutProperty(); CHECK_NULL_VOID(layoutProperty); if (maxWidth) { - layoutProperty->UpdateItemMinSize(CalcSize(CalcLength(maxWidth.value()), std::nullopt)); + layoutProperty->UpdateItemMaxSize(CalcSize(CalcLength(maxWidth.value()), std::nullopt)); } } @@ -199,7 +199,7 @@ void WaterFlowModelStatic::SetItemMaxHeight(FrameNode* frameNode, const std::opt auto layoutProperty = frameNode->GetLayoutProperty(); CHECK_NULL_VOID(layoutProperty); if (maxHeight) { - layoutProperty->UpdateItemMinSize(CalcSize(CalcLength(maxHeight.value()), std::nullopt)); + layoutProperty->UpdateItemMaxSize(CalcSize(std::nullopt, CalcLength(maxHeight.value()))); } } diff --git a/frameworks/core/interfaces/ani/ani_api.h b/frameworks/core/interfaces/ani/ani_api.h index 89774f48398b24281a31a666e825c59f1bd85f2e..491258d2030c74c9c2419ecd5eff0e7ac9a01ca3 100644 --- a/frameworks/core/interfaces/ani/ani_api.h +++ b/frameworks/core/interfaces/ani/ani_api.h @@ -308,7 +308,8 @@ struct ArkUIAniLazyForEachNodeModifier { ani_long (*constructLazyForEachNode)(ani_int); }; struct ArkUIAniWaterFlowModifier { - void (*setWaterFlowOptions)(ani_env* env, ani_long ptr, ani_object fnObj); + void (*setWaterFlowSection)(ani_env* env, ani_long ptr, ani_object obj); + void (*setWaterFlowFooterContent)(ani_env* env, ani_long ptr, ani_long footerPtr); }; struct ArkUIAniListModifier { void (*setListChildrenMainSize)(ani_env* env, ani_long ptr, ani_object obj); diff --git a/frameworks/core/interfaces/native/ani/waterflow_ani_modifier.cpp b/frameworks/core/interfaces/native/ani/waterflow_ani_modifier.cpp index f2b275e9ceffd04d61654f1cd8ebd18b201de450..83288c3a0affdacec99409d4d0f2c52c5f7aed73 100644 --- a/frameworks/core/interfaces/native/ani/waterflow_ani_modifier.cpp +++ b/frameworks/core/interfaces/native/ani/waterflow_ani_modifier.cpp @@ -16,23 +16,325 @@ #include #include - -#include "frameworks/bridge/arkts_frontend/ani_water_flow_module.h" +#include "ani_utils.h" #include "base/log/log.h" #include "core/components_ng/base/frame_node.h" +#include "core/components_ng/pattern/waterflow/water_flow_model_ng.h" +#include "core/components_ng/pattern/waterflow/water_flow_model_static.h" +#include "core/interfaces/native/implementation/frame_node_peer_impl.h" + +#include +#include +#include + +#include "base/geometry/calc_dimension.h" +#include "base/utils/string_utils.h" +#include "core/components_ng/base/frame_node.h" +#include "core/components_ng/property/calc_length.h" +#include "core/components_ng/property/measure_property.h" +#include "core/interfaces/native/implementation/water_flow_scroller_peer_impl.h" namespace OHOS::Ace::NG { -void SetWaterFlowOptions(ani_env* env, ani_long ptr, ani_object fnObj) + +std::optional ParseDimension(ani_env* env, ani_ref dimensionRef) +{ + std::optional res; + ani_class doubleClass; + if (env->FindClass("Lstd/core/Double;", &doubleClass) != ANI_OK) { + return res; + } + ani_class stringClass; + if (env->FindClass("Lstd/core/String;", &stringClass) != ANI_OK) { + return res; + } + + ani_boolean isDouble; + env->Object_InstanceOf(static_cast(dimensionRef), doubleClass, &isDouble); + if (isDouble) { + ani_double dimension; + env->Object_CallMethodByName_Double(static_cast(dimensionRef), "unboxed", ":D", &dimension); + if (dimension < 0) { + dimension = 0; + } + res = CalcDimension(dimension, DimensionUnit::VP); + } + + ani_boolean isString; + env->Object_InstanceOf(static_cast(dimensionRef), stringClass, &isString); + if (isString) { + auto stringDimension = AniUtils::ANIStringToStdString(env, static_cast(dimensionRef)); + res = StringUtils::StringToDimension(stringDimension, true); + if (res->Value() < 0) { + res->SetValue(0.0); + } + } + return res; +} + +NG::MarginProperty ParsePadding(ani_env* env, ani_ref paddingRef) +{ + NG::MarginProperty res; + std::optional left; + std::optional right; + std::optional top; + std::optional bottom; + + ani_ref leftRef; + env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "left", &leftRef); + left = ParseDimension(env, leftRef); + if (left.has_value()) { + if (left.value().Unit() == DimensionUnit::CALC) { + res.left = NG::CalcLength(left.value().CalcValue()); + } else { + res.left = NG::CalcLength(left.value()); + } + } + + ani_ref rightRef; + env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "right", &rightRef); + right = ParseDimension(env, rightRef); + if (right.has_value()) { + if (right.value().Unit() == DimensionUnit::CALC) { + res.right = NG::CalcLength(right.value().CalcValue()); + } else { + res.right = NG::CalcLength(right.value()); + } + } + + ani_ref topRef; + env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "top", &topRef); + top = ParseDimension(env, topRef); + if (top.has_value()) { + if (top.value().Unit() == DimensionUnit::CALC) { + res.top = NG::CalcLength(top.value().CalcValue()); + } else { + res.top = NG::CalcLength(top.value()); + } + } + + ani_ref bottomRef; + env->Object_GetPropertyByName_Ref(static_cast(paddingRef), "bottom", &bottomRef); + bottom = ParseDimension(env, bottomRef); + if (bottom.has_value()) { + if (bottom.value().Unit() == DimensionUnit::CALC) { + res.bottom = NG::CalcLength(bottom.value().CalcValue()); + } else { + res.bottom = NG::CalcLength(bottom.value()); + } + } + return res; +} + +std::optional ParseMargin(ani_env* env, ani_ref marginRef) +{ + NG::MarginProperty res; + ani_class paddingClass; + if (env->FindClass("Larkui/component/units/Padding;", &paddingClass) != ANI_OK) { + return std::make_optional(res); + } + + ani_boolean isPadding; + env->Object_InstanceOf(static_cast(marginRef), paddingClass, &isPadding); + if (isPadding) { + res = ParsePadding(env, marginRef); + } else { + std::optional length = ParseDimension(env, marginRef); + if (length->Unit() == DimensionUnit::CALC) { + res.SetEdges(NG::CalcLength(length->CalcValue())); + } else { + res.SetEdges(NG::CalcLength(length.value())); + } + } + return std::make_optional(res); +} + +NG::WaterFlowSections::Section ParseSectionOptions(ani_env* env, ani_ref section) +{ + NG::WaterFlowSections::Section curSection; + ani_double itemsCount; + if (env->Object_GetPropertyByName_Double(static_cast(section), "itemsCount", &itemsCount) != ANI_OK) { + return curSection; + } + curSection.itemsCount = static_cast(itemsCount); + + ani_ref crossCount; + if (env->Object_GetPropertyByName_Ref(static_cast(section), "crossCount", &crossCount) != ANI_OK) { + curSection.crossCount = 1; + } + ani_boolean isUndefined = false; + if (env->Reference_IsUndefined(crossCount, &isUndefined) != ANI_OK) { + curSection.crossCount = 1; + } + if (!isUndefined) { + ani_double crossCnt; + env->Object_CallMethodByName_Double(static_cast(crossCount), "unboxed", ":D", &crossCnt); + if (crossCnt <= 0) { + crossCnt = 1; + } + curSection.crossCount = static_cast(crossCnt); + } + + ani_ref columnsGap; + env->Object_GetPropertyByName_Ref(static_cast(section), "columnsGap", &columnsGap); + isUndefined = false; + env->Reference_IsUndefined(columnsGap, &isUndefined); + if (!isUndefined) { + curSection.columnsGap = ParseDimension(env, columnsGap); + } + + ani_ref rowsGap; + env->Object_GetPropertyByName_Ref(static_cast(section), "rowsGap", &rowsGap); + isUndefined = false; + env->Reference_IsUndefined(rowsGap, &isUndefined); + if (!isUndefined) { + curSection.rowsGap = ParseDimension(env, rowsGap); + } + + ani_ref margin; + env->Object_GetPropertyByName_Ref(static_cast(section), "margin", &margin); + isUndefined = false; + env->Reference_IsUndefined(margin, &isUndefined); + if (!isUndefined) { + curSection.margin = ParseMargin(env, margin); + } + + ani_ref func; + env->Object_GetPropertyByName_Ref(static_cast(section), "onGetItemMainSizeByIndex", &func); + + ani_class ClassGetItemMainSizeByIndex; + env->FindClass("Lstd/core/Function1;", &ClassGetItemMainSizeByIndex); + ani_boolean isGetItemMainSizeByIndex; + env->Object_InstanceOf(static_cast(func), ClassGetItemMainSizeByIndex, &isGetItemMainSizeByIndex); + + isUndefined = false; + env->Reference_IsUndefined(func, &isUndefined); + + if (isGetItemMainSizeByIndex && !isUndefined) { + ani_ref fnObjGlobalRef = nullptr; + env->GlobalReference_Create(func, &fnObjGlobalRef); + auto onGetItemMainSizeByIndex = [fnObjGlobalRef, env](int32_t index) { + ani_ref aniRes; + ani_ref aniIndex = AniUtils::CreateDouble(env, ani_double(index)); + + env->FunctionalObject_Call(static_cast(fnObjGlobalRef), 1, &aniIndex, &aniRes); + ani_double res; + env->Object_CallMethodByName_Double(static_cast(aniRes), "unboxed", ":D", &res); + return static_cast(res); + }; + curSection.onGetItemMainSizeByIndex = std::move(onGetItemMainSizeByIndex); + } + + return curSection; +} + +void ParseWaterFlowSections(ani_env* env, ani_ref sections, NG::FrameNode* frameNode) +{ + auto waterFlowSections = NG::WaterFlowModelStatic::GetOrCreateWaterFlowSections(frameNode); + CHECK_NULL_VOID(waterFlowSections); + + ani_ref changeArray; + if (env->Object_GetPropertyByName_Ref(static_cast(sections), "changeArray", &changeArray) != ANI_OK) { + return; + } + ani_size changeArrayLength; + if (env->Array_GetLength(static_cast(changeArray), &changeArrayLength) != ANI_OK) { + } + + ani_class sectionChangeInfo; + if (env->FindClass("Larkui/component/waterFlow/SectionChangeInfo;", §ionChangeInfo) != ANI_OK) { + return; + } + + ani_class sectionOptions; + if (env->FindClass("Larkui/component/waterFlow/SectionOptions;", §ionOptions) != ANI_OK) { + return; + } + + for (int32_t i = 0; i < changeArrayLength; i++) { + ani_ref change; + if (env->Array_Get_Ref(static_cast(changeArray), i, &change) != ANI_OK) { + continue; + } + + ani_boolean isSectionChangeInfo; + env->Object_InstanceOf(static_cast(change), sectionChangeInfo, &isSectionChangeInfo); + if (!isSectionChangeInfo) { + continue; + } + + ani_double start = 0.0; + if (env->Object_GetPropertyByName_Double(static_cast(change), "start", &start) != ANI_OK) { + continue; + } + ani_double deleteCount = 0.0; + if (env->Object_GetPropertyByName_Double(static_cast(change), "deleteCount", &deleteCount) != + ANI_OK) { + continue; + } + + ani_ref sectionOptionsArray; + env->Object_GetPropertyByName_Ref(static_cast(change), "sections", §ionOptionsArray); + + ani_size aniLength = 0; + env->Array_GetLength(static_cast(sectionOptionsArray), &aniLength); + + int32_t length = static_cast(aniLength); + std::vector newSections; + for (int32_t j = 0; j < length; j++) { + ani_ref section; + if (env->Array_Get_Ref(static_cast(sectionOptionsArray), j, §ion) != ANI_OK) { + continue; + } + ani_boolean isSectionOptions; + env->Object_InstanceOf(static_cast(section), sectionOptions, &isSectionOptions); + if (!isSectionOptions) { + continue; + } + NG::WaterFlowSections::Section curSection = ParseSectionOptions(env, section); + if (curSection.itemsCount < 0) { + continue; + } + newSections.emplace_back(curSection); + } + waterFlowSections->ChangeData(start, deleteCount, newSections); + } +} + +void SetWaterFlowSection(ani_env* env, ani_long ptr, ani_object obj) { auto* frameNode = reinterpret_cast(ptr); CHECK_NULL_VOID(frameNode); - Framework::AniWaterFlowModule::SetWaterFlowSection(env, ptr, fnObj); + + ani_class waterflowSections; + if (env->FindClass("Larkui/component/waterFlow/WaterFlowSections;", &waterflowSections) != ANI_OK) { + return; + } + + ani_boolean isSection; + + env->Object_InstanceOf(obj, waterflowSections, &isSection); + if (isSection) { + ParseWaterFlowSections(env, obj, frameNode); + } +} + +void SetWaterFlowFooterContent(ani_env* env, ani_long ptr, ani_long footerPtr) +{ + auto* frameNode = reinterpret_cast(ptr); + CHECK_NULL_VOID(frameNode); + auto* footerContentPtr = reinterpret_cast(footerPtr); + CHECK_NULL_VOID(footerContentPtr); + + auto footerContentNodePtr = FrameNodePeer::GetFrameNodeByPeer(footerContentPtr); + CHECK_NULL_VOID(footerContentNodePtr); + WaterFlowModelNG::SetWaterflowFooterWithFrameNode(frameNode, footerContentNodePtr); } const ArkUIAniWaterFlowModifier* GetArkUIAniWaterFlowModifier() { static const ArkUIAniWaterFlowModifier impl = { - .setWaterFlowOptions = OHOS::Ace::NG::SetWaterFlowOptions, + .setWaterFlowSection = OHOS::Ace::NG::SetWaterFlowSection, + .setWaterFlowFooterContent = OHOS::Ace::NG::SetWaterFlowFooterContent, }; return &impl; }