/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/react-native-xmpush@2.0.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";import{NativeModules,Platform,PushNotificationIOS,NativeEventEmitter,PermissionsAndroid}from"react-native";const MIPushModule=NativeModules.MIPushModule;class MIPush extends NativeEventEmitter{constructor(i){super(MIPushModule),this.state={}}init(i,e){"android"==Platform.OS&&PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE).then((t=>{t?PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE).then((t=>{t?MIPushModule.init(i,e):PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE).then((t=>{t===PermissionsAndroid.RESULTS.GRANTED&&MIPushModule.init(i,e)}))})):PermissionsAndroid.requestMultiple([PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE,PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE]).then((t=>{MIPushModule.init(i,e)}))}))}setAlias(i){MIPushModule.setAlias(i)}unsetAlias(i){MIPushModule.unsetAlias(i)}subscribe(i){MIPushModule.subscribe(i)}unsubscribe(i){MIPushModule.unsubscribe(i)}setAccount(i){MIPushModule.setAccount(i)}unsetAccount(i){MIPushModule.unsetAccount(i)}addEventListener(i,e){if("ios"==Platform.OS)switch(i){case"notification":case"localNotification":case"register":PushNotificationIOS.addEventListener(i,e);break;default:this.addListener(i,e)}else this.addListener(i,e)}removeEventListener(i){if("ios"==Platform.OS)switch(i){case"notification":case"localNotification":case"register":PushNotificationIOS.removeEventListener(i);break;default:this.removeListener(i)}else this.removeListener(i)}presentLocalNotification(i){"ios"==Platform.OS?PushNotificationIOS.presentLocalNotification({alertBody:i.alertBody,alertAction:"查看",category:"push",userInfo:i.userInfo}):MIPushModule.presentLocalNotification({})}clearNotification(i){"ios"==Platform.OS?PushNotificationIOS.cancelLocalNotifications(i):MIPushModule.clearNotification(i)}clearNotifications(){"ios"==Platform.OS?PushNotificationIOS.cancelAllLocalNotifications():MIPushModule.clearAllNotification()}setBadgeNumber(i){"ios"==Platform.OS&&PushNotificationIOS.setApplicationIconBadgeNumber(i)}getInitialNotification(i){"ios"==Platform.OS?PushNotificationIOS.getInitialNotification().then(i):MIPushModule.getInitialNotification().then(i)}}MIPush=new MIPush,module.exports=MIPush;
//# sourceMappingURL=/sm/11c5afb52c81d77d815ebaceeb0d648ad8100ee7a640a3a15e45e6b812e89864.map