// Module ID: 11805 // Function ID: 11806 // Name: NotificationUtils // Dependencies: [5, 17, 11796, 1086, 11799, 1253, 8741, 9335, 2] // Module 11805 (NotificationUtils) import react_native from "react-native" /* 17 */; import Constants from "Constants" /* 1086 */; import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1253 */; import PushNotificationDefault from "PushNotification" /* 8741 */; import SoundUtils from "SoundUtils" /* 9335 */; import PushNotificationPermissionStore from "PushNotificationPermissionStore" /* 11796 */; import _asyncToGenerator from "_asyncToGenerator" /* 5 */; import size from "module_2" /* 2 */; const require = globalThis.__r; let _require, c0; const NativeModules = react_native.NativeModules; const PermissionStateType = PushNotificationPermissionStore.PermissionStateType; const AnalyticEvents = Constants.AnalyticEvents; let obj = { hasPermission() { const obj = PushNotificationDefault; return obj.requestPermissions((badge) => { let _alert; let sound; ({ alert: _alert, sound } = badge); if (!_alert) { _alert = badge.badge; } if (!_alert) { _alert = sound; } return _alert; }); }, requestPermission(arg0) { let closure_0; _require = arg0; let obj = require("PushNotificationActionCreators"); let result = obj.setPushPermissionState(PermissionStateType.REQUESTED); const obj2 = AnalyticsUtilsDefault; obj2.track(AnalyticEvents.PERMISSIONS_REQUESTED, { type: "notification" }); const obj3 = PushNotificationDefault; const permissions = obj3.requestPermissions(); permissions.then((sound) => { let _alert; let badge; ({ alert: _alert, badge } = sound); if (!_alert) { _alert = sound.sound; } if (!_alert) { _alert = badge; } let str = "denied"; const track = AnalyticsUtilsDefault.track; const PERMISSIONS_ACKED = AnalyticEvents.PERMISSIONS_ACKED; if (_alert) { str = "accepted"; } track(PERMISSIONS_ACKED, { type: "notification", action: str }); const NativePermissionManager = NativeModules.NativePermissionManager; const notificationAuthorizationStatus = NativePermissionManager.getNotificationAuthorizationStatus(); notificationAuthorizationStatus.then((result) => { if (null != result) { const obj = closure_1_0(closure_1_2[4]); result = obj.updateNotificationAuthorizationStatus(result); } }); if (null != _alert) { if (closure_0 != null) { closure_0(_alert); } } }); }, showNotification() { return (async (arg0, value) => { if (c0 === 2) { c0 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp2 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj2 = { value, done: true }; return obj2; } else { return { value: "IconComponent", done: null }; } } else { try { c0 = 2; if (arg0 === 1) { c0 = 3; throw value; } else if (arg0 === 2) { c0 = 3; const obj = { value, done: true }; return obj; } else { c0 = 3; return { value: "IconComponent", done: null }; } } catch (tmp3) { c0 = 3; throw tmp3; } } })(); }, shouldRequestNotification: true, playNotificationSound(arg0) { let num = arg1; if (arg1 === undefined) { num = 1; } const obj = SoundUtils; obj.playSound(arg0, num, undefined, arg2); } }; let result = size.fileFinishedImporting("utils/native/NotificationUtils.tsx"); export default obj;