From 5c31211f8c66d1740cd3892603459cdbf3736e99 Mon Sep 17 00:00:00 2001 From: xuhangqi Date: Mon, 28 Jul 2025 11:51:43 +0800 Subject: [PATCH] Refactor overload ohos.window6 Issue: https://gitee.com/openharmony/interface_sdk-js/issues/ICP722 Signed-off-by: xuhangqi Change-Id: I62025f80e2fbe1b3d850741a6ffea6eb5ea250dc --- .../window_stage_ani/ets/@ohos.window.ets | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets index 2b198a334f..c735e1885e 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets @@ -2522,7 +2522,7 @@ export class WindowInternal implements Window { }); } - public setPreferredOrientation(orientation: Orientation): Promise { + public setPreferredOrientationReturnPromise(orientation: Orientation): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setPreferredOrientationSync(this.nativeObj, orientation as int); @@ -2534,7 +2534,7 @@ export class WindowInternal implements Window { }); } - public setPreferredOrientation(orientation: Orientation, callback: AsyncCallback): void { + public setPreferredOrientationWithCallback(orientation: Orientation, callback: AsyncCallback): void { taskpool.execute((): void => { this.setPreferredOrientationSync(this.nativeObj, orientation as int); }).then((ret: NullishType) => { @@ -2544,6 +2544,8 @@ export class WindowInternal implements Window { }); } + overload setPreferredOrientation { setPreferredOrientationReturnPromise, setPreferredOrientationWithCallback }; + public setWindowPrivacyMode(isPrivacyMode: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { @@ -2938,8 +2940,9 @@ export interface Window { hideNonSystemFloatingWindows(shouldHide: boolean, callback: AsyncCallback): void; setWindowColorSpace(colorSpace: ColorSpace): Promise; setWindowColorSpace(colorSpace: ColorSpace, callback: AsyncCallback): void; - setPreferredOrientation(orientation: Orientation): Promise; - setPreferredOrientation(orientation: Orientation, callback: AsyncCallback): void; + setPreferredOrientationReturnPromise(orientation: Orientation): Promise; + setPreferredOrientationWithCallback(orientation: Orientation, callback: AsyncCallback): void; + overload setPreferredOrientation { setPreferredOrientationReturnPromise, setPreferredOrientationWithCallback }; setWindowPrivacyMode(isPrivacyMode: boolean): Promise; setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void; recover(): Promise; -- Gitee