From 60c4215693e52ac6d4c37cbb8482b1cbe92f4c60 Mon Sep 17 00:00:00 2001 From: maxli Date: Wed, 22 Nov 2023 11:03:24 +0800 Subject: [PATCH] fix(android): compatible with the HippyModulePromise type --- .../hippy/modules/nativemodules/HippyNativeModuleInfo.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/android/src/main/java/com/tencent/mtt/hippy/modules/nativemodules/HippyNativeModuleInfo.java b/framework/android/src/main/java/com/tencent/mtt/hippy/modules/nativemodules/HippyNativeModuleInfo.java index b8c07575558..4cf1b6ad1f4 100644 --- a/framework/android/src/main/java/com/tencent/mtt/hippy/modules/nativemodules/HippyNativeModuleInfo.java +++ b/framework/android/src/main/java/com/tencent/mtt/hippy/modules/nativemodules/HippyNativeModuleInfo.java @@ -26,6 +26,7 @@ import com.tencent.mtt.hippy.annotation.HippyNativeModule.Thread; import com.tencent.mtt.hippy.common.HippyArray; import com.tencent.mtt.hippy.common.Provider; +import com.tencent.mtt.hippy.modules.HippyModulePromise; import com.tencent.mtt.hippy.modules.Promise; import com.tencent.mtt.hippy.modules.PromiseImpl; import com.tencent.mtt.hippy.runtime.builtins.array.JSDenseArray; @@ -208,7 +209,11 @@ private Object[] prepareArguments(@NonNull Object args, PromiseImpl promise) int size = mUseJSValueType ? ((JSDenseArray) args).size() : ((HippyArray) args).size(); for (int i = 0; i < mParamTypes.length; i++) { Type paramCls = mParamTypes[i]; - if (paramCls == Promise.class) { + // It is necessary to be compatible with the HippyModulePromise type here, + // as some host custom modules interface promise parameters are directly defined + // using the HippyModulePromise type, resulting in parameter mismatches when + // calling the interface. + if (paramCls == Promise.class || paramCls == HippyModulePromise.class) { params[i] = promise; promise.setNeedResolveBySelf(false); } else {