• 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
16/**
17 * @name ActionResult
18 * @since 3
19 * @syscap SystemCapability.Notification.Notification
20 */
21export interface ActionResult {
22  /**
23   * Bundle name of the application to be redirected to after the notification is clicked.
24   */
25  bundleName: string;
26
27  /**
28   * Ability name of the application to be redirected to after the notification is clicked.
29   */
30  abilityName: string;
31
32  /**
33   * URI of the page to be redirected to. The supported URI formats are as follows:
34   * 1. Absolute path of the page, which is provided by the pages list in the config.json file. Example:
35   * pages/index/index
36   * pages/detail/detail
37   * 2. Particular path. If the value is a slash (/), the home page is displayed.
38   */
39  uri: string;
40}
41
42/**
43 * @name ShowNotificationOptions
44 * @since 3
45 * @syscap SystemCapability.Notification.Notification
46 */
47export interface ShowNotificationOptions {
48  /**
49   * Notification title.
50   */
51  contentTitle?: string;
52
53  /**
54   * Notification content.
55   */
56  contentText?: string;
57
58  /**
59   * Action triggered after the notification is clicked.
60   */
61  clickAction?: ActionResult;
62}
63
64/**
65 * @name Notification
66 * @since 3
67 * @syscap SystemCapability.Notification.Notification
68 */
69export default class Notification {
70  /**
71   * Displays the notification.
72   * @param options Options.
73   */
74  static show(options?: ShowNotificationOptions): void;
75}
76