/* * 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. */ import { AsyncCallback } from "./basic"; import { Callback } from "./basic"; import Want from './@ohos.app.ability.Want'; import formInfo from './@ohos.app.form.formInfo' /** * interface of formHost. * * @name formHost * @since 8 * @syscap SystemCapability.Ability.Form * @systemapi hide for inner use. * @deprecated since 9 * @useinstead ohos.app.form.formHost */ declare namespace formHost { /** * Deletes an obtained form by its ID. * *
After this method is called, the form won't be available for use by the application and the Form Manager * Service no longer keeps the cache information about the form.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formId Indicates the form ID * @returns - * @permission ohos.permission.REQUIRE_FORM */ function deleteForm(formId: string, callback: AsyncCallbackAfter this method is called, the form won't be available for use by the application, but the Form Manager * Service still keeps the cache information about the form, so that the application can quickly obtain it based on * the {@code formId}.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formId Indicates the form ID * @param isReleaseCache Indicates whether or not release cache * @returns - * @permission ohos.permission.REQUIRE_FORM */ function releaseForm(formId: string, callback: AsyncCallbackThis method must be called when the application has detected that a system setting item (such as the language, * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form * provider automatically updates the form data (if there is any update) through the form framework, with the update * process being unperceivable by the application.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formId Indicates the ID of the form to update. * @returns - * @permission ohos.permission.REQUIRE_FORM */ function requestForm(formId: string, callback: AsyncCallbackAfter this method is successfully called, onVisibilityChange will be called to notify the form provider of * the form visibility change event.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formIds Indicates the IDs of the forms to be made visible. * @returns - * @permission ohos.permission.REQUIRE_FORM */ function notifyVisibleForms(formIds: ArrayAfter this method is successfully called, onVisibilityChange will be called to notify the form provider of * the form visibility change event.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formIds Indicates the IDs of the forms to be made invisible. * @returns - * @permission ohos.permission.REQUIRE_FORM */ function notifyInvisibleForms(formIds: ArrayYou can use this method to set form refresh state to true, the form can receive new * update from service.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formIds Indicates the IDs of the forms to be made invisible. * @returns - * @permission ohos.permission.REQUIRE_FORM */ function enableFormsUpdate(formIds: ArrayYou can use this method to set form refresh state to false, the form do not receive * new update from service.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formIds Indicates the IDs of the forms to be made invisible. * @returns - * @permission ohos.permission.REQUIRE_FORM */ function disableFormsUpdate(formIds: ArrayYou can use this method to obtain the system is ready.
* * @since 8 * @syscap SystemCapability.Ability.Form * @returns - */ function isSystemReady(callback: AsyncCallbackYou can use this method to delete invalid forms of the application.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formIds Indicates the specify form id. * @returns Returns the number of invalid forms deleted by the Form Manager Service * @permission ohos.permission.REQUIRE_FORM */ function deleteInvalidForms(formIds: ArrayYou can use this method to obtains the form state.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param want Indicates want of the form. * @returns Returns form state {@link FormStateInfo} * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED */ function acquireFormState(want: Want, callback: AsyncCallbackYou can use this method to listen to the event of uninstall form.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param type Indicates event type. * @returns - */ function on(type: "formUninstall", callback: CallbackYou can use this method to cancel listening to the event of uninstall form.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param type Indicates event type. * @returns - */ function off(type: "formUninstall", callback?: CallbackYou can use this method to notify form visible state.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formIds Indicates the specify form id. * @param isVisible Indicates whether visible. * @returns - * @permission ohos.permission.REQUIRE_FORM */ function notifyFormsVisible(formIds: ArrayYou can use this method to notify form enable update state.
* * @since 8 * @syscap SystemCapability.Ability.Form * @param formIds Indicates the specify form id. * @param isEnableUpdate Indicates whether enable update. * @returns - * @permission ohos.permission.REQUIRE_FORM */ function notifyFormsEnableUpdate(formIds: Array