UNPKG

react-native-notificare-push-ui

Version:
83 lines (62 loc) 2.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NotificarePushUI = void 0; var _reactNative = require("react-native"); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } const LINKING_ERROR = `The package 'react-native-notificare-push-ui' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n'; const NativeModule = _reactNative.NativeModules.NotificarePushUIModule ? _reactNative.NativeModules.NotificarePushUIModule : new Proxy({}, { get() { throw new Error(LINKING_ERROR); } }); class NotificarePushUI { // // Methods // static async presentNotification(notification) { await NativeModule.presentNotification(notification); } static async presentAction(notification, action) { await NativeModule.presentAction(notification, action); } // // Events // static onNotificationWillPresent(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.notification_will_present', callback); } static onNotificationPresented(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.notification_presented', callback); } static onNotificationFinishedPresenting(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.notification_finished_presenting', callback); } static onNotificationFailedToPresent(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.notification_failed_to_present', callback); } static onNotificationUrlClicked(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.notification_url_clicked', callback); } static onActionWillExecute(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.action_will_execute', callback); } static onActionExecuted(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.action_executed', callback); } static onActionNotExecuted(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.action_not_executed', callback); } static onActionFailedToExecute(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.action_failed_to_execute', callback); } static onCustomActionReceived(callback) { return this.eventEmitter.addListener('re.notifica.push.ui.custom_action_received', callback); } } exports.NotificarePushUI = NotificarePushUI; _defineProperty(NotificarePushUI, "eventEmitter", new _reactNative.NativeEventEmitter(NativeModule)); //# sourceMappingURL=notificare-push-ui.js.map