• 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//import { NotificationSubscriber } from './notification/notificationSubscriber';
17import Notification from '@ohos.notification';
18import Log from '../Log';
19
20const TAG = 'NotificationManager';
21
22
23export default class NotificationManager {
24
25  static TYPE_BASIC: number = Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT;
26  static TYPE_LONG: number = Notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT;
27  static TYPE_MULTI: number = Notification.ContentType.NOTIFICATION_CONTENT_MULTILINE;
28
29  static subscribeNotification(tag, subscriber, asyncCallback) {
30    Log.showInfo(TAG, `subscribeNotification from: ${tag}`));
31    Notification.subscribe(subscriber, asyncCallback);
32  }
33
34  static unsubscribeNotification(tag, subscriber) {
35    Log.showInfo(TAG, `subscribeNotification from: ${tag}`));
36    Notification.unsubscribe(subscriber);
37  }
38
39  static removeAll(tag, callback) {
40    Log.showInfo(TAG, `removeAll from: ${tag}`));
41    Notification.removeAll(callback);
42  }
43
44  static remove(tag, hashCode, callback) {
45    Log.showInfo(TAG, `remove from: ${tag}`));
46    Notification.remove(hashCode, callback)
47  }
48
49  static getAllActiveNotifications(tag, callback) {
50    Log.showInfo(TAG, `getAllActiveNotifications from: ${tag}`));
51    Notification.getAllActiveNotifications(callback);
52  }
53
54}