From a299ba313871732a77840d32907af36719103532 Mon Sep 17 00:00:00 2001 From: igorlegalov Date: Thu, 17 Jul 2025 18:54:28 +0300 Subject: [PATCH] Remove NullishType alias Issue: https://gitee.com/open_harmony/dashboard?issue_id=ICH95I Testing: all pre-merge tests passed Signed-off-by: igorlegalov --- .../display_ani/ets/@ohos.display.ets | 100 +++--- .../ets/@ohos.uiExtensionHost.ets | 8 +- .../screen_ani/ets/@ohos.screen.ets | 88 ++--- .../screenshot_ani/ets/@ohos.screenshot.ets | 100 +++--- .../window_stage_ani/ets/@ohos.window.ets | 324 +++++++++--------- .../window_stage_ani/ets/window_entry.ets | 12 +- 6 files changed, 316 insertions(+), 316 deletions(-) diff --git a/interfaces/kits/ani/display_runtime/display_ani/ets/@ohos.display.ets b/interfaces/kits/ani/display_runtime/display_ani/ets/@ohos.display.ets index ebe1c219c4..45a922dd51 100644 --- a/interfaces/kits/ani/display_runtime/display_ani/ets/@ohos.display.ets +++ b/interfaces/kits/ani/display_runtime/display_ani/ets/@ohos.display.ets @@ -21,8 +21,8 @@ export default namespace display { loadLibrary('displayani_kit.z'); -const DISPLAY_ARRAY_LENGTH = 15; -const CUTO_ARRAY_LENGTH = 5; +const DISPLAY_ARRAY_LENGTH = 15; +const CUTO_ARRAY_LENGTH = 5; export interface Rect { left: long; @@ -111,26 +111,26 @@ export class FoldCreaseRegionImpl implements FoldCreaseRegion { export interface VirtualScreenConfig { name: string; - + width: long; - + height: long; - + density: double; - + surfaceId: string; } - + export class VirtualScreenConfigImpl implements VirtualScreenConfig { name: string; - + width: long; - + height: long; - + density: double; - - surfaceId: string; + + surfaceId: string; } export enum FoldDisplayMode { @@ -194,14 +194,14 @@ export enum DisplayState { } export enum ScreenShape { - + RECTANGLE = 0, ROUND = 1 } export enum DisplaySourceMode { - + NONE = 0, MAIN = 1, @@ -227,7 +227,7 @@ export interface Display { rotation: int; width: long; - + height: long; availableHeight: long; @@ -299,7 +299,7 @@ export class DisplayImpl implements Display { rotation: int; width: long; - + height: long; availableHeight: long; @@ -344,9 +344,9 @@ export class DisplayImpl implements Display { this.getCutoutInfoInternal(res); minusRectArray(res.boundingRects); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as CutoutInfo); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, new CutoutInfoImpl()); }); } @@ -358,9 +358,9 @@ export class DisplayImpl implements Display { this.getCutoutInfoInternal(res); minusRectArray(res.boundingRects); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as CutoutInfo); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -369,9 +369,9 @@ export class DisplayImpl implements Display { hasImmersiveWindow(callback: AsyncCallback): void { taskpool.execute((): boolean => { return this.hasImmersiveWindowInternal(); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as boolean); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, false); }); } @@ -380,9 +380,9 @@ export class DisplayImpl implements Display { return new Promise((resolve: (value: boolean) => void, reject: (error: BusinessError) => void ) => { taskpool.execute((): boolean => { return this.hasImmersiveWindowInternal(); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as boolean); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -394,9 +394,9 @@ export class DisplayImpl implements Display { let res: Rect = new RectImpl(); this.getAvailableAreaInternal(res); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Rect); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }) @@ -494,7 +494,7 @@ function minusCreaseRects(foldCreaseRegionObj: FoldCreaseRegion): void { let creaseRects: Array = foldCreaseRegion.creaseRects; let i = 0; for (; i < creaseRects.length; i++) { - if (creaseRects[i].left == 0 && creaseRects[i].top == 0 && + if (creaseRects[i].left == 0 && creaseRects[i].top == 0 && creaseRects[i].width == 0 && creaseRects[i].height == 0) { break; } @@ -555,9 +555,9 @@ export function getAllDisplays(): Promise> { getAllDisplaysSyncNative(res); minusDisplayArray(res) return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Array); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -633,9 +633,9 @@ export function getAllDisplayPhysicalResolution(): Promise { + }).then((ret: Any) => { resolve(ret as Array); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -676,64 +676,64 @@ export function makeUnique(screenId: long): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { makeUniqueNative(screenId, displayMgrRef); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); } - + export native function makeUniqueNative(screenId: long, nativeObj: long): void; - + export function setFoldStatusLocked(locked: boolean): void { setFoldStatusLockedNative(locked, displayMgrRef); } - + export native function setFoldStatusLockedNative(locked: boolean, nativeObj: long):void; - + export function createVirtualScreen(config: VirtualScreenConfig): Promise { return new Promise((resolve: (value: long) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): long => { let screenId: long; screenId = createVirtualScreenNative(config as object, displayMgrRef); return screenId; - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(ret as long); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); - }); + }); } - + export native function createVirtualScreenNative(config: object, nativeObj: long): long; - + export function destroyVirtualScreen(screenId: long): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { destroyVirtualScreenNative(screenId, displayMgrRef); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); } - + export native function destroyVirtualScreenNative(screenId: long, nativeObj: long): void; - + export function setVirtualScreenSurface(screenId: long, surfaceId: string): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { setVirtualScreenSurfaceNative(screenId, surfaceId, displayMgrRef); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); } - + export native function setVirtualScreenSurfaceNative(screenId: long, surfaceId: string, nativeObj: long): void; export function disposeDisplay(display: DisplayImpl): void { @@ -747,4 +747,4 @@ export let displayMgrRef: long; export function setDisplayMgrRef(nativeObj : long) : void{ displayMgrRef = nativeObj; } -} \ No newline at end of file +} diff --git a/interfaces/kits/ani/embeddable_window_stage/ets/@ohos.uiExtensionHost.ets b/interfaces/kits/ani/embeddable_window_stage/ets/@ohos.uiExtensionHost.ets index d8f8bb2bbf..a21bc09ee0 100644 --- a/interfaces/kits/ani/embeddable_window_stage/ets/@ohos.uiExtensionHost.ets +++ b/interfaces/kits/ani/embeddable_window_stage/ets/@ohos.uiExtensionHost.ets @@ -129,9 +129,9 @@ namespace uiExtensionHost { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWaterMarkFlag(this.nativeObj, enable); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -141,9 +141,9 @@ namespace uiExtensionHost { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.hidePrivacyContentForHost(this.nativeObj, shouldHide); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); diff --git a/interfaces/kits/ani/screen_runtime/screen_ani/ets/@ohos.screen.ets b/interfaces/kits/ani/screen_runtime/screen_ani/ets/@ohos.screen.ets index 342597d422..ba18ed1e3f 100644 --- a/interfaces/kits/ani/screen_runtime/screen_ani/ets/@ohos.screen.ets +++ b/interfaces/kits/ani/screen_runtime/screen_ani/ets/@ohos.screen.ets @@ -35,9 +35,9 @@ export function makeMirror(mainScreen: long, mirrorScreen: Array, callback taskpool.execute((): long => { let res: long = makeMirrorInternal(mainScreen, mirrorScreen); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as long); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -47,9 +47,9 @@ export function makeMirror(mainScreen: long, mirrorScreen: Array): Promise taskpool.execute((): long => { let res: long = makeMirrorInternal(mainScreen, mirrorScreen); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as long); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }) @@ -66,9 +66,9 @@ export function getAllScreens(callback: AsyncCallback>): void { getAllScreensInternal(screens); minusScreens(screens); return screens; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as Array); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, new Array()); }); } @@ -84,9 +84,9 @@ export function getAllScreens(): Promise> { getAllScreensInternal(screens); minusScreens(screens); return screens; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Array); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); } @@ -121,9 +121,9 @@ export function createVirtualScreen(options: VirtualScreenOption, callback: Asyn let screen = new ScreenImpl(); createVirtualScreenInternal(options, screen); return screen; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as Screen); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -134,9 +134,9 @@ export function createVirtualScreen(options: VirtualScreenOption): Promise { + }).then((ret: Any) => { resolve(ret as Screen); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -147,7 +147,7 @@ export function setVirtualScreenSurface(screenId: long, surfaceId: string, callb setVirtualScreenSurfaceInternal(screenId, surfaceId); }).then(() => { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -158,7 +158,7 @@ export function setVirtualScreenSurface(screenId: long, surfaceId: string): Prom setVirtualScreenSurfaceInternal(screenId, surfaceId); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -169,7 +169,7 @@ export function destroyVirtualScreen(screenId: long, callback: AsyncCallback { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -180,7 +180,7 @@ export function destroyVirtualScreen(screenId: long): Promise { destroyVirtualScreenInternal(screenId); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -189,9 +189,9 @@ export function destroyVirtualScreen(screenId: long): Promise { export function isScreenRotationLocked(callback: AsyncCallback): void { taskpool.execute((): boolean => { return isScreenRotationLockedInternal(); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as boolean); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -200,9 +200,9 @@ export function isScreenRotationLocked(): Promise { return new Promise((resolve: (value: boolean) => void, reject: (error: BusinessError) => void) => { taskpool.execute((): boolean => { return isScreenRotationLockedInternal(); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as boolean); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -213,7 +213,7 @@ export function setScreenRotationLocked(isLocked: boolean, callback: AsyncCallba setScreenRotationLockedInternal(isLocked); }).then(() => { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -224,7 +224,7 @@ export function setScreenRotationLocked(isLocked: boolean): Promise { setScreenRotationLockedInternal(isLocked); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -237,7 +237,7 @@ export function setMultiScreenRelativePosition(mainScreenOptions: MultiScreenPos setMultiScreenRelativePositionInternal(mainScreenOptions, secondaryScreenOptions); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -250,7 +250,7 @@ export function setMultiScreenMode(primaryScreenId: long, secondaryScreenId: lon setMultiScreenModeInternal(primaryScreenId, secondaryScreenId, secondaryScreenMode); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -262,7 +262,7 @@ export function setScreenPrivacyMaskImage(screenId: long, image?: image.PixelMap setScreenPrivacyMaskImageInternal(screenId, image); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -273,9 +273,9 @@ export function makeUnique(uniqueScreen: Array): Promise> { reject: (error: BusinessError) => void ) => { taskpool.execute((): Array => { return makeUniqueInternal(uniqueScreen); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Array); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -286,9 +286,9 @@ export function makeMirrorWithRegion(mainScreen: long, mirrorScreen: Array return new Promise((resolve: (value: long) => void, reject: (error: BusinessError) => void) => { taskpool.execute((): long => { return makeMirrorWithRegionInternal(mainScreen, mirrorScreen, mainScreenRegion); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as long); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }) @@ -299,7 +299,7 @@ export function stopMirror(mirrorScreen: Array, callback: AsyncCallback { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -310,7 +310,7 @@ export function stopMirror(mirrorScreen: Array): Promise { stopMirrorInternal(mirrorScreen); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -319,9 +319,9 @@ export function stopMirror(mirrorScreen: Array): Promise { export function makeExpand(options: Array, callback: AsyncCallback): void { taskpool.execute((): long => { return makeExpandInternal(options); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as long); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -330,9 +330,9 @@ export function makeExpand(options: Array): Promise { return new Promise((resolve: (value: long) => void, reject: (error: BusinessError) => void) => { taskpool.execute((): long => { return makeExpandInternal(options); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as long); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -343,7 +343,7 @@ export function stopExpand(expandScreen: Array, callback: AsyncCallback { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -354,7 +354,7 @@ export function stopExpand(expandScreen: Array): Promise { stopExpandInternal(expandScreen); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -401,7 +401,7 @@ export interface Screen { setScreenActiveMode(modeIndex: long): Promise; setOrientation(orientation: Orientation, callback: AsyncCallback): void; - + setOrientation(orientation: Orientation): Promise; } @@ -436,7 +436,7 @@ class ScreenImpl implements Screen { this.setDensityDpiInternal(densityDpi); }).then(() => { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -447,7 +447,7 @@ class ScreenImpl implements Screen { this.setDensityDpiInternal(densityDpi); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -476,7 +476,7 @@ class ScreenImpl implements Screen { this.setScreenActiveModeInternal(modeIndex); }).then(() => { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -488,7 +488,7 @@ class ScreenImpl implements Screen { this.setScreenActiveModeInternal(modeIndex); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -499,7 +499,7 @@ class ScreenImpl implements Screen { this.setOrientationInternal(orientation); }).then(() => { callback(null, undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -511,7 +511,7 @@ class ScreenImpl implements Screen { this.setOrientationInternal(orientation); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); diff --git a/interfaces/kits/ani/screenshot_runtime/screenshot_ani/ets/@ohos.screenshot.ets b/interfaces/kits/ani/screenshot_runtime/screenshot_ani/ets/@ohos.screenshot.ets index aa9290280d..8bfeaa20a2 100644 --- a/interfaces/kits/ani/screenshot_runtime/screenshot_ani/ets/@ohos.screenshot.ets +++ b/interfaces/kits/ani/screenshot_runtime/screenshot_ani/ets/@ohos.screenshot.ets @@ -12,50 +12,50 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import { AsyncCallback, Callback } from '@ohos.base'; import { BusinessError } from '@ohos.base'; import image from '@ohos.multimedia.image'; - + export default namespace screenshot { - + loadLibrary('screenshotani_kit.z'); - + export function save(options: ScreenshotOptions, callback: AsyncCallback): void { taskpool.execute((): image.PixelMap => { let res: image.PixelMap = saveSync(options); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as image.PixelMap); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } - + export function save(callback: AsyncCallback): void { taskpool.execute((): image.PixelMap => { let res: image.PixelMap = saveSync(); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(null, ret as image.PixelMap); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } - + export function save(options?: ScreenshotOptions): Promise { return new Promise((resolve: (value: image.PixelMap) => void, reject: (error: BusinessError) => void ) => { taskpool.execute((): image.PixelMap => { let res: image.PixelMap = saveSync(options); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as image.PixelMap); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); } - + native function saveSync(screenshotOptions?: ScreenshotOptions): image.PixelMap; export function capture(options?: CaptureOption): Promise { @@ -63,108 +63,108 @@ export function capture(options?: CaptureOption): Promise { taskpool.execute((): image.PixelMap => { let res: image.PixelMap = captureSync(options); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as image.PixelMap); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); } - + native function captureSync(options?: CaptureOption): image.PixelMap; - + export function pick(): Promise { return new Promise((resolve: (value: PickInfo) => void, reject: (error: BusinessError) => void ) => { taskpool.execute((): PickInfo => { let res: PickInfo = pickSync(); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as PickInfo); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); } - + native function pickSync(): PickInfo; - + export interface ScreenshotOptions { screenRect?: Rect; - + imageSize?: Size; - + rotation?: int; - + displayId?: long; - + isNotificationNeeded?: boolean; - + isCaptureFullOfScreen?: boolean; } - + export class ScreenshotOptionsImpl implements ScreenshotOptions { screenRect?: Rect; - + imageSize?: Size; - + rotation?: int; - + displayId?: long; - + isNotificationNeeded?: boolean; - + isCaptureFullOfScreen?: boolean; } - + export interface Size { width: long; - + height: long; } - + export class SizeImpl implements Size { width: long; - + height: long; } - + export interface Rect { left: long; - + top: long; - + width: long; - + height: long; } - + export class RectImpl implements Rect { left: long; - + top: long; - + width: long; - + height: long; } export interface CaptureOption { displayId?: Long; } - + export class CaptureOptionImpl implements CaptureOption { displayId?: Long; } - + export interface PickInfo { pickRect: Rect; - + pixelMap: image.PixelMap; } - + export class PickInfoImpl implements PickInfo { pickRect: Rect; - + pixelMap: image.PixelMap; } -} \ No newline at end of file +} 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 d8962b8c0c..f9e8802be3 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 @@ -907,14 +907,14 @@ export interface WindowProperties { /** * The position relative to the window and size of drawable area * - * @type { Rect } + * @type { Rect } * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 11 */ /** * The position relative to the window and size of drawable area * - * @type { Rect } + * @type { Rect } * @syscap SystemCapability.WindowManager.WindowManager.Core * @atomicservice * @since 12 @@ -1503,7 +1503,7 @@ export interface WindowLimits { /** * The decor button style of the window. - * + * * @interface DecorButtonStyle * @syscap SystemCapability.Window.SessionManager * @atomicservice @@ -1513,7 +1513,7 @@ export interface WindowLimits { export interface DecorButtonStyle { /** * color mode. - * + * * @type { ?colorMode } * @syscap SystemCapability.Window.SessionManager * @atomicservice @@ -1523,7 +1523,7 @@ export interface DecorButtonStyle { /** * button background size when hover. - * + * * @type { ?number } * @syscap SystemCapability.Window.SessionManager * @atomicservice @@ -1533,7 +1533,7 @@ export interface DecorButtonStyle { /** * button spacing. - * + * * @type { ?number } * @syscap SystemCapability.Window.SessionManager * @atomicservice @@ -1543,7 +1543,7 @@ export interface DecorButtonStyle { /** * close button right margin. - * + * * @type { ?number } * @syscap SystemCapability.Window.SessionManager * @atomicservice @@ -1905,9 +1905,9 @@ export class WindowStageInternal implements WindowStage { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowRectAutoSave(this.nativeObj, enabled, isSaveBySpecifiedFlag); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -1917,9 +1917,9 @@ export class WindowStageInternal implements WindowStage { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowRectAutoSave(this.nativeObj, enabled, false); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -1929,9 +1929,9 @@ export class WindowStageInternal implements WindowStage { return new Promise((resolve: (value: boolean) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): boolean => { return this.isWindowRectAutoSave(this.nativeObj); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(ret as boolean); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -1941,9 +1941,9 @@ export class WindowStageInternal implements WindowStage { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.removeStartingWindow(this.nativeObj); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -1996,9 +1996,9 @@ export class WindowStageInternal implements WindowStage { taskpool.execute((): Window => { let window = this.getMainWindowSync(this.nativeObj); return window; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2008,9 +2008,9 @@ export class WindowStageInternal implements WindowStage { taskpool.execute((): Window => { let res = this.getMainWindowSync(this.nativeObj); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { }); } @@ -2019,9 +2019,9 @@ export class WindowStageInternal implements WindowStage { taskpool.execute((): Window => { let window = this.createSubWindowSync(this.nativeObj, name); return window; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2031,9 +2031,9 @@ export class WindowStageInternal implements WindowStage { taskpool.execute((): Window => { let res = this.createSubWindowSync(this.nativeObj, name); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { }); } @@ -2177,9 +2177,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ): void => { taskpool.execute((): void => { this.setFollowParentWindowLayoutEnabled(this.nativeObj, enabled); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2201,9 +2201,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ): void => { taskpool.execute((): void => { this.stopMoving(this.nativeObj); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2213,9 +2213,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ): void => { taskpool.execute((): void => { this.setParentWindow(this.nativeObj, windowId); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2225,9 +2225,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ): void => { taskpool.execute((): void => { this.setWindowTitle(this.nativeObj, titleName); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2260,9 +2260,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ): void => { taskpool.execute((): void => { this.setWindowTopmost(this.nativeObj, isWindowTopmost); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2280,9 +2280,9 @@ export class WindowInternal implements Window { dockShow = isDockHoverShown; } this.setTitleAndDockHoverShown(this.nativeObj, titleShow, dockShow); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2292,9 +2292,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ): void => { taskpool.execute((): void => { this.restore(this.nativeObj); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2304,9 +2304,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { this.startMoving(this.nativeObj); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2316,9 +2316,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { this.startMoveWindowWithCoordinate(this.nativeObj, offsetX, offsetY); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2349,9 +2349,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) :void => { taskpool.execute((): void => { this.minimize(this.nativeObj); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2360,9 +2360,9 @@ export class WindowInternal implements Window { public minimize(callback: AsyncCallback): void { taskpool.execute((): void => { this.minimize(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2376,21 +2376,21 @@ export class WindowInternal implements Window { else { this.maximize(this.nativeObj, presentation as int); } - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); } - + public resize(width: int, height: int): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.resize(this.nativeObj, width, height); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2400,9 +2400,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.moveWindowTo(this.nativeObj, x, y); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2411,9 +2411,9 @@ export class WindowInternal implements Window { public resize(width: int, height: int, callback: AsyncCallback): void { taskpool.execute((): void => { this.resize(this.nativeObj, width, height); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2421,9 +2421,9 @@ export class WindowInternal implements Window { public moveWindowTo(x: int, y: int, callback: AsyncCallback): void { taskpool.execute((): void => { this.moveWindowTo(this.nativeObj, x, y); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2432,7 +2432,7 @@ export class WindowInternal implements Window { let ret = this.getGlobalRect(this.nativeObj); return ret; } - + public getWindowDecorHeight(): int { let ret = this.getWindowDecorHeight(this.nativeObj); return ret; @@ -2448,9 +2448,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.setWindowBackgroundColor(this.nativeObj, color); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2459,9 +2459,9 @@ export class WindowInternal implements Window { public setBackgroundColor(color: string, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowBackgroundColor(this.nativeObj, color); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2493,9 +2493,9 @@ export class WindowInternal implements Window { res.type = res.typeInternal as WindowType; res.displayId = res.displayIdInternal; return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as WindowProperties); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2507,9 +2507,9 @@ export class WindowInternal implements Window { res.type = res.typeInternal as WindowType; res.displayId = res.displayIdInternal; return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), ret as WindowProperties); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, new WindowPropertiesInternal()); }); } @@ -2519,9 +2519,9 @@ export class WindowInternal implements Window { taskpool.execute((): boolean => { let res = this.isWindowSupportWideGamut(this.nativeObj); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as boolean); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2531,9 +2531,9 @@ export class WindowInternal implements Window { taskpool.execute((): boolean => { let res = this.isWindowSupportWideGamut(this.nativeObj); return res; - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), ret as boolean); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, false); }); } @@ -2542,9 +2542,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.setWindowLayoutFullScreen(this.nativeObj, isLayoutFullScreen); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2553,9 +2553,9 @@ export class WindowInternal implements Window { public setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowLayoutFullScreen(this.nativeObj, isLayoutFullScreen); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2564,9 +2564,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.setWindowSystemBarProperties(this.nativeObj, systemBarProperties); - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2575,9 +2575,9 @@ export class WindowInternal implements Window { public setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowSystemBarProperties(this.nativeObj, systemBarProperties); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2590,9 +2590,9 @@ export class WindowInternal implements Window { } else { this.setSpecificSystemBarEnabled(this.nativeObj, name, enable, enableAnimation); } - }).then((ret: NullishType) :void => { + }).then((ret: Any) :void => { resolve(undefined); - }).catch((err: NullishType) :void => { + }).catch((err: Any) :void => { reject(err as BusinessError); }); }); @@ -2602,9 +2602,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: image.PixelMap) => void, reject: (error: BusinessError) => void) => { taskpool.execute(() => { return this.snapshot(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as image.PixelMap); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2613,9 +2613,9 @@ export class WindowInternal implements Window { public snapshot(callback: AsyncCallback): void { taskpool.execute(() => { return this.snapshot(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), ret as image.PixelMap); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2626,7 +2626,7 @@ export class WindowInternal implements Window { this.hideNonSystemFloatingWindows(this.nativeObj, shouldHide); }).then(() => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2637,7 +2637,7 @@ export class WindowInternal implements Window { this.hideNonSystemFloatingWindows(this.nativeObj, shouldHide); }).then(() => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2646,9 +2646,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowColorSpaceSync(this.nativeObj, colorSpace as int); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2657,9 +2657,9 @@ export class WindowInternal implements Window { public setWindowColorSpace(colorSpace: ColorSpace, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowColorSpaceSync(this.nativeObj, colorSpace as int); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2668,9 +2668,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setPreferredOrientationSync(this.nativeObj, orientation as int); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2679,9 +2679,9 @@ export class WindowInternal implements Window { public setPreferredOrientation(orientation: Orientation, callback: AsyncCallback): void { taskpool.execute((): void => { this.setPreferredOrientationSync(this.nativeObj, orientation as int); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2694,9 +2694,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowPrivacyModeSync(this.nativeObj, isPrivacyMode); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2705,9 +2705,9 @@ export class WindowInternal implements Window { public setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowPrivacyModeSync(this.nativeObj, isPrivacyMode); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2716,9 +2716,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.recoverSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2788,9 +2788,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.setWindowKeepScreenOnSync(this.nativeObj, isKeepScreenOn); - }).then((ret: NullishType): void => { + }).then((ret: Any): void => { resolve(ret as undefined); - }).catch((err: NullishType): void => { + }).catch((err: Any): void => { reject(err as BusinessError); }); }); @@ -2799,9 +2799,9 @@ export class WindowInternal implements Window { public setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowKeepScreenOnSync(this.nativeObj, isKeepScreenOn); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2810,9 +2810,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.setWindowSystemBarEnableSync(this.nativeObj, names); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2821,9 +2821,9 @@ export class WindowInternal implements Window { public setWindowSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowSystemBarEnableSync(this.nativeObj, names); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2840,9 +2840,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWaterMarkFlagSync(this.nativeObj, enable); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2851,9 +2851,9 @@ export class WindowInternal implements Window { public setWaterMarkFlag(enable: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWaterMarkFlagSync(this.nativeObj, enable); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2862,9 +2862,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowFocusableSync(this.nativeObj, isFocusable); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2873,9 +2873,9 @@ export class WindowInternal implements Window { public setWindowFocusable(isFocusable: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowFocusableSync(this.nativeObj, isFocusable); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2888,9 +2888,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowTouchableSync(this.nativeObj, isTouchable); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2899,9 +2899,9 @@ export class WindowInternal implements Window { public setWindowTouchable(isTouchable: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowTouchableSync(this.nativeObj, isTouchable); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -2910,9 +2910,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setDialogBackGestureEnabledSync(this.nativeObj, enabled); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2922,9 +2922,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowMaskSync(this.nativeObj, windowMask); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -2978,9 +2978,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowCornerRadiusSync(this.nativeObj, cornerRadius); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3005,9 +3005,9 @@ export class WindowInternal implements Window { public showWindow(callback: AsyncCallback): void { taskpool.execute((): void => { this.showWindowSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -3016,9 +3016,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.showWindowSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3027,9 +3027,9 @@ export class WindowInternal implements Window { public destroyWindow(callback: AsyncCallback): void { taskpool.execute((): void => { this.destroyWindowSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -3038,9 +3038,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.destroyWindowSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3053,9 +3053,9 @@ export class WindowInternal implements Window { public hideWithAnimation(callback: AsyncCallback): void { taskpool.execute((): void => { this.hideWithAnimationSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -3064,9 +3064,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.hideWithAnimationSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3075,9 +3075,9 @@ export class WindowInternal implements Window { public showWithAnimation(callback: AsyncCallback): void { taskpool.execute((): void => { this.showWithAnimationSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -3086,9 +3086,9 @@ export class WindowInternal implements Window { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.showWithAnimationSync(this.nativeObj); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3227,21 +3227,21 @@ export function getLastWindow(ctx: BaseContext): Promise { taskpool.execute((): Window => { hilog.info(DOMAIN, TAG, 'getLastWindow, ctx:' + ctx); return getLastWindowSync(nativeObj, ctx); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); - }); + }); } export function getLastWindow(ctx: BaseContext, callback: AsyncCallback): void { taskpool.execute((): Window => { hilog.info(DOMAIN, TAG, 'getLastWindow, ctx:' + ctx); return getLastWindowSync(nativeObj, ctx); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, new WindowInternal()); }); } @@ -3250,9 +3250,9 @@ export function createWindow(config: Configuration): Promise { return new Promise((resolve: (value: Window) => void, reject: (error: BusinessError) => void ) => { taskpool.execute((): Window => { return createWindowSync(nativeObj, config); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3261,9 +3261,9 @@ export function createWindow(config: Configuration): Promise { export function createWindow(config: Configuration, callback: AsyncCallback): void { taskpool.execute((): Window => { return createWindowSync(nativeObj, config); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), ret as Window); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, new WindowInternal()); }); } @@ -3272,20 +3272,20 @@ export function minimizeAll(id: long): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { minimizeAllSync(nativeObj, id); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); - }); + }); } export function minimizeAll(id: long, callback: AsyncCallback): void { taskpool.execute((): void => { minimizeAllSync(nativeObj, id); - }).then((ret: NullishType) => { + }).then((ret: Any) => { callback(new BusinessError(), undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { callback(err as BusinessError, undefined); }); } @@ -3311,9 +3311,9 @@ export function getWindowsByCoordinate(displayId: number, windowNumber?: number, param.y = y; } return getWindowsByCoordinate(nativeObj, param); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(ret as Array); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3365,9 +3365,9 @@ export function shiftAppWindowFocus(sourceWindowId: int, targetWindowId: int): P return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void ) : void => { taskpool.execute((): void => { return shiftAppWindowFocusSync(nativeObj, sourceWindowId, targetWindowId); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3377,9 +3377,9 @@ export function shiftAppWindowPointerEvent(sourceWindowId: int, targetWindowId: return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { return shiftAppWindowPointerEventSync(nativeObj, sourceWindowId, targetWindowId); - }).then((ret: NullishType) => { + }).then((ret: Any) => { resolve(undefined); - }).catch((err: NullishType) => { + }).catch((err: Any) => { reject(err as BusinessError); }); }); @@ -3441,4 +3441,4 @@ function runWindowNoInteractionCallback(cb: object): void { } } -export default window; \ No newline at end of file +export default window; diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/window_entry.ets b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/window_entry.ets index 57edc7ca21..9acd815823 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/window_entry.ets +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/window_entry.ets @@ -26,7 +26,7 @@ function main() { ws.getMainWindow().then((res:window.Window)=>{ console.println('[ANI]getMainWindow primise'); - }).catch((e:NullishType)=>{ + }).catch((e:Any)=>{ console.println('[ANI]getMainWindow catch'); }); @@ -38,7 +38,7 @@ function main() { w.isWindowSupportWideGamut().then((res:boolean)=>{ console.println('[ANI]isWindowSupportWideGamut primise' + res); - }).catch((e:NullishType)=>{ + }).catch((e:Any)=>{ console.println('[ANI]isWindowSupportWideGamut catch'); }); @@ -48,7 +48,7 @@ function main() { w.setWindowLayoutFullScreen(true).then((res:int)=>{ console.println('[ANI]setWindowLayoutFullScree primise' + res); - }).catch((e:NullishType)=>{ + }).catch((e:Any)=>{ console.println('[ANI]setWindowLayoutFullScreen catch'); }); @@ -59,7 +59,7 @@ function main() { let systemBarProperties = new window.SystemBarPropertiesInternal(); w.setWindowSystemBarProperties(systemBarProperties).then((res:int)=>{ console.println('[ANI]setWindowSystemBarProperties primise' + res); - }).catch((e:NullishType)=>{ + }).catch((e:Any)=>{ console.println('[ANI]setWindowSystemBarProperties catch'); }); @@ -69,7 +69,7 @@ function main() { w.setSpecificSystemBarEnabled('w', false, false).then((res:int)=>{ console.println('[ANI]setSpecificSystemBarEnabled primise' + res); - }).catch((e:NullishType)=>{ + }).catch((e:Any)=>{ console.println('[ANI]setSpecificSystemBarEnabled catch'); }); @@ -78,7 +78,7 @@ function main() { w.setWindowBackgroundColor('0xFFFFFF'); w.setWindowColorSpace(window.ColorSpace.DEFAULT).then((ret: int) => { console.println('[ANI] in ret:' + ret); - }).catch((e: NullishType) => { + }).catch((e: Any) => { let err = e as BusinessError; console.println('[ANI] in code:' + err?.code + ' err:' + err?.message); }); -- Gitee