From 0eefe94fbee5389bb3b0a7402099df4336b96db5 Mon Sep 17 00:00:00 2001 From: chyyy0213 Date: Mon, 21 Feb 2022 10:47:40 +0800 Subject: [PATCH 1/2] add permission for create Signed-off-by: chyyy0213 Change-Id: Ifaa413939e83468e8ab3c7617deef84feea9338c --- api/@ohos.window.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 868d38934d..62d9ac3eb7 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -86,6 +86,7 @@ declare namespace window { * @param id Indicates window id. * @param type Indicates window type. * @systemapi Hide this for inner system use. + * @permission ohos.permission.SYSTEM_FLOAT_WINDOW * @since 8 */ function create(ctx: Context, id: string, type: WindowType): Promise; -- Gitee From 054df00cd36552bd77365d453aca386138962a3c Mon Sep 17 00:00:00 2001 From: chyyy0213 Date: Wed, 23 Feb 2022 14:37:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chyyy0213 Change-Id: I06d674de154fadaca351bfe479ea78118fe815cc Signed-off-by: chyyy0213 --- api/@ohos.window.d.ts | 224 +++++++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 103 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 62d9ac3eb7..69c33f7bf3 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -14,11 +14,11 @@ */ import { AsyncCallback, Callback } from './basic' ; import { Context } from './app/context'; -import { ContenStorage } from './@internal/component/ets/stateManagement' +import { ContentStorage } from './@internal/component/ets/stateManagement' /** * Window manager. * @syscap SystemCapability.WindowManager.WindowManager.Core -*/ + */ declare namespace window { /** * The type of a window. @@ -64,90 +64,6 @@ declare namespace window { FLOATING } - /** - * Create a sub window with a specific id and type, only support 7. - * @param id Indicates window id. - * @param type Indicates window type. - * @since 7 - */ - function create(id: string, type: WindowType, callback: AsyncCallback): void; - - /** - * Create a sub window with a specific id and type, only support 7. - * @param id Indicates window id. - * @param type Indicates window type. - * @since 7 - */ - function create(id: string, type: WindowType): Promise; - - /** - * Create a system window with a specific id and type. - * @param ctx Indicates the context on which the window depends - * @param id Indicates window id. - * @param type Indicates window type. - * @systemapi Hide this for inner system use. - * @permission ohos.permission.SYSTEM_FLOAT_WINDOW - * @since 8 - */ - function create(ctx: Context, id: string, type: WindowType): Promise; - - /** - * Find the window by id. - * @param id Indicates window id. - * @since 7 - */ - function find(id: string, callback: AsyncCallback): void; - - /** - * Find the window by id. - * @param id Indicates window id. - * @since 7 - */ - function find(id: string): Promise; - - /** - * Get the final show window. - * @param id Indicates window id. - * @since 6 - */ - function getTopWindow(callback: AsyncCallback): void; - - /** - * Get the final show window. - * @since 6 - */ - function getTopWindow(): Promise; - - /** - * Get the final show window. - * @param ctx Indicates the context on which the window depends - * @since 8 - */ - function getTopWindow(ctx: Context): Promise; - - /** - * Get the final show window. - * @param ctx Indicates the context on which the window depends - * @since 8 - */ - function getTopWindow(ctx: Context, callback: AsyncCallback): void; - - /** - * register the callback of systemBarTintChange - * @param type: 'systemBarTintChange' - * @systemapi Hide this for inner system use. - * @since 8 - */ - function on(type: 'systemBarTintChange', callback: Callback): void; - - /** - * unregister the callback of systemBarTintChange - * @param type: 'systemBarTintChange' - * @systemapi Hide this for inner system use. - * @since 8 - */ - function off(type: 'systemBarTintChange', callback?: Callback): void; - /** * Properties of status bar and navigation bar, it couldn't update automatically * @syscap SystemCapability.WindowManager.WindowManager.Core @@ -326,7 +242,7 @@ declare namespace window { /** * Whether the window layout is in full screen mode(whether the window is immersive). The default value is false. - * @since 6 + * @since 7 */ isLayoutFullScreen: boolean @@ -338,7 +254,7 @@ declare namespace window { /** * Whether the window is touchable. The default value is false - * @since 6 + * @since 7 */ touchable: boolean } @@ -358,41 +274,136 @@ declare namespace window { WIDE_GAMUT, } + /** + * Create a sub window with a specific id and type, only support 7. + * @param id Indicates window id. + * @param type Indicates window type. + * @since 7 + */ + function create(id: string, type: WindowType, callback: AsyncCallback): void; + + /** + * Create a sub window with a specific id and type, only support 7. + * @param id Indicates window id. + * @param type Indicates window type. + * @since 7 + */ + function create(id: string, type: WindowType): Promise; + + /** + * Create a system or float window with a specific id and type. + * @param ctx Indicates the context on which the window depends + * @param id Indicates window id. + * @param type Indicates window type. + * @systemapi Hide this for inner system use. + * @permission ohos.permission.SYSTEM_FLOAT_WINDOW + * @since 8 + */ + function create(ctx: Context, id: string, type: WindowType): Promise; + + /** + * Create a system or float window with a specific id and type. + * @param ctx Indicates the context on which the window depends + * @param id Indicates window id. + * @param type Indicates window type. + * @systemapi Hide this for inner system use. + * @permission ohos.permission.SYSTEM_FLOAT_WINDOW + * @since 8 + */ + function create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback): void; + + /** + * Find the window by id. + * @param id Indicates window id. + * @since 7 + */ + function find(id: string, callback: AsyncCallback): void; + + /** + * Find the window by id. + * @param id Indicates window id. + * @since 7 + */ + function find(id: string): Promise; + + /** + * Get the final show window. + * @param id Indicates window id. + * @since 6 + */ + function getTopWindow(callback: AsyncCallback): void; + + /** + * Get the final show window. + * @since 6 + */ + function getTopWindow(): Promise; + + /** + * Get the final show window. + * @param ctx Indicates the context on which the window depends + * @since 8 + */ + function getTopWindow(ctx: Context): Promise; + + /** + * Get the final show window. + * @param ctx Indicates the context on which the window depends + * @since 8 + */ + function getTopWindow(ctx: Context, callback: AsyncCallback): void; + + /** + * register the callback of systemBarTintChange + * @param type: 'systemBarTintChange' + * @systemapi Hide this for inner system use. + * @since 8 + */ + function on(type: 'systemBarTintChange', callback: Callback): void; + + /** + * unregister the callback of systemBarTintChange + * @param type: 'systemBarTintChange' + * @systemapi Hide this for inner system use. + * @since 8 + */ + function off(type: 'systemBarTintChange', callback?: Callback): void; + interface Window { /** - * hide sub window. + * hide window. * @systemapi Hide this for inner system use. * @since 7 */ hide (callback: AsyncCallback): void; /** - * hide sub window. + * hide window. * @systemapi Hide this for inner system use. * @since 7 */ hide(): Promise; /** - * show sub window. + * show window. * @since 7 */ show(callback: AsyncCallback): void; /** - * show sub window. + * show window. * @since 7 */ show(): Promise; /** - * Destroy the sub window. + * Destroy the window. * @since 7 */ destroy(callback: AsyncCallback): void; /** - * Destroy the sub window. + * Destroy the window. * @since 7 */ destroy(): Promise; @@ -550,23 +561,24 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 8 */ - loadContent(path: string, storage: ContenStorage, callback: AsyncCallback): void; + loadContent(path: string, storage: ContentStorage, callback: AsyncCallback): void; /** * Loads content * @param path path of the page to which the content will be loaded + * @param storage storage The data object shared within the content instance loaded by the window * @syscap SystemCapability.WindowManager.WindowManager.Core - * @since 7 + * @since 9 */ - loadContent(path: string, callback: AsyncCallback): void; + loadContent(path: string, storage?: ContentStorage): Promise; /** * Loads content - * @param path path of the page to which the content will be loaded + * @param path path of the page to which the content will be loaded2 * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 */ - loadContent(path: string, storage?: ContenStorage): Promise; + loadContent(path: string, callback: AsyncCallback): void; /** * Checks whether the window is displayed @@ -652,7 +664,11 @@ declare namespace window { */ getColorSpace(callback: AsyncCallback): void; } - + /** + * window stage callback event type + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ enum WindowStageEventType { FOREGROUND = 1, ACTIVE, @@ -662,6 +678,7 @@ declare namespace window { /** * WindowStage * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 */ interface WindowStage { /** @@ -703,21 +720,22 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage: ContenStorage, callback: AsyncCallback): void; + loadContent(path: string, storage: ContentStorage, callback: AsyncCallback): void; /** * Loads content * @param path path of the page to which the content will be loaded + * @param storage storage The data object shared within the content instance loaded by the window * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, callback: AsyncCallback): void; + loadContent(path: string, storage?: ContentStorage): Promise; /** * Loads content * @param path path of the page to which the content will be loaded * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage?: ContenStorage): Promise; + loadContent(path: string, callback: AsyncCallback): void; /** * window stage event callback on. * @since 9 -- Gitee