From de7e3ab75057b5df31bf413e600fbf42b617070d Mon Sep 17 00:00:00 2001 From: zhaoyuan17 Date: Mon, 20 Dec 2021 16:40:07 +0000 Subject: [PATCH] Update session notification related d.ts Signed-off-by: zhaoyuan17 --- .../notificationActionButton.d.ts | 2 +- .../js/notification/notificationContent.d.ts | 73 ++++++++++++++++++- .../notification/notificationMessageUser.d.ts | 57 +++++++++++++++ .../js/notification/notificationRequest.d.ts | 2 +- .../notification/notificationUserInput.d.ts | 29 +++++++- 5 files changed, 158 insertions(+), 5 deletions(-) create mode 100644 interfaces/kits/js/notification/notificationMessageUser.d.ts diff --git a/interfaces/kits/js/notification/notificationActionButton.d.ts b/interfaces/kits/js/notification/notificationActionButton.d.ts index bf2549c69..b2967c462 100644 --- a/interfaces/kits/js/notification/notificationActionButton.d.ts +++ b/interfaces/kits/js/notification/notificationActionButton.d.ts @@ -4,7 +4,7 @@ * 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 + * 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, diff --git a/interfaces/kits/js/notification/notificationContent.d.ts b/interfaces/kits/js/notification/notificationContent.d.ts index d2cc36ebd..037300c24 100644 --- a/interfaces/kits/js/notification/notificationContent.d.ts +++ b/interfaces/kits/js/notification/notificationContent.d.ts @@ -14,7 +14,9 @@ */ import notification from '../@ohos.notification'; -import image from './@ohos.multimedia.image'; +import image from '../@ohos.multimedia.image'; +import { MessageUser } from './notificationMessageUser'; + /** * Describes a normal text notification. * @@ -119,6 +121,68 @@ export interface NotificationPictureContent extends NotificationBasicContent { picture: image.PixelMap; } +/** + * Constructs a conversation-like notification that includes message communication among multiple users. + * + * @since 8 + */ +export interface NotificationConversationalContent extends NotificationBasicContent { + /** + * Indicates the {@code MessageUser} who sends all objects in this conversation-like notification. + * This parameter cannot be null. + */ + user: MessageUser; + + /** + * Obtains all messages included in this conversation-like notification. + */ + messages: Array; + + /** + * Checks whether this notification represents a group conversation. + */ + conversationGroup?: boolean; + + /** + * Obtains the title to be displayed for the conversation. + */ + conversationTitle?: string; +} + +/** + * Provides methods for defining a conversational message that is used in notifications created with + * {@link NotificationConversationalContent}. Each message contains the message content, timestamp, and + * sender; and the message content and sender information will be displayed in the notification bar. + * + * @since 8 + */ +export interface ConversationalMessage { + /** + * Obtains the text to be displayed as the content of this message. + */ + text: string; + + /** + * Obtains the time when this message arrived. + */ + timestamp: number; + + /** + * Obtains the sender of this message. + */ + sender: MessageUser; + + /** + * Obtains the MIME type of this message. + */ + mimeType?: string; + + /** + * Obtains the URI of this message. + */ + uri?: string; +} + /** * Describes notification types. * @@ -153,4 +217,11 @@ export interface NotificationContent { * Picture-attached notification. */ picture?: NotificationPictureContent; + + /** + * Constructs a conversation-like notification that includes message communication among multiple users. + * + * @since 8 + */ + conversation?: NotificationConversationalContent; } diff --git a/interfaces/kits/js/notification/notificationMessageUser.d.ts b/interfaces/kits/js/notification/notificationMessageUser.d.ts new file mode 100644 index 000000000..40d01bde1 --- /dev/null +++ b/interfaces/kits/js/notification/notificationMessageUser.d.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2021 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 image from '../@ohos.multimedia.image'; + +/** + * Represents a message sender that can be used by {@link NotificationRequest}, + * + * @name MessageUser + * @since 8 + * @devices phone, tablet, tv, wearable, car + * @permission N/A + * @sysCap SystemCapability.Notification.ANS + */ +export interface MessageUser { + /** + * Obtains the name of this {@code MessageUser}. + */ + name: string; + + /** + * Obtains the key of this {@code MessageUser}. + */ + key: string; + + /** + * Obtains the URI of this {@code MessageUser}. + */ + uri: string; + + /** + * Checks whether this {@code MessageUser} is important. + */ + isMachine: boolean; + + /** + * Checks whether this {@code MessageUser} is a machine. + */ + isUserImportant: boolean; + + /** + * Obtains the icon of this {@code MessageUser}. + */ + icon?: image.PixelMap; +} diff --git a/interfaces/kits/js/notification/notificationRequest.d.ts b/interfaces/kits/js/notification/notificationRequest.d.ts index ce183326f..6cefef386 100644 --- a/interfaces/kits/js/notification/notificationRequest.d.ts +++ b/interfaces/kits/js/notification/notificationRequest.d.ts @@ -4,7 +4,7 @@ * 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 + * 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, diff --git a/interfaces/kits/js/notification/notificationUserInput.d.ts b/interfaces/kits/js/notification/notificationUserInput.d.ts index 1b44e878e..389d1c43c 100644 --- a/interfaces/kits/js/notification/notificationUserInput.d.ts +++ b/interfaces/kits/js/notification/notificationUserInput.d.ts @@ -4,7 +4,7 @@ * 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 + * 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, @@ -17,7 +17,7 @@ * Describes a NotificationUserInput instance. * * @name NotificationUserInput - * @since 7 + * @since 8 * @devices phone, tablet, tv, wearable, car * @permission N/A * @sysCap SystemCapability.Notification.ANS @@ -27,4 +27,29 @@ export interface NotificationUserInput { * Obtains the key used to identify this input when the input is collected from the user. */ inputKey: string; + + /** + * Obtains the tag to be displayed to the user when collecting this input from the user. + */ + tag: string; + + /** + * Obtains the options provided to users to satisfy user input needs. All options are displayed in a single line. + */ + options: Array; + + /** + * Obtains whether users can input values of the given MIME type. + */ + permitMimeTypes?: Array; + + /** + * Obtains the edit type of the options provided by this {@code NotificationUserInput} object. + */ + editType?: number; + + /** + * Obtains additional data to this NotificationUserInput. + */ + additionalData?: {[key: string]: Object}; } -- Gitee