diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index efe17b4b64240357af10d9f8d189a60dea3bbdfe..cecd49a5e35de6a10d920f0a2dfe0d2ec288288f 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -23,6 +23,7 @@ import { BundleInstaller } from './bundle/bundleInstaller'; import { ModuleUsageRecord } from './bundle/moduleUsageRecord'; import { PermissionDef } from './bundle/PermissionDef'; import image from './@ohos.multimedia.image'; +import { CheckPackageHasInstalledOptions } from './bundle/CheckPackageHasInstalledOptions'; /** * bundle. @@ -632,6 +633,16 @@ declare namespace bundle { */ function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; function isApplicationEnabled(bundleName: string): Promise; + + /** + * Checks whether a specified application is installed. + * + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + * @param options Indicates the CheckPackageHasInstalledOptions. + * @permission ohos.permission.GET_BUNDLE_INFO + */ + function hasInstalled(options: CheckPackageHasInstalledOptions): void; } export default bundle; diff --git a/api/bundle/CheckPackageHasInstalledOptions.d.ts b/api/bundle/CheckPackageHasInstalledOptions.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dae7822c860ffbbf6d533e8834e2c63f4062bd6d --- /dev/null +++ b/api/bundle/CheckPackageHasInstalledOptions.d.ts @@ -0,0 +1,72 @@ +/* + * 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 + * + * 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. + */ + +/** + * Indicates the CheckPackageHasInstalledResponse + * + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + * @permission NA + * @systemapi + */ +export interface CheckPackageHasInstalledResponse { + /** + * Indicates the result of this response + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + */ + result: boolean; +} + +/** + * Indicates parameters required for hasInstalled + * + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + * @permission NA + * @systemapi + */ +export interface CheckPackageHasInstalledOptions { + /** + * Indicates the name of the bundle + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + */ + bundleName: string; + + /** + * Indicates the success function + * @param data Indicates the response result + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + */ + success?: (data: CheckPackageHasInstalledResponse) => void; + + /** + * Indicates the fail function + * @param data Indicates the result data + * @param code Indicates the result code + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + */ + fail?: (data: any, code: number) => void; + + /** + * Indicates the complete function + * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework + */ + complete?: () => void; +}