From cf4bf26d61abed9bbc23cbfed6c3e2ffaea011c9 Mon Sep 17 00:00:00 2001 From: zhengjiangliang Date: Fri, 29 Jul 2022 17:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E6=9C=BA=E7=B1=BB=E5=9E=8B=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E7=AA=97=E5=8F=8A=E6=A8=A1=E6=80=81=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If35985778736f07a8c4e52784f3b5f389ddbea01 Signed-off-by: zhengjiangliang --- .../extend/systemplugin/napi/ohos_window.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_window.js b/runtime/main/extend/systemplugin/napi/ohos_window.js index f08f66d1..b8956f9c 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_window.js +++ b/runtime/main/extend/systemplugin/napi/ohos_window.js @@ -31,7 +31,9 @@ export const WindowType = { TYPE_LAUNCHER_RECENT: 11, TYPE_LAUNCHER_DOCK: 12, TYPE_VOICE_INTERACTION: 13, - TYPE_POINTER: 14 + TYPE_POINTER: 14, + TYPE_FLOAT_CAMERA: 15, + TYPE_DIALOG: 16 } export const AvoidAreaType= { @@ -534,7 +536,7 @@ export const Window = { if (typeof args[len - 1] === 'function') { if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange' || args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange' - || args[0] === 'screenshot' + || args[0] === 'screenshot' || args[0] === 'dialogTargetTouch' ){ console.warn(`Window.on you has registered ${args[0]} event`) } else { @@ -551,7 +553,7 @@ export const Window = { if (typeof args[len - 1] === 'function') { if (args[0] === 'keyboardHeightChange'|| args[0] === 'systemAvoidAreaChange' || args[0] === 'windowSizeChange'|| args[0] === 'touchOutside'|| args[0] === 'avoidAreaChange' - || args[0] === 'screenshot' + || args[0] === 'screenshot' || args[0] === 'dialogTargetTouch' ){ console.warn(`Window.off you has registered ${args[0]} event`) } else { @@ -609,6 +611,21 @@ export const Window = { }) } }, + bindDialogTarget: function(...args) { + console.warn("Window.bindDialogTarget interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + /* 参数带有function,需特殊判断,原型如下 */ + /* bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback): Promise; */ + /* bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback, callback: AsyncCallback); */ + if (typeof args[len - 2] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, } export const windowMock = Window