• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 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
16import notification from '../@ohos.notification';
17import image from '../@ohos.multimedia.image';
18
19/**
20 * Describes a normal text notification.
21 *
22 * @name NotificationBasicContent
23 * @since 7
24 * @syscap SystemCapability.Notification.Notification
25 * @permission N/A
26 */
27export interface NotificationBasicContent {
28  /**
29   * Title of the normal text notification.
30   */
31  title: string;
32
33  /**
34   * Content of the normal text notification.
35   */
36  text: string;
37
38  /**
39   * Additional information of the normal text notification.
40   */
41  additionalText?: string;
42}
43
44/**
45 * Describes a long text notification.
46 *
47 * @name NotificationLongTextContent
48 * @since 7
49 * @syscap SystemCapability.Notification.Notification
50 * @permission N/A
51 */
52export interface NotificationLongTextContent extends NotificationBasicContent {
53  /**
54   * Long text content of the notification.
55   */
56  longText: string;
57
58  /**
59   * Brief text of the long text notification.
60   */
61  briefText: string;
62
63  /**
64   * Title that will be displayed for the long text notification when it is expanded.
65   */
66  expandedTitle: string;
67}
68
69/**
70 * Describes a multi-line text notification.
71 *
72 * @name NotificationMultiLineContent
73 * @since 7
74 * @syscap SystemCapability.Notification.Notification
75 * @permission N/A
76 */
77export interface NotificationMultiLineContent extends NotificationBasicContent {
78  /**
79   * Brief text of the multi-line text notification.
80   */
81  briefText: string;
82
83  /**
84   * Brief text of the multi-line text notification.
85   */
86  longTitle: string;
87
88  /**
89   * Multi-line content of the multi-line text notification.
90   */
91  lines: Array<string>;
92}
93
94/**
95 * Describes a picture-attached notification.
96 *
97 * @name NotificationPictureContent
98 * @since 7
99 * @syscap SystemCapability.Notification.Notification
100 * @permission N/A
101 */
102export interface NotificationPictureContent extends NotificationBasicContent {
103  /**
104   * Multi-line content of the multi-line text notification.
105   */
106  briefText: string;
107
108  /**
109   * Title that will be displayed for the picture-attached notification when it is expanded.
110   */
111  expandedTitle: string;
112
113  /**
114   * Picture to be included in a notification.
115   */
116  picture: image.PixelMap;
117}
118
119/**
120 * Describes notification types.
121 *
122 * @name NotificationContent
123 * @since 7
124 * @syscap SystemCapability.Notification.Notification
125 * @permission N/A
126 */
127export interface NotificationContent {
128  /**
129   * Notification content type.
130   */
131  contentType: notification.ContentType;
132
133  /**
134   * Normal text notification.
135   */
136  normal?: NotificationBasicContent;
137
138  /**
139   * Long text notification.
140   */
141  longText?: NotificationLongTextContent;
142
143  /**
144   * Multi-line text notification.
145   */
146  multiLine?: NotificationMultiLineContent;
147
148  /**
149   * Picture-attached notification.
150   */
151  picture?: NotificationPictureContent;
152}
153