From 3b0ecde014a162c4c5f09fcf69cb6f4c5b983d49 Mon Sep 17 00:00:00 2001 From: liminjie10 Date: Fri, 9 Dec 2022 15:50:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0settingsdata=E7=9A=84.d.t?= =?UTF-8?q?s=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liminjie10 --- api/@ohos.settings.d.ts | 138 ++++++++++++++++++++++++++++------------ 1 file changed, 99 insertions(+), 39 deletions(-) diff --git a/api/@ohos.settings.d.ts b/api/@ohos.settings.d.ts index 34beb2931d..a6b89532df 100644 --- a/api/@ohos.settings.d.ts +++ b/api/@ohos.settings.d.ts @@ -769,19 +769,97 @@ declare namespace settings { */ const WIFI_WATCHDOG_STATUS: string } + + /** + * Enables or disables airplane mode. + * + * @param enable Specifies whether to enable airplane mode. The value {@code true} means to enable airplane + * mode, and {@code false} means to disable airplane mode. + * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @since 7 + */ + function enableAirplaneMode(enable: boolean, callback: AsyncCallback): void; + function enableAirplaneMode(enable: boolean): Promise; + + /** + * Checks whether a specified application can show as float window. + * + * @param context Indicates the application context. + * @returns Returns {@code true} if the application can draw over other applications; returns {@code false} + * otherwise. + * @since 7 + */ + function canShowFloating(callback: AsyncCallback): void; + function canShowFloating(): Promise; /** * Constructs a URI for a specific name-value pair for monitoring data of the ability that uses the Data * template. - * * @param name Indicates the name of the setting to set. * @returns Returns the corresponding URI; returns {@code null} if the URI does not exist. * @since 7 */ - function getURI(name: string, callback: AsyncCallback): void; - function getURI(name: string): Promise; + function getURI(name: string, callback: AsyncCallback): void; + function getURI(name: string): Promise; /** + * get settingsdata uri(synchronization method) + * @since 8 + * @param name Indicates the name of the setting to set. + * @returns Returns settingsdata uri. + */ + function getUriSync(name: string): string; + + /** + * get value from settingsdata + * @since 9 + * @param context Indicates the Context or dataAbilityHelper used to access + * the database. + * @param name Indicates the name of the character string. + * @returns Returns the value of the character string in the table if any is found; returns {@code null} + * otherwise. + * @StageModelOnly + */ + function getValue(context: Context, name: string, callback: AsyncCallback): void; + function getValue(context: Context, name: string): Promise; + + /** + * get value from settingsdata(synchronization method) + * @since 9 + * @param context Indicates Context or dataAbilityHelper instance + * @param name Indicates the name of the character string. + * @param defValue Indicates the default value of the character string. + * @returns settingsdata value + * @StageModelOnly + */ + function getValueSync(context: Context, name: string, defValue: string): string; + + /** + * set settingsdata value. + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @since 9 + * @param context Indicates Context or dataAbilityHelper instance + * @param name Indicates the name of the character string. + * @param value Indicates the value of the character string. + * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @StageModelOnly + */ + function setValue(context: Context, name: string, value: string, callback: AsyncCallback): void; + function setValue(context: Context, name: string, value: string): Promise; + + /** + * set settingsdata value(synchronization method) + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @since 9 + * @param context Indicates Context or dataAbilityHelper instance + * @param name Indicates the name of the character string. + * @param value Indicates the value of the character string. + * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @StageModelOnly + */ + function setValueSync(context: Context, name: string, value: string): boolean; + + /** * Obtains the value of a specified character string in the database. * * @param dataAbilityHelper Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used to access @@ -790,13 +868,15 @@ declare namespace settings { * @returns Returns the value of the character string in the table if any is found; returns {@code null} * otherwise. * @since 7 + * @deprecated since 9 + * @useinstead getValue(context: context...) + * @FAModelOnly */ - function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void; - function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise; + function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void; + function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise; /** * Saves a character string name and its value to the database. - * * @param dataAbilityHelper Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used to access * the database. * @param name Indicates the name of the character string. @@ -804,39 +884,12 @@ declare namespace settings { * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. * @since 7 * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead setValue(context: context...) + * @FAModelOnly */ - function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void; - function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise; - - /** - * Enables or disables airplane mode. - * - * @param enable Specifies whether to enable airplane mode. The value {@code true} means to enable airplane - * mode, and {@code false} means to disable airplane mode. - * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. - * @since 7 - */ - function enableAirplaneMode(enable: boolean, callback: AsyncCallback): void; - function enableAirplaneMode(enable: boolean): Promise; - - /** - * Checks whether a specified application can show as float window. - * - * @param context Indicates the application context. - * @returns Returns {@code true} if the application can draw over other applications; returns {@code false} - * otherwise. - * @since 7 - */ - function canShowFloating(callback: AsyncCallback): void; - function canShowFloating(): Promise; - - /** - * get settingsdata uri(synchronization method) - * @since 8 - * @param name Indicates the name of the setting to set. - * @returns Return settingsdata uri. - */ - function getUriSync(name: string): string; + function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: string, callback: AsyncCallback): void; + function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: string): Promise; /** * get value from settingsdata(synchronization method) @@ -845,19 +898,26 @@ declare namespace settings { * @param name Indicates the name of the character string. * @param defValue Indicates the default value of the character string. * @returns settingsdata value + * @deprecated since 9 + * @useinstead getValueSync(context: context...) + * @FAModelOnly */ function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string; /** * set settingsdata value(synchronization method) - * @need permission ohos.permission.WRITE_SYSTEM_SETTING + * @permission ohos.permission.MANAGE_SECURE_SETTINGS * @since 8 * @param dataAbilityHelper Indicates dataAbilityHelper instance * @param name Indicates the name of the character string. * @param value Indicates the value of the character string. * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @deprecated since 9 + * @useinstead setValueSync(context: context...) + * @FAModelOnly */ function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean; + } export default settings; \ No newline at end of file -- Gitee From 6f85e8b8fa84bf6bd2f3f58f40d8eab6e4c22ee7 Mon Sep 17 00:00:00 2001 From: liminjie10 Date: Fri, 9 Dec 2022 10:04:06 +0000 Subject: [PATCH 2/2] update api/@ohos.settings.d.ts. Signed-off-by: liminjie10 --- api/@ohos.settings.d.ts | 129 ++++++++++++---------------------------- 1 file changed, 39 insertions(+), 90 deletions(-) diff --git a/api/@ohos.settings.d.ts b/api/@ohos.settings.d.ts index a6b89532df..4d7802921f 100644 --- a/api/@ohos.settings.d.ts +++ b/api/@ohos.settings.d.ts @@ -769,97 +769,20 @@ declare namespace settings { */ const WIFI_WATCHDOG_STATUS: string } - - /** - * Enables or disables airplane mode. - * - * @param enable Specifies whether to enable airplane mode. The value {@code true} means to enable airplane - * mode, and {@code false} means to disable airplane mode. - * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. - * @since 7 - */ - function enableAirplaneMode(enable: boolean, callback: AsyncCallback): void; - function enableAirplaneMode(enable: boolean): Promise; - - /** - * Checks whether a specified application can show as float window. - * - * @param context Indicates the application context. - * @returns Returns {@code true} if the application can draw over other applications; returns {@code false} - * otherwise. - * @since 7 - */ - function canShowFloating(callback: AsyncCallback): void; - function canShowFloating(): Promise; /** * Constructs a URI for a specific name-value pair for monitoring data of the ability that uses the Data * template. + * * @param name Indicates the name of the setting to set. * @returns Returns the corresponding URI; returns {@code null} if the URI does not exist. * @since 7 + * @deprecated since 9 */ - function getURI(name: string, callback: AsyncCallback): void; - function getURI(name: string): Promise; + function getURI(name: string, callback: AsyncCallback): void; + function getURI(name: string): Promise; /** - * get settingsdata uri(synchronization method) - * @since 8 - * @param name Indicates the name of the setting to set. - * @returns Returns settingsdata uri. - */ - function getUriSync(name: string): string; - - /** - * get value from settingsdata - * @since 9 - * @param context Indicates the Context or dataAbilityHelper used to access - * the database. - * @param name Indicates the name of the character string. - * @returns Returns the value of the character string in the table if any is found; returns {@code null} - * otherwise. - * @StageModelOnly - */ - function getValue(context: Context, name: string, callback: AsyncCallback): void; - function getValue(context: Context, name: string): Promise; - - /** - * get value from settingsdata(synchronization method) - * @since 9 - * @param context Indicates Context or dataAbilityHelper instance - * @param name Indicates the name of the character string. - * @param defValue Indicates the default value of the character string. - * @returns settingsdata value - * @StageModelOnly - */ - function getValueSync(context: Context, name: string, defValue: string): string; - - /** - * set settingsdata value. - * @permission ohos.permission.MANAGE_SECURE_SETTINGS - * @since 9 - * @param context Indicates Context or dataAbilityHelper instance - * @param name Indicates the name of the character string. - * @param value Indicates the value of the character string. - * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. - * @StageModelOnly - */ - function setValue(context: Context, name: string, value: string, callback: AsyncCallback): void; - function setValue(context: Context, name: string, value: string): Promise; - - /** - * set settingsdata value(synchronization method) - * @permission ohos.permission.MANAGE_SECURE_SETTINGS - * @since 9 - * @param context Indicates Context or dataAbilityHelper instance - * @param name Indicates the name of the character string. - * @param value Indicates the value of the character string. - * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. - * @StageModelOnly - */ - function setValueSync(context: Context, name: string, value: string): boolean; - - /** * Obtains the value of a specified character string in the database. * * @param dataAbilityHelper Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used to access @@ -869,14 +792,14 @@ declare namespace settings { * otherwise. * @since 7 * @deprecated since 9 - * @useinstead getValue(context: context...) * @FAModelOnly */ - function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void; - function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise; + function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void; + function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise; /** * Saves a character string name and its value to the database. + * * @param dataAbilityHelper Indicates the {@link ohos.aafwk.ability.DataAbilityHelper} used to access * the database. * @param name Indicates the name of the character string. @@ -885,11 +808,40 @@ declare namespace settings { * @since 7 * @systemapi Hide this for inner system use. * @deprecated since 9 - * @useinstead setValue(context: context...) * @FAModelOnly */ - function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: string, callback: AsyncCallback): void; - function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: string): Promise; + function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void; + function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise; + + /** + * Enables or disables airplane mode. + * + * @param enable Specifies whether to enable airplane mode. The value {@code true} means to enable airplane + * mode, and {@code false} means to disable airplane mode. + * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * @since 7 + */ + function enableAirplaneMode(enable: boolean, callback: AsyncCallback): void; + function enableAirplaneMode(enable: boolean): Promise; + + /** + * Checks whether a specified application can show as float window. + * + * @param context Indicates the application context. + * @returns Returns {@code true} if the application can draw over other applications; returns {@code false} + * otherwise. + * @since 7 + */ + function canShowFloating(callback: AsyncCallback): void; + function canShowFloating(): Promise; + + /** + * get settingsdata uri(synchronization method) + * @since 8 + * @param name Indicates the name of the setting to set. + * @returns Returns settingsdata uri. + */ + function getUriSync(name: string): string; /** * get value from settingsdata(synchronization method) @@ -899,7 +851,6 @@ declare namespace settings { * @param defValue Indicates the default value of the character string. * @returns settingsdata value * @deprecated since 9 - * @useinstead getValueSync(context: context...) * @FAModelOnly */ function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string; @@ -913,11 +864,9 @@ declare namespace settings { * @param value Indicates the value of the character string. * @returns Returns {@code true} if the operation is successful; returns {@code false} otherwise. * @deprecated since 9 - * @useinstead setValueSync(context: context...) * @FAModelOnly */ function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean; - } export default settings; \ No newline at end of file -- Gitee