Commands.js 2.33 KB
Newer Older
冷佳娟's avatar
冷佳娟 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Notification_1 = require("../DTO/Notification");
class Commands {
    constructor(nativeCommandsSender, uniqueIdProvider) {
        this.nativeCommandsSender = nativeCommandsSender;
        this.uniqueIdProvider = uniqueIdProvider;
    }
    postLocalNotification(notification, id) {
        const notificationId = id ? id : this.uniqueIdProvider.generate();
        const result = this.nativeCommandsSender.postLocalNotification(notification, notificationId);
        return result;
    }
    async getInitialNotification() {
        return this.nativeCommandsSender.getInitialNotification().then((payload) => {
            if (payload) {
                return new Notification_1.Notification(payload);
            }
            return undefined;
        });
    }
    requestPermissions() {
        const result = this.nativeCommandsSender.requestPermissions();
        return result;
    }
    abandonPermissions() {
        const result = this.nativeCommandsSender.abandonPermissions();
        return result;
    }
    registerPushKit() {
        this.nativeCommandsSender.registerPushKit();
    }
    setCategories(categories) {
        this.nativeCommandsSender.setCategories(categories);
    }
    getBadgeCount() {
        return this.nativeCommandsSender.getBadgeCount();
    }
    setBadgeCount(count) {
        this.nativeCommandsSender.setBadgeCount(count);
    }
    cancelLocalNotification(notificationId) {
        this.nativeCommandsSender.cancelLocalNotification(notificationId);
    }
    cancelAllLocalNotifications() {
        this.nativeCommandsSender.cancelAllLocalNotifications();
    }
    isRegisteredForRemoteNotifications() {
        return this.nativeCommandsSender.isRegisteredForRemoteNotifications();
    }
    checkPermissions() {
        return this.nativeCommandsSender.checkPermissions();
    }
    removeAllDeliveredNotifications() {
        this.nativeCommandsSender.removeAllDeliveredNotifications();
    }
    removeDeliveredNotifications(identifiers) {
        return this.nativeCommandsSender.removeDeliveredNotifications(identifiers);
    }
    getDeliveredNotifications() {
        return this.nativeCommandsSender.getDeliveredNotifications();
    }
    refreshToken() {
        this.nativeCommandsSender.refreshToken();
    }
}
exports.Commands = Commands;