commit smart auto fill interface

Signed-off-by: xinking129 <xinxin13@huawei.com>
This commit is contained in:
xinking129 2024-03-18 14:14:12 +08:00
parent 77634e7a7f
commit c780af15f5
6 changed files with 170 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@ -21,7 +21,7 @@
import ExtensionAbility from './@ohos.app.ability.ExtensionAbility';
import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession';
import type AutoFillExtensionContext from './application/AutoFillExtensionContext';
import type { FillRequest, SaveRequest, FillRequestCallback, SaveRequestCallback } from './application/AutoFillRequest';
import type { FillRequest, SaveRequest, UpdateRequest, FillRequestCallback, SaveRequestCallback } from './application/AutoFillRequest';
/**
* The class of auto fill extension ability.
@ -80,6 +80,17 @@ export default class AutoFillExtensionAbility extends ExtensionAbility {
*/
onSaveRequest(session: UIExtensionContentSession, request: SaveRequest, callback: SaveRequestCallback): void;
/**
* Called back when an update request is coming.
*
* @param { UpdateRequest } request - Indicates the update request.
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
onUpdateRequest(request: UpdateRequest): void;
/**
* Called back when an auto fill extension session is destroyed.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@ -23,6 +23,7 @@ import type * as _ViewData from './application/ViewData';
import type * as _PageNodeInfo from './application/PageNodeInfo';
import { AutoFillType } from './application/AutoFillType';
import type * as _AutoFillRequest from './application/AutoFillRequest';
import type * as _AutoFillRect from './application/AutoFillRect';
/**
* This module provides the function of auto fill manager.
@ -153,6 +154,16 @@ declare namespace autoFillManager {
* @since 11
*/
export type SaveRequestCallback = _AutoFillRequest.SaveRequestCallback;
/**
* Auto fill rectangle.
*
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
export type AutoFillRect = _AutoFillRect.default;
}
export default autoFillManager;

74
api/application/AutoFillRect.d.ts vendored Normal file
View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2024 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.
*/
/**
* @file
* @kit AbilityKit
*/
/**
* Auto fill rectangle.
*
* @interface AutoFillRect
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @stagemodelonly
* @since 12
*/
export default interface AutoFillRect {
/**
* The left of the rect.
*
* @type { number }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @stagemodelonly
* @since 12
*/
left: number;
/**
* The top of the rect.
*
* @type { number }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @stagemodelonly
* @since 12
*/
top: number;
/**
* The width of the rect.
*
* @type { number }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @stagemodelonly
* @since 12
*/
width: number;
/**
* The height of the rect.
*
* @type { number }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @stagemodelonly
* @since 12
*/
height: number;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@ -47,6 +47,17 @@ export interface FillRequest {
* @since 11
*/
viewData: ViewData;
/**
* Whether the UI extension modal is of popup.
*
* @type { boolean }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
isPopup: boolean;
}
/**
@ -71,6 +82,28 @@ export interface SaveRequest {
viewData: ViewData;
}
/**
* Update request for automatic filling.
*
* @interface UpdateRequest
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
export interface UpdateRequest {
/**
* The view data. Indicates the basic page information for the update request.
*
* @type { ViewData }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
viewData: ViewData;
}
/**
* Fill response for automatic filling.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@ -14,6 +14,7 @@
*/
import type { AutoFillType } from './AutoFillType';
import type AutoFillRect from './AutoFillRect';
/**
* Page node info for automatic filling.
@ -112,4 +113,26 @@ export default interface PageNodeInfo {
* @since 11
*/
enableAutoFill: boolean;
/**
* The rect of page node.
*
* @type { AutoFillRect }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
rect: AutoFillRect;
/**
* Is the page node in the focus.
*
* @type { boolean }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
isFocus: boolean;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 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
@ -14,6 +14,7 @@
*/
import type PageNodeInfo from './PageNodeInfo';
import type AutoFillRect from './AutoFillRect';
/**
* View data for automatic filling.
@ -79,4 +80,15 @@ export default interface ViewData {
* @since 11
*/
pageNodeInfos: Array<PageNodeInfo>;
/**
* The page rect infos.
*
* @type { AutoFillRect }
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @systemapi
* @StageModelOnly
* @since 12
*/
pageRect: AutoFillRect;
}