• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * Describes a normal text notification.
20 *
21 * @name NotificationBasicContent
22 * @since 7
23 * @sysCap SystemCapability.Notification.ANS
24 * @devices phone, tablet, tv, wearable, car
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.ANS
50 * @devices phone, tablet, tv, wearable, car
51 * @permission N/A
52 */
53export interface NotificationLongTextContent extends NotificationBasicContent {
54  /**
55   * Long text content of the notification.
56   */
57  longText: string;
58
59  /**
60   * Brief text of the long text notification.
61   */
62  briefText: string;
63
64  /**
65   * Title that will be displayed for the long text notification when it is expanded.
66   */
67  expandedTitle: string;
68}
69
70/**
71 * Describes a multi-line text notification.
72 *
73 * @name NotificationMultiLineContent
74 * @since 7
75 * @sysCap SystemCapability.Notification.ANS
76 * @devices phone, tablet, tv, wearable, car
77 * @permission N/A
78 */
79export interface NotificationMultiLineContent extends NotificationBasicContent {
80  /**
81   * Brief text of the multi-line text notification.
82   */
83  briefText: string;
84
85  /**
86   * Brief text of the multi-line text notification.
87   */
88  longTitle: string;
89
90  /**
91   * Multi-line content of the multi-line text notification.
92   */
93  lines: Array<string>;
94}
95
96/**
97 * Describes a picture-attached notification.
98 *
99 * @name NotificationPictureContent
100 * @since 7
101 * @sysCap SystemCapability.Notification.ANS
102 * @devices phone, tablet, tv, wearable, car
103 * @permission N/A
104 */
105export interface NotificationPictureContent extends NotificationBasicContent {
106  /**
107   * Multi-line content of the multi-line text notification.
108   */
109  briefText: string;
110
111  /**
112   * Title that will be displayed for the picture-attached notification when it is expanded.
113   */
114  expandedTitle: string;
115
116  /**
117   * Picture to be included in a notification.
118   */
119  picture: image.PixelMap;
120}
121
122/**
123 * Describes notification types.
124 *
125 * @name NotificationContent
126 * @since 7
127 * @sysCap SystemCapability.Notification.ANS
128 * @devices phone, tablet, tv, wearable, car
129 * @permission N/A
130 */
131export interface NotificationContent {
132  /**
133   * Notification content type.
134   */
135  contentType: notification.ContentType;
136
137  /**
138   * Normal text notification.
139   */
140  normal?: NotificationBasicContent;
141
142  /**
143   * Long text notification.
144   */
145  longText?: NotificationLongTextContent;
146
147  /**
148   * Multi-line text notification.
149   */
150  multiLine?: NotificationMultiLineContent;
151
152  /**
153   * Picture-attached notification.
154   */
155  picture?: NotificationPictureContent;
156}
157