2023-09-22 09:51:26 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023 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.
|
|
|
|
*/
|
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2024-01-08 07:25:39 +00:00
|
|
|
* @kit AbilityKit
|
2023-12-11 09:08:03 +00:00
|
|
|
*/
|
|
|
|
|
2023-09-22 09:51:26 +00:00
|
|
|
import type window from './@ohos.window';
|
|
|
|
import type insightIntent from './@ohos.app.ability.insightIntent';
|
|
|
|
import type InsightIntentContext from './@ohos.app.ability.InsightIntentContext';
|
|
|
|
import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The class of insight intent executor.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
|
|
|
* @StageModelOnly
|
2024-01-02 11:32:25 +00:00
|
|
|
* @atomicservice
|
2023-09-22 09:51:26 +00:00
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
export default class InsightIntentExecutor {
|
|
|
|
/**
|
|
|
|
* Indicates context of insight intent.
|
|
|
|
*
|
|
|
|
* @type { InsightIntentContext }
|
|
|
|
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
|
|
|
* @StageModelOnly
|
2024-01-02 11:32:25 +00:00
|
|
|
* @atomicservice
|
2023-09-22 09:51:26 +00:00
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
context: InsightIntentContext;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a UIAbility executes the insight intent in the foreground.
|
|
|
|
*
|
|
|
|
* @param { string } name - Indicates the insight intent name.
|
|
|
|
* @param { Record<string, Object> } param - Indicates the insight intent parameters.
|
|
|
|
* @param { window.WindowStage } pageLoader - Indicates the page loader.
|
|
|
|
* @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
|
|
|
|
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
|
|
|
|
* @StageModelOnly
|
2024-01-02 11:32:25 +00:00
|
|
|
* @atomicservice
|
2023-09-22 09:51:26 +00:00
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage):
|
|
|
|
insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a UIAbility executes the insight intent in the background.
|
|
|
|
*
|
|
|
|
* @param { string } name - Indicates the insight intent name.
|
|
|
|
* @param { Record<string, Object> } param - Indicates the insight intent parameters.
|
|
|
|
* @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
|
|
|
|
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
|
|
|
|
* @StageModelOnly
|
2024-01-02 11:32:25 +00:00
|
|
|
* @atomicservice
|
2023-09-22 09:51:26 +00:00
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
onExecuteInUIAbilityBackgroundMode(name: string, param: Record<string, Object>):
|
|
|
|
insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a UIExtensionAbility executes the insight intent.
|
|
|
|
*
|
|
|
|
* @param { string } name - Indicates the insight intent name.
|
|
|
|
* @param { Record<string, Object> } param - Indicates the insight intent parameters.
|
|
|
|
* @param { UIExtensionContentSession } pageLoader - Indicates the page loader.
|
|
|
|
* @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
|
|
|
|
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
|
|
|
* @StageModelOnly
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
onExecuteInUIExtensionAbility(name: string, param: Record<string, Object>, pageLoader: UIExtensionContentSession):
|
|
|
|
insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
|
2023-11-01 09:54:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a ServiceExtensionAbility executes the insight intent.
|
|
|
|
*
|
|
|
|
* @param { string } name - Indicates the insight intent name.
|
|
|
|
* @param { Record<string, Object> } param - Indicates the insight intent parameters.
|
|
|
|
* @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
|
|
|
|
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
|
|
|
* @StageModelOnly
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
onExecuteInServiceExtensionAbility(name: string, param: Record<string, Object>):
|
|
|
|
insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
|
2023-09-22 09:51:26 +00:00
|
|
|
}
|