Commands.ts 2.06 KB
Newer Older
yogevbd's avatar
yogevbd committed
1 2
import * as _ from 'lodash';
import { NativeCommandsSender } from '../adapters/NativeCommandsSender';
3
import { Notification, NotificationCategory, NotificationPermissions } from '../interfaces/Notification';
yogevbd's avatar
yogevbd committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

export class Commands {
  constructor(
    private readonly nativeCommandsSender: NativeCommandsSender
  ) {}

  public sendLocalNotification(notification: Notification) {
    const notificationId = 'id';
    const result = this.nativeCommandsSender.sendLocalNotification(notification, notificationId);
    return result;
  }

  public getInitialNotification() {
    const result = this.nativeCommandsSender.getInitialNotification();
    return result;
  }
  
  public requestPermissions() {
    const result = this.nativeCommandsSender.requestPermissions();
    return result;
  }
yogevbd's avatar
yogevbd committed
25 26 27 28 29

  public abandonPermissions() {
    const result = this.nativeCommandsSender.abandonPermissions();
    return result;
  }
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

  public registerPushKit() {
    this.nativeCommandsSender.registerPushKit();
  }

  public setCategories(categories: [NotificationCategory?]) {
    this.nativeCommandsSender.setCategories(categories);
  }

  public getBadgeCount(): Promise<number> {
    return this.nativeCommandsSender.getBadgeCount();
  }

  public setBadgeCount(count: number) {
    this.nativeCommandsSender.setBadgeCount(count);
  }

  public cancelLocalNotification(notificationId: string) {
    this.nativeCommandsSender.cancelLocalNotification(notificationId);
  }

  public cancelAllLocalNotifications() {
    this.nativeCommandsSender.cancelAllLocalNotifications();
  }

  public isRegisteredForRemoteNotifications(): Promise<boolean> {
    return this.nativeCommandsSender.isRegisteredForRemoteNotifications();
  }

  public checkPermissions(): Promise<NotificationPermissions> {
    return this.nativeCommandsSender.checkPermissions();
  }

  public removeAllDeliveredNotifications() {
    this.nativeCommandsSender.removeAllDeliveredNotifications();
  }

  public removeDeliveredNotifications(identifiers: Array<string>) {
    return this.nativeCommandsSender.removeDeliveredNotifications(identifiers);
  }
yogevbd's avatar
yogevbd committed
70
}