• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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 * @typedef NotificationBasicContent
23 * @syscap SystemCapability.Notification.Notification
24 * @since 7
25 */
26export interface NotificationBasicContent {
27  /**
28   * Title of the normal text notification.
29   *
30   * @type { string }
31   * @syscap SystemCapability.Notification.Notification
32   * @since 7
33   */
34  title: string;
35
36  /**
37   * Content of the normal text notification.
38   *
39   * @type { string }
40   * @syscap SystemCapability.Notification.Notification
41   * @since 7
42   */
43  text: string;
44
45  /**
46   * Additional information of the normal text notification.
47   *
48   * @type { ?string }
49   * @syscap SystemCapability.Notification.Notification
50   * @since 7
51   */
52  additionalText?: string;
53}
54
55/**
56 * Describes a long text notification.
57 *
58 * @typedef NotificationLongTextContent
59 * @syscap SystemCapability.Notification.Notification
60 * @since 7
61 */
62export interface NotificationLongTextContent extends NotificationBasicContent {
63  /**
64   * Long text content of the notification.
65   *
66   * @type { string }
67   * @syscap SystemCapability.Notification.Notification
68   * @since 7
69   */
70  longText: string;
71
72  /**
73   * Brief text of the long text notification.
74   *
75   * @type { string }
76   * @syscap SystemCapability.Notification.Notification
77   * @since 7
78   */
79  briefText: string;
80
81  /**
82   * Title that will be displayed for the long text notification when it is expanded.
83   *
84   * @type { string }
85   * @syscap SystemCapability.Notification.Notification
86   * @since 7
87   */
88  expandedTitle: string;
89}
90
91/**
92 * Describes a multi-line text notification.
93 *
94 * @typedef NotificationMultiLineContent
95 * @syscap SystemCapability.Notification.Notification
96 * @since 7
97 */
98export interface NotificationMultiLineContent extends NotificationBasicContent {
99  /**
100   * Brief text of the multi-line text notification.
101   *
102   * @type { string }
103   * @syscap SystemCapability.Notification.Notification
104   * @since 7
105   */
106  briefText: string;
107
108  /**
109   * Brief text of the multi-line text notification.
110   *
111   * @type { string }
112   * @syscap SystemCapability.Notification.Notification
113   * @since 7
114   */
115  longTitle: string;
116
117  /**
118   * Multi-line content of the multi-line text notification.
119   *
120   * @type { Array<string> }
121   * @syscap SystemCapability.Notification.Notification
122   * @since 7
123   */
124  lines: Array<string>;
125}
126
127/**
128 * Describes a picture-attached notification.
129 *
130 * @typedef NotificationPictureContent
131 * @syscap SystemCapability.Notification.Notification
132 * @since 7
133 */
134export interface NotificationPictureContent extends NotificationBasicContent {
135  /**
136   * Multi-line content of the multi-line text notification.
137   *
138   * @type { string }
139   * @syscap SystemCapability.Notification.Notification
140   * @since 7
141   */
142  briefText: string;
143
144  /**
145   * Title that will be displayed for the picture-attached notification when it is expanded.
146   *
147   * @type { string }
148   * @syscap SystemCapability.Notification.Notification
149   * @since 7
150   */
151  expandedTitle: string;
152
153  /**
154   * Picture to be included in a notification.
155   *
156   * @type { image.PixelMap }
157   * @syscap SystemCapability.Notification.Notification
158   * @since 7
159   */
160  picture: image.PixelMap;
161}
162
163/**
164 * Describes notification types.
165 *
166 * @typedef NotificationContent
167 * @syscap SystemCapability.Notification.Notification
168 * @since 7
169 */
170export interface NotificationContent {
171  /**
172   * Notification content type.
173   *
174   * @type { notification.ContentType }
175   * @syscap SystemCapability.Notification.Notification
176   * @since 7
177   */
178  contentType: notification.ContentType;
179
180  /**
181   * Normal text notification.
182   *
183   * @type { ?NotificationBasicContent }
184   * @syscap SystemCapability.Notification.Notification
185   * @since 7
186   */
187  normal?: NotificationBasicContent;
188
189  /**
190   * Long text notification.
191   *
192   * @type { ?NotificationLongTextContent }
193   * @syscap SystemCapability.Notification.Notification
194   * @since 7
195   */
196  longText?: NotificationLongTextContent;
197
198  /**
199   * Multi-line text notification.
200   *
201   * @type { ?NotificationMultiLineContent }
202   * @syscap SystemCapability.Notification.Notification
203   * @since 7
204   */
205  multiLine?: NotificationMultiLineContent;
206
207  /**
208   * Picture-attached notification.
209   *
210   * @type { ?NotificationPictureContent }
211   * @syscap SystemCapability.Notification.Notification
212   * @since 7
213   */
214  picture?: NotificationPictureContent;
215}
216