1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit AbilityKit 19 */ 20 21import ExtensionAbility from './@ohos.app.ability.ExtensionAbility'; 22import PhotoEditorExtensionContext from './application/PhotoEditorExtensionContext'; 23import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession'; 24import type Want from './@ohos.app.ability.Want'; 25 26/** 27 * Class of the photo editor ExtensionAbility, which provides APIs for you to edit photos. 28 * 29 * @extends ExtensionAbility 30 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 31 * @StageModelOnly 32 * @since 12 33 */ 34export default class PhotoEditorExtensionAbility extends ExtensionAbility { 35 /** 36 * Indicates configuration information about an Photo editor extension ability context. 37 * 38 * @type { PhotoEditorExtensionContext } 39 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 40 * @StageModelOnly 41 * @since 12 42 */ 43 context: PhotoEditorExtensionContext; 44 45 /** 46 * Called back when an UI extension is started for initialization. 47 * 48 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 49 * @StageModelOnly 50 * @since 12 51 */ 52 onCreate(): void; 53 54 /** 55 * Called back when the state of an UI extension changes to foreground. 56 * 57 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 58 * @StageModelOnly 59 * @since 12 60 */ 61 onForeground(): void; 62 63 /** 64 * Called back when the state of an UI extension changes to background. 65 * 66 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 67 * @StageModelOnly 68 * @since 12 69 */ 70 onBackground(): void; 71 72 /** 73 * Called back before an UI extension is destroyed. 74 * 75 * @returns { void | Promise<void> } the promise returned by the function. 76 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 77 * @StageModelOnly 78 * @since 12 79 */ 80 onDestroy(): void | Promise<void>; 81 82 /** 83 * Called back when an UI extension session is created and original image is ready. 84 * 85 * @param { string } uri - Indicates the uri info of the original image. 86 * @param { Want } want - Indicates the want info of the UI extension. 87 * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page. 88 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 89 * @StageModelOnly 90 * @since 12 91 */ 92 onStartContentEditing(uri: string, want: Want, session: UIExtensionContentSession): void; 93}