diff --git a/interfaces/kits/js/notification/notificationActionButton.d.ts b/interfaces/kits/js/notification/notificationActionButton.d.ts index bf2549c696b2c4df105ace9c11ab2ae2d4968ea0..b2967c4626c391d915525657be1582e2e19ce0b6 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 d2cc36ebdc6e98670dfc6dc78c3071da0564e4f5..037300c24bfc8c1de315cb4dab649be24786488d 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 0000000000000000000000000000000000000000..40d01bde11edcb54e6bcbc6719089e6a37818c71 --- /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 ce183326fee650449a42828ef2fb1c7fdebcd735..6cefef3867a765a6abd5cd0e324b2d904af1b258 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 1b44e878efec0ca8dc40b4a0fc78a93dbd384f12..389d1c43c713fbf53a07d47a753463212fae7e1b 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}; }