• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2024 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
16/**
17 * @file The NotificationSlot module provides APIs for defining the notification slot.
18 * @kit NotificationKit
19 */
20
21/*** if arkts 1.1 */
22import notification from '../@ohos.notification';
23/*** endif */
24/*** if arkts 1.1&1.2 */
25import type notificationManager from '../@ohos.notificationManager';
26/*** endif */
27
28/**
29 * The NotificationSlot module provides APIs for defining the notification slot.
30 *
31 * @typedef NotificationSlot
32 * @syscap SystemCapability.Notification.Notification
33 * @since arkts {'1.1':'7', '1.2':'20'}
34 * @arkts 1.1&1.2
35 */
36export interface NotificationSlot {
37  /**
38   * Notification slot type.
39   *
40   * @type { ?notification.SlotType }
41   * @syscap SystemCapability.Notification.Notification
42   * @since 7
43   * @deprecated since 11
44   * @useinstead NotificationSlot#notificationType
45   */
46  type?: notification.SlotType;
47
48  /**
49   * Notification slot type.
50   *
51   * @type { ?notificationManager.SlotType }
52   * @syscap SystemCapability.Notification.Notification
53   * @since arkts {'1.1':'11', '1.2':'20'}
54   * @arkts 1.1&1.2
55   */
56  notificationType?: notificationManager.SlotType;
57
58  /**
59   * Notification level.
60   *
61   * @type { ?notification.SlotLevel }
62   * @syscap SystemCapability.Notification.Notification
63   * @since 7
64   * @deprecated since 20
65   * @useinstead NotificationSlot#notificationLevel
66   */
67  level?: notification.SlotLevel;
68
69  /**
70   * SlotLevel is used to regulate the display behavior and alert mechanisms of notifications.
71   * Each value of SlotLevel determines whether the system displays notification icons in the status bar,
72   * shows banners, or plays prompt tones.
73   *
74   * @type { ?notificationManager.SlotLevel }
75   * @syscap SystemCapability.Notification.Notification
76   * @since arkts {'1.1':'20', '1.2':'20'}
77   * @arkts 1.1&1.2
78   */
79  notificationLevel?: notificationManager.SlotLevel;
80
81  /**
82   * Notification slot description.
83   *
84   * @type { ?string }
85   * @syscap SystemCapability.Notification.Notification
86   * @since arkts {'1.1':'7', '1.2':'20'}
87   * @arkts 1.1&1.2
88   */
89  desc?: string;
90
91  /**
92   * Whether to display the badge.
93   *
94   * @type { ?boolean }
95   * @syscap SystemCapability.Notification.Notification
96   * @since arkts {'1.1':'7', '1.2':'20'}
97   * @arkts 1.1&1.2
98   */
99  badgeFlag?: boolean;
100
101  /**
102   * Whether to bypass DND mode in the system.
103   *
104   * @type { ?boolean }
105   * @syscap SystemCapability.Notification.Notification
106   * @since arkts {'1.1':'7', '1.2':'20'}
107   * @arkts 1.1&1.2
108   */
109  bypassDnd?: boolean;
110
111  /**
112   * Mode for displaying the notification on the lock screen.
113   *
114   * @type { ?number }
115   * @syscap SystemCapability.Notification.Notification
116   * @since arkts {'1.1':'7', '1.2':'20'}
117   * @arkts 1.1&1.2
118   */
119  lockscreenVisibility?: number;
120
121  /**
122   * Whether to enable vibration for the notification.
123   *
124   * @type { ?boolean }
125   * @syscap SystemCapability.Notification.Notification
126   * @since arkts {'1.1':'7', '1.2':'20'}
127   * @arkts 1.1&1.2
128   */
129  vibrationEnabled?: boolean;
130
131  /**
132   * Notification alert tone.
133   *
134   * @type { ?string }
135   * @syscap SystemCapability.Notification.Notification
136   * @since arkts {'1.1':'7', '1.2':'20'}
137   * @arkts 1.1&1.2
138   */
139  sound?: string;
140
141  /**
142   * Whether the indicator blinks for the notification.
143   *
144   * @type { ?boolean }
145   * @syscap SystemCapability.Notification.Notification
146   * @since arkts {'1.1':'7', '1.2':'20'}
147   * @arkts 1.1&1.2
148   */
149  lightEnabled?: boolean;
150
151  /**
152   * Indicator color of the notification.
153   *
154   * @type { ?number }
155   * @syscap SystemCapability.Notification.Notification
156   * @since arkts {'1.1':'7', '1.2':'20'}
157   * @arkts 1.1&1.2
158   */
159  lightColor?: number;
160
161  /**
162   * Vibration mode of the notification.
163   *
164   * @type { ?Array<number> }
165   * @syscap SystemCapability.Notification.Notification
166   * @since arkts {'1.1':'7', '1.2':'20'}
167   * @arkts 1.1&1.2
168   */
169  vibrationValues?: Array<number>;
170
171  /**
172   * Whether the notification slot is enabled. The value true means to enable the notification slot, and false means the opposite.
173   *
174   * @type { ?boolean }
175   * @readonly
176   * @syscap SystemCapability.Notification.Notification
177   * @since arkts {'1.1':'9', '1.2':'20'}
178   * @arkts 1.1&1.2
179   */
180  readonly enabled?: boolean;
181
182  /**
183   * Obtains the notification reminder mode of the current notification entry.
184   *
185   * @type { ?number }
186   * @readonly
187   * @syscap SystemCapability.Notification.Notification
188   * @systemapi
189   * @since arkts {'1.1':'11', '1.2':'20'}
190   * @arkts 1.1&1.2
191   */
192  readonly reminderMode?: number;
193
194  /**
195   * Obtains channel information is authorized by the user.
196   *
197   * @type { ?number }
198   * @readonly
199   * @syscap SystemCapability.Notification.Notification
200   * @systemapi
201   * @since arkts {'1.1':'12', '1.2':'20'}
202   * @arkts 1.1&1.2
203   */
204  readonly authorizedStatus?: number;
205}
206