From b7739d7decd0d61aefd2e1f1982cfddf98b4f0ee Mon Sep 17 00:00:00 2001 From: huangke11 Date: Tue, 8 Feb 2022 11:09:46 +0800 Subject: [PATCH 1/6] add cust js-api Signed-off-by: huangke11 --- api/@ohos.cust.d.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 api/@ohos.cust.d.ts diff --git a/api/@ohos.cust.d.ts b/api/@ohos.cust.d.ts new file mode 100644 index 0000000000..2f1abb06c0 --- /dev/null +++ b/api/@ohos.cust.d.ts @@ -0,0 +1,64 @@ +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import {AsyncCallback} from "./basic"; + +/** + * Provides cust file path related APIS. + * + * @since 8 + * @sysCap SystemCapability.Customization.Cust + */ +declare namespace cust { + /** + * Get file from the highest priority config path which contains the given file name. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap SystemCapability.Customization.Cust + * @param pathSuffix the relative path of the config file. + * @param type 0 for common file, 1 for future use. + * @return Returns the path of the highest priority config file. + */ + function getCfgFile(pathSuffix: string, type?: number, callback: AsyncCallback); + function getCfgFile(pathSuffix: string, type?: number): Promise; + + /** + * Get config files in device architecture, ordered by priority from low to high. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap SystemCapability.Customization.Cust + * @param pathSuffix Indicates the path of the file to open. + * @param type 0 for common file, 1 for future use. + * @return Returns paths of config files. + */ + function getCfgFileList(pathSuffix: string, type?: number, callback: AsyncCallback); + function getCfgFileList(pathSuffix: string, type?: number): Promise>; + + /** + * Get config directories in device architecture, ordered by priority from low to high. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap SystemCapability.Customization.Cust + * @param type 0 for common file, 1 for future use. + * @return Returns paths of config directories. + */ + function getCfgDir(type?: number, callback: AsyncCallback>): void; + function getCfgDir(type?: number): Promise>; +} + +export default cust; \ No newline at end of file -- Gitee From 68abd0f4e8a1a0c398db1a557d6082d1b04227f3 Mon Sep 17 00:00:00 2001 From: huangke11 Date: Tue, 8 Feb 2022 11:34:06 +0800 Subject: [PATCH 2/6] add cust js api Signed-off-by: huangke11 --- api/@ohos.cust.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/@ohos.cust.d.ts b/api/@ohos.cust.d.ts index 2f1abb06c0..200045dea2 100644 --- a/api/@ohos.cust.d.ts +++ b/api/@ohos.cust.d.ts @@ -1,10 +1,10 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * -* http://www.apache.org/licenses/LICENSE-2.0 +* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -41,11 +41,11 @@ declare namespace cust { * @devices phone, tablet, tv, wearable, car * @since 8 * @sysCap SystemCapability.Customization.Cust - * @param pathSuffix Indicates the path of the file to open. + * @param pathSuffix the relative path of the config file. * @param type 0 for common file, 1 for future use. * @return Returns paths of config files. */ - function getCfgFileList(pathSuffix: string, type?: number, callback: AsyncCallback); + function getCfgFileList(pathSuffix: string, type?: number, callback: AsyncCallback>); function getCfgFileList(pathSuffix: string, type?: number): Promise>; /** @@ -54,11 +54,11 @@ declare namespace cust { * @devices phone, tablet, tv, wearable, car * @since 8 * @sysCap SystemCapability.Customization.Cust - * @param type 0 for common file, 1 for future use. + * @param type 0 for common configs, 1 for future use. * @return Returns paths of config directories. */ - function getCfgDir(type?: number, callback: AsyncCallback>): void; + function getCfgDir(type?: number, callback: AsyncCallback>); function getCfgDir(type?: number): Promise>; } -export default cust; \ No newline at end of file +export default cust; -- Gitee From ba4720bf6d39515e08938bcefdfd5875ec3d5cd7 Mon Sep 17 00:00:00 2001 From: huangke11 Date: Tue, 8 Feb 2022 19:49:00 +0800 Subject: [PATCH 3/6] add cust js api Signed-off-by: huangke11 --- api/@ohos.cust.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/api/@ohos.cust.d.ts b/api/@ohos.cust.d.ts index 200045dea2..1403b02e55 100644 --- a/api/@ohos.cust.d.ts +++ b/api/@ohos.cust.d.ts @@ -27,38 +27,38 @@ declare namespace cust { * * @devices phone, tablet, tv, wearable, car * @since 8 + * @systemapi Hide this for inner system use. * @sysCap SystemCapability.Customization.Cust * @param pathSuffix the relative path of the config file. - * @param type 0 for common file, 1 for future use. * @return Returns the path of the highest priority config file. */ - function getCfgFile(pathSuffix: string, type?: number, callback: AsyncCallback); - function getCfgFile(pathSuffix: string, type?: number): Promise; + function getCfgFile(pathSuffix: string, callback: AsyncCallback); + function getCfgFile(pathSuffix: string): Promise; /** * Get config files in device architecture, ordered by priority from low to high. * * @devices phone, tablet, tv, wearable, car * @since 8 + * @systemapi Hide this for inner system use. * @sysCap SystemCapability.Customization.Cust * @param pathSuffix the relative path of the config file. - * @param type 0 for common file, 1 for future use. * @return Returns paths of config files. */ - function getCfgFileList(pathSuffix: string, type?: number, callback: AsyncCallback>); - function getCfgFileList(pathSuffix: string, type?: number): Promise>; + function getCfgFileList(pathSuffix: string, callback: AsyncCallback>); + function getCfgFileList(pathSuffix: string): Promise>; /** * Get config directories in device architecture, ordered by priority from low to high. * * @devices phone, tablet, tv, wearable, car * @since 8 + * @systemapi Hide this for inner system use. * @sysCap SystemCapability.Customization.Cust - * @param type 0 for common configs, 1 for future use. * @return Returns paths of config directories. */ - function getCfgDir(type?: number, callback: AsyncCallback>); - function getCfgDir(type?: number): Promise>; + function getCfgDir(callback: AsyncCallback>); + function getCfgDir(): Promise>; } export default cust; -- Gitee From fe721d72b3f8085b2205cc6b76a89026a33f9fa4 Mon Sep 17 00:00:00 2001 From: huangke11 Date: Tue, 8 Feb 2022 21:07:20 +0800 Subject: [PATCH 4/6] add cust js api Signed-off-by: huangke11 --- api/@ohos.cust.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/@ohos.cust.d.ts b/api/@ohos.cust.d.ts index 1403b02e55..86b70fbd21 100644 --- a/api/@ohos.cust.d.ts +++ b/api/@ohos.cust.d.ts @@ -29,11 +29,11 @@ declare namespace cust { * @since 8 * @systemapi Hide this for inner system use. * @sysCap SystemCapability.Customization.Cust - * @param pathSuffix the relative path of the config file. + * @param relPath the relative path of the config file. * @return Returns the path of the highest priority config file. */ - function getCfgFile(pathSuffix: string, callback: AsyncCallback); - function getCfgFile(pathSuffix: string): Promise; + function getOneCfgFile(relPath: string, callback: AsyncCallback); + function getOneCfgFile(relPath: string): Promise; /** * Get config files in device architecture, ordered by priority from low to high. @@ -42,11 +42,11 @@ declare namespace cust { * @since 8 * @systemapi Hide this for inner system use. * @sysCap SystemCapability.Customization.Cust - * @param pathSuffix the relative path of the config file. + * @param relPath the relative path of the config file. * @return Returns paths of config files. */ - function getCfgFileList(pathSuffix: string, callback: AsyncCallback>); - function getCfgFileList(pathSuffix: string): Promise>; + function getCfgFiles(relPath: string, callback: AsyncCallback>); + function getCfgFiles(relPath: string): Promise>; /** * Get config directories in device architecture, ordered by priority from low to high. @@ -57,8 +57,8 @@ declare namespace cust { * @sysCap SystemCapability.Customization.Cust * @return Returns paths of config directories. */ - function getCfgDir(callback: AsyncCallback>); - function getCfgDir(): Promise>; + function getCfgDirList(callback: AsyncCallback>); + function getCfgDirList(): Promise>; } export default cust; -- Gitee From 1486e10c4ad09be69bb9a34128301b155821e105 Mon Sep 17 00:00:00 2001 From: huangke11 Date: Mon, 14 Feb 2022 17:52:45 +0800 Subject: [PATCH 5/6] add cust js api Signed-off-by: huangke11 --- api/@ohos.cust.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/@ohos.cust.d.ts b/api/@ohos.cust.d.ts index 86b70fbd21..fa769a8b8c 100644 --- a/api/@ohos.cust.d.ts +++ b/api/@ohos.cust.d.ts @@ -19,7 +19,7 @@ import {AsyncCallback} from "./basic"; * Provides cust file path related APIS. * * @since 8 - * @sysCap SystemCapability.Customization.Cust + * @sysCap SystemCapability.Customization.ConfigPolicy */ declare namespace cust { /** @@ -28,7 +28,7 @@ declare namespace cust { * @devices phone, tablet, tv, wearable, car * @since 8 * @systemapi Hide this for inner system use. - * @sysCap SystemCapability.Customization.Cust + * @sysCap SystemCapability.Customization.ConfigPolicy * @param relPath the relative path of the config file. * @return Returns the path of the highest priority config file. */ @@ -41,7 +41,7 @@ declare namespace cust { * @devices phone, tablet, tv, wearable, car * @since 8 * @systemapi Hide this for inner system use. - * @sysCap SystemCapability.Customization.Cust + * @sysCap SystemCapability.Customization.ConfigPolicy * @param relPath the relative path of the config file. * @return Returns paths of config files. */ @@ -54,7 +54,7 @@ declare namespace cust { * @devices phone, tablet, tv, wearable, car * @since 8 * @systemapi Hide this for inner system use. - * @sysCap SystemCapability.Customization.Cust + * @sysCap SystemCapability.Customization.ConfigPolicy * @return Returns paths of config directories. */ function getCfgDirList(callback: AsyncCallback>); -- Gitee From 9082c172eb8f1b9f7a7c10e85018ab9f9c4e788e Mon Sep 17 00:00:00 2001 From: huangke11 Date: Tue, 15 Feb 2022 11:27:31 +0800 Subject: [PATCH 6/6] add configPolicy js api Signed-off-by: huangke11 --- api/{@ohos.cust.d.ts => @ohos.configPolicy.d.ts} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename api/{@ohos.cust.d.ts => @ohos.configPolicy.d.ts} (95%) diff --git a/api/@ohos.cust.d.ts b/api/@ohos.configPolicy.d.ts similarity index 95% rename from api/@ohos.cust.d.ts rename to api/@ohos.configPolicy.d.ts index fa769a8b8c..233789b708 100644 --- a/api/@ohos.cust.d.ts +++ b/api/@ohos.configPolicy.d.ts @@ -16,12 +16,12 @@ import {AsyncCallback} from "./basic"; /** - * Provides cust file path related APIS. + * Provides file path related APIS. * * @since 8 * @sysCap SystemCapability.Customization.ConfigPolicy */ -declare namespace cust { +declare namespace configPolicy { /** * Get file from the highest priority config path which contains the given file name. * @@ -61,4 +61,4 @@ declare namespace cust { function getCfgDirList(): Promise>; } -export default cust; +export default configPolicy; -- Gitee