From 784659ff721b0d93f9b405871f080d08fe370a1d Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Wed, 7 Jun 2023 18:24:08 +0800 Subject: [PATCH] Update docs (0607) Signed-off-by: ester.zhou --- .../changelogs/v3.2-Release/Readme-EN.md | 15 +- .../v3.2-Release/changelogs-arkui.md | 308 ++++++++++++ .../changelogs/v3.2-Release/changelogs-imf.md | 19 + .../v3.2-Release/changelogs-screenlock.md | 157 ++++++ .../v3.2-Release/changelogs-wallpaper.md | 306 ++++++++++++ .../changelogs/v3.2-Release/changelogs-web.md | 467 ++++++++++++++++++ 6 files changed, 1267 insertions(+), 5 deletions(-) create mode 100644 en/release-notes/changelogs/v3.2-Release/changelogs-arkui.md create mode 100644 en/release-notes/changelogs/v3.2-Release/changelogs-imf.md create mode 100644 en/release-notes/changelogs/v3.2-Release/changelogs-screenlock.md create mode 100644 en/release-notes/changelogs/v3.2-Release/changelogs-wallpaper.md create mode 100644 en/release-notes/changelogs/v3.2-Release/changelogs-web.md diff --git a/en/release-notes/changelogs/v3.2-Release/Readme-EN.md b/en/release-notes/changelogs/v3.2-Release/Readme-EN.md index 340e3f1e78..5f58f851ac 100644 --- a/en/release-notes/changelogs/v3.2-Release/Readme-EN.md +++ b/en/release-notes/changelogs/v3.2-Release/Readme-EN.md @@ -1,8 +1,13 @@ # Readme -- [Ability framework](changelogs-ability.md) -- [Bundle manager subsystem](changelogs-bundlemanager.md) -- [Resource scheduler subsystem](changelogs-resourceschedule.md) -- [Telephony subsystem](changelogs-telephony.md) -- [Util subsystem](changelogs-util.md) +- [Ability Framework](changelogs-ability.md) +- [ArkUI](changelogs-arkui.md) +- [Bundle Manager Subsystem](changelogs-bundlemanager.md) +- [Input Method Framework](changelogs-imf.md) +- [Resource Scheduler Subsystem](changelogs-resourceschedule.md) +- [Theme Framework Subsystem - Screenlock](changelogs-screenlock.md) +- [Telephony Subsystem](changelogs-telephony.md) +- [Util Subsystem](changelogs-util.md) +- [Theme Framework Subsystem - Wallpaper](changelogs-wallpaper.md) +- [Web Subsystem](changelogs-web.md) diff --git a/en/release-notes/changelogs/v3.2-Release/changelogs-arkui.md b/en/release-notes/changelogs/v3.2-Release/changelogs-arkui.md new file mode 100644 index 0000000000..0a2bf8673f --- /dev/null +++ b/en/release-notes/changelogs/v3.2-Release/changelogs-arkui.md @@ -0,0 +1,308 @@ +# ArkUI Subsystem Changelog + +## cl.arkui.1 Return Value Type Change of getInspectorTree + +**Change Impact** + +The code that uses the **getInspectorTree** API in versions earlier than OpenHarmony 3.2.10.7 must be adapted. + +**Key API/Component Changes** + +The return value of the **getInspectorTree** API is changed from the string type to the Object type. + +**Adaptation Guide** + +Adapt the code that takes the return value of **getInspectorTree** as a string.The sample code is as follows: + +- Before change: + +```typescript +console.info(getInspectorTree()) +``` + +- After change: + +```typescript +console.info(JSON.stringify(getInspectorTree())) +``` + +## cl.arkui.2 Deprecation the forceRebuild Attribute of \ + +**Change Impact** + +None. The attribute has no effect. + +**Key API/Component Changes** + +Deprecate the **forceRebuild** attribute of the **\** component. + +**Adaptation Guide** + +Delete the code that uses the **forceRebuild** attribute. This will not affect the functionality of the **\** component. + +## cl.arkui.3 Plugin Module API Changes + + +### 1. API Change in the **PluginComponentTemplate** Module + +Renamed the **ability** parameter **bundleName** to more clearly indicate the intended meaning. + +You need to adapt your application. + + + +**Change Impact** + +The application developed based on earlier versions must be adapted to the change. Otherwise, build errors will occur. + + + +**Key API/Component Changes** + +- Involved APIs: + + interface PluginComponentTemplate { + source: string; + bundleName: string; + } + + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; +} + +- Before change: + +```js + interface PluginComponentTemplate { source: string; ability: string; } + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; + } +``` + +- After change: + +```js + interface PluginComponentTemplate { source: string; bundleName: string; } + interface PluginComponentInterface { + (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; + } +``` + +**Adaptation Guide** + +Use the new API. The sample code is as follows: + +- Before change: +```js +PluginComponent({ + template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } +}).size({ width: 500, height: 100 }) +``` + +- After change: +```js +PluginComponent({ + template: { source: 'plugincomponent1', bundleName: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } +}).size({ width: 500, height: 100 }) +``` + +### 2. API Change in the **pluginComponentManager** Module + +Renamed the **want** parameter **target** to more clearly indicate the intended meaning. + +You need to adapt your application. + + + +**Change Impact** + +The application developed based on earlier versions must be adapted to the change. Otherwise, alarms will arise. Though the build may be successful, the API will not work as intended. + + + +**Key API/Component Changes** + +- Involved APIs: + + interface PushParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback\): void; + + interface RequestParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback\): void; + +- Before change: + +```js + interface PushParameterForStage { + owner: Want; + want: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + want: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; +``` + +- After change: + +```js + interface PushParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + extraData: KVObject; + jsonPath?: string; + } + + function push(param: PushParameterForStage, callback: AsyncCallback): void; + + interface RequestParameterForStage { + owner: Want; + target: Want; + name: string; + data: KVObject; + jsonPath?: string; + } + + function request(param: RequestParameterForStage, callback: AsyncCallback): void; +``` + +**Adaptation Guide** + +Use the new API. The sample code is as follows: + +- Before change: +```js +import pluginComponentManager from '@ohos.pluginComponent' + +pluginComponentManager.push({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + want: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "ets/pages/plugin2.js", + data: { + "js": "ets/pages/plugin.js", + "key_1": 1111, + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback:err: " ,JSON.stringify(err)); + console.log("push_callback:data: " , JSON.stringify(data)); + console.log("push_callback: push ok!"); + } +) + +pluginComponentManager.request({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + want: { + bundleName: "com.example.provider", + abilityName: "ets/pages/plugin2.js", + }, + name: "plugintemplate", + data: { + "key_1": " myapplication plugin component test", + "key_2": 123456 + }, + jsonPath: "", +}, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + } +) +``` + +- After change: +```js +import pluginComponentManager from '@ohos.pluginComponent' + +pluginComponentManager.push({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "ets/pages/plugin2.js", + data: { + "js": "ets/pages/plugin.js", + "key_1": 1111, + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback:err: " ,JSON.stringify(err)); + console.log("push_callback:data: " , JSON.stringify(data)); + console.log("push_callback: push ok!"); + } +) + +pluginComponentManager.request({ + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "ets/pages/plugin2.js", + }, + name: "plugintemplate", + data: { + "key_1": " myapplication plugin component test", + "key_2": 123456 + }, + jsonPath: "", +}, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + } +) +``` diff --git a/en/release-notes/changelogs/v3.2-Release/changelogs-imf.md b/en/release-notes/changelogs/v3.2-Release/changelogs-imf.md new file mode 100644 index 0000000000..f158d99d9a --- /dev/null +++ b/en/release-notes/changelogs/v3.2-Release/changelogs-imf.md @@ -0,0 +1,19 @@ +# Input Method Framework Subsystem – Input Method Framework Service Changelog + + +## @ohos.InputMethodSubtype Change of name, label, and id +Changed the **name**, **label**, and **id** attributes since API version 9. + +**Change Impact** + +Applications must be adapted to the following changes. + +| Name| Before Change| After Change| +| -------- | -------- | -------- | +| label | (1) Value: ID of the input method subtype.| (1) Value: Label of the input method subtype.| +| name | (1) Description: Name of the input method subtype. (2) Value: Label of the input method subtype.| (1) Description: Bundle name of the input method; (2) Value: Bundle name of the input method.| +| id | (1) Value: Bundle name of the input method.| (1) Value: ID of the input method subtype.| + +**Adaptation Guide** + +Update the code to adapt to the preceding changes. diff --git a/en/release-notes/changelogs/v3.2-Release/changelogs-screenlock.md b/en/release-notes/changelogs/v3.2-Release/changelogs-screenlock.md new file mode 100644 index 0000000000..deeaac319a --- /dev/null +++ b/en/release-notes/changelogs/v3.2-Release/changelogs-screenlock.md @@ -0,0 +1,157 @@ +# Theme Framework Subsystem – Screenlock Management Service Changelog + + +## cl.screenlock.1 Permission Change of isLocked and unlock +Changed the **isLocked** and **unlock** APIs to system APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +- Involved APIs: + +```js + function isLocked(): boolean; + function unlock(callback: AsyncCallback): void; + function unlock():Promise; +``` + +- Before change: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock(callback: AsyncCallback): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock():Promise; +``` + +- After change: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock(callback: AsyncCallback): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock():Promise; +``` + + +**Adaptation Guide** + +Make sure the APIs are only invoked by system applications. + +The code snippet is as follows: + +```js + try { + let ret = screenLock.isLocked(); + console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`); + } catch (error) { + console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`); + } +``` + +```js + screenlock.unlock((err, data) => { + if (err) { + console.error(`Failed to unlock the screen, because: ${err.message}`); + return; + } + console.info(`unlock the screen successfully. result: ${data}`); + }); +``` + +```js + screenlock.unlock().then((data) => { + console.info(`unlock the screen successfully. result: ${data}`); + }).catch((err) => { + console.error(`Failed to unlock the screen, because: ${err.message}`); + }); +``` + + +## cl.screenlock.2 Deprecation of isSecure +Deprecated the **isSecure** API since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The API can no longer be used after being deleted. + +- Involved APIs: + +```js + function isSecure(): boolean; +``` + +- Before change: + +```js + function isSecure(): boolean; +``` + +- After change: + + The API is deleted. + + +**Adaptation Guide** + +Update the code so that the deprecated API is not used. diff --git a/en/release-notes/changelogs/v3.2-Release/changelogs-wallpaper.md b/en/release-notes/changelogs/v3.2-Release/changelogs-wallpaper.md new file mode 100644 index 0000000000..18fff418c0 --- /dev/null +++ b/en/release-notes/changelogs/v3.2-Release/changelogs-wallpaper.md @@ -0,0 +1,306 @@ +# Theme Framework Subsystem – Wallpaper Management Service Changelog + + +## cl.wallpaper.1 Permission Change of getColorsSync, getMinHeightSync, getMinWidthSync, restore, and setImage +Changed the **getColorsSync**, **getMinHeightSync**, **getMinWidthSync**, restore, and **setImage** APIs to system APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +- Involved APIs: + +```js + function getColorsSync(wallpaperType: WallpaperType): Array; + function getMinHeightSync(): number; + function getMinWidthSync(): number; + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + function restore(wallpaperType: WallpaperType): Promise; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- Before change: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- After change: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + + +**Adaptation Guide** + +Make sure the APIs are only invoked by system applications. + +The code snippet is as follows: + +```js + try { + let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); + console.log(`success to getColorsSync: ${JSON.stringify(colors)}`); + } catch (error) { + console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`); + } +``` + +```js + let minHeight = wallpaper.getMinHeightSync(); +``` + +```js + let minWidth = wallpaper.getMinWidthSync(); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to restore.`); + }); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to restore.`); + }).catch((error) => { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + }); +``` + +```js + // The source type is string. + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to setImage.`); + }); +``` + +```js + // The source type is string. + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to setImage.`); + }).catch((error) => { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + }); +``` + + +## cl.wallpaper.2 Deprecation of getIdSync, getFileSync, isChangeAllowed, isUserChangeAllowed, on, off, and RgbaColor +Deprecated the **getIdSync**, **getFileSync**, **isChangeAllowed**, **isUserChangeAllowed**, **on**, **off**, and **RgbaColor** APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The APIs can no longer be used after being deleted. + +- Involved APIs: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- Before change: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- After change: + + The APIs are deleted. + + +**Adaptation Guide** + +Update the code so that the deprecated APIs are not used. diff --git a/en/release-notes/changelogs/v3.2-Release/changelogs-web.md b/en/release-notes/changelogs/v3.2-Release/changelogs-web.md new file mode 100644 index 0000000000..806f127061 --- /dev/null +++ b/en/release-notes/changelogs/v3.2-Release/changelogs-web.md @@ -0,0 +1,467 @@ +# Web Subsystem Changelog + +Compared with earlier versions, OpenHarmony 3.2.10.7 has the following API changes in its web subsystem: + +## cl.web.1 HitTestTypeV9 Name Change + +Renamed the enum class **HitTestTypeV9** **WebHitTestType** to meet the naming conventions. + +**Change Impact** + +The enum class **HitTestTypeV9** and APIs that use **HitTestTypeV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions. + +**Key API/Component Changes** + +- Involved APIs: + + enum HitTestTypeV9 + +- Before change: + + ```ts + enum HitTestTypeV9 + ``` + +- After change: + + ```ts + enum WebHitTestType + ``` + +**Adaptation Guide** + +Replace **HitTestTypeV9** with **WebHitTestType**. + +## cl.web.2 HeaderV9 Name Change + +Renamed the struct **HeaderV9** **WebHeader** to meet the naming conventions. + +**Change Impact** + +The struct **HeaderV9** and APIs that use **HeaderV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions. + +**Key API/Component Changes** + +- Involved APIs: + + interface HeaderV9 + +- Before change: + + ```ts + interface HeaderV9 + ``` + +- After change: + + ```ts + interface WebHeader + ``` + +**Adaptation Guide** + +Replace **HeaderV9** with **WebHeader**. + +## cl.web.3 Member Change of HitTestValue + +Rename the member variable **HitTestTypeV9** in the **HitTestValue** struct **WebHitTestType** to meet the naming conventions. + +**Change Impact** + +The struct **HitTestValue** and APIs that use **HitTestValue** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions. + +**Key API/Component Changes** + +- Involved APIs: + + interface HitTestValue + +- Before change: + + ```ts + interface HitTestValue { + + /** + * Get the hit test type. + * + * @since 9 + */ + type: HitTestTypeV9; + + /** + * Get the hit test extra data. + * + * @since 9 + */ + extra: string; + } + ``` + +- After change: + + ```ts + interface HitTestValue { + + /** + * Get the hit test type. + * + * @since 9 + */ + type: WebHitTestType; + + /** + * Get the hit test extra data. + * + * @since 9 + */ + extra: string; + } + ``` + +**Adaptation Guide** + +Replace **HitTestTypeV9** with **WebHitTestType**. + +## cl.web.4 Parameter Type Change of loadUrl + +Changed the type of the **headers** parameter in **loadUrl** to **WebHeader** to meet the naming conventions. + +**Change Impact** + +The **loadUrl** API that uses the **headers** parameter cannot be used in OpenHarmony 3.2.10.7 and later versions. + +**Key API/Component Changes** + +- Involved APIs: + + loadUrl(url: string | Resource, headers?: Array\): void + +- Before change: + + ```ts + loadUrl(url: string | Resource, headers?: Array): void + ``` + +- After change: + + ```ts + loadUrl(url: string | Resource, headers?: Array): void + ``` + +**Adaptation Guide** + +Change the type of the **headers** parameter in **loadUrl** from **HeaderV9** to **WebHeader**. + +## cl.web.5 Return Value Type Change of getHitTest + +Changed the return value type of the **getHitTest** API to **WebHitTest** to meet the naming conventions. + +**Change Impact** + +The **getHitTest** API cannot be used in OpenHarmony 3.2.10.7 and later versions. + +**Key API/Component Changes** + +- Involved APIs: + + getHitTest(): HitTestTypeV9 + +- Before change: + + ```ts + getHitTest(): HitTestTypeV9 + ``` + +- After change: + + ```ts + getHitTest(): WebHitTestType + ``` + +**Adaptation Guide** + +Change the return value type of the **getHitTest** API from **HitTestTypeV9** to **WebHitTestType**. + +## cl.web.6 Moving of the WebMessagePort Class + +Moved the **WebMessagePort** class to **@ohos.web.webview.d.ts** and added error throwing. + +**Change Impact** + +If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. + +**Key API/Component Changes** + +- Involved APIs: + + postMessageEvent(message: WebMessageEvent): void; + onMessageEvent(callback: (result: string) => void): void; + +- Before change: + + ```ts + postMessageEvent(message: WebMessageEvent): void; + onMessageEvent(callback: (result: string) => void): void; + ``` + +- After change: + + ```ts + postMessageEvent(message: WebMessage): void; + onMessageEvent(callback: (result: WebMessage) => void): void; + ``` + +**Adaptation Guide** + +Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.7 Moving of the HitTestValue Class + +Moved the **HitTestValue** class to **@ohos.web.webview.d.ts**; changed **HitTestValue** from a class to an API; changed the **getType** and **getExtra** from APIs to attributes. + +**Change Impact** + +If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. + +**Key API/Component Changes** + +- Involved APIs: + + getType(): HitTestType; + getExtra(): string; + +- Before change: + + ```ts + getType(): HitTestType; + getExtra(): string; + ``` + +- After change: + + ```ts + type: WebHitTestType; + extra: string; + ``` + +**Adaptation Guide** + +Instead of importing APIs from the original **HitTestValue** class, import APIs from **@ohos.web.webview** as follows: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.8 Moving of API Version 9 APIs Under WebCookie + +Moved APIs of API version 9 in the **WebCookie** class to **web.webview.webview.WebCookieManager** +and added error throwing. + +**Change Impact** + +If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. +The APIs in the class are static. + +**Key API/Component Changes** + +- Involved APIs: + + isCookieAllowed(): boolean; + isThirdPartyCookieAllowed(): boolean; + putAcceptCookieEnabled(accept: boolean): void; + putAcceptThirdPartyCookieEnabled(accept: boolean): void; + setCookie(url: string, value: string): boolean; + saveCookieSync(): boolean; + getCookie(url: string): string; + existCookie(): boolean; + deleteEntireCookie(): void; + deleteSessionCookie(): void; + +- Before change: + + ```ts + isCookieAllowed(): boolean; + isThirdPartyCookieAllowed(): boolean; + putAcceptCookieEnabled(accept: boolean): void; + putAcceptThirdPartyCookieEnabled(accept: boolean): void; + setCookie(url: string, value: string): boolean; + saveCookieSync(): boolean; + getCookie(url: string): string; + existCookie(): boolean; + deleteEntireCookie(): void; + deleteSessionCookie(): void; + ``` + +- After change: + + ```ts + static isCookieAllowed(): boolean; + static isThirdPartyCookieAllowed(): boolean; + static putAcceptCookieEnabled(accept: boolean): void; + static putAcceptThirdPartyCookieEnabled(accept: boolean): void; + static setCookie(url: string, value: string): void; + static saveCookieAsync(): Promise; + static saveCookieAsync(callback: AsyncCallback): void; + static getCookie(url: string): string; + static existCookie(): boolean; + static deleteEntireCookie(): void; + static deleteSessionCookie(): void; + ``` + +**Adaptation Guide** + +Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.9 Moving of API Version 9 APIs Under WebController + +Moved APIs of API version 9 in the **WebController** class to **web.webview.webview.WebviewController** and added error throwing. + +**Change Impact** + +If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. +The **getDefaultUserAgent** API is renamed **getUserAgent**. + +**Key API/Component Changes** + +- Involved APIs: + + zoomIn(): boolean; + zoomOut(): boolean; + createWebMessagePorts(): Array\; + postMessage(options: { message: WebMessageEvent, uri: string}): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getDefaultUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + +- Before change: + + ```ts + zoomIn(): boolean; + zoomOut(): boolean; + createWebMessagePorts(): Array; + postMessage(options: { message: WebMessageEvent, uri: string}): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getDefaultUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + ``` + +- After change: + + ```ts + zoomIn(): void; + zoomOut(): void; + createWebMessagePorts(): Array; + postMessage(name: string, ports: Array, uri: string): void; + getHitTestValue(): HitTestValue; + getWebId(): number; + getUserAgent(): string; + getTitle(): string; + getPageHeight(): number; + backOrForward(step: number): void; + searchAllAsync(searchString: string): void; + clearMatches(): void; + searchNext(forward: boolean): void; + clearSslCache(): void; + clearClientAuthenticationCache(): void; + getUrl(): string; + ``` + +**Adaptation Guide** + +Instead of importing APIs from the original **WebController** class, import APIs from **@ohos.web.webview** as follows: + + ```ts + import web_webview from '@ohos.web.webview'; + ``` + +## cl.web.10 Moving of the WebAsyncController Class + +Moved the APIs in the **WebAsyncController** class to the **web.webview.webview.WebviewController** class and added error throwing. + +**Change Impact** + +If your application is developed based on earlier versions, pay attention to error code processing. + +**Key API/Component Changes** + +- Involved APIs: + + storeWebArchive(baseName: string, autoName: boolean): Promise\; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback\): void; + +- Before change: + + ```ts + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + ``` + +- After change: + + ```ts + storeWebArchive(baseName: string, autoName: boolean): Promise; + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + ``` + +**Adaptation Guide** + +Example: + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('saveWebArchive') + .onClick(() => { + try { + this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => { + if (error) { + console.info(`save web archive error: ` + JSON.stringify(error)) + return; + } + if (filename != null) { + console.info(`save web archive success: ${filename}`) + } + }); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` -- GitLab