Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
111 lines
3.4 KiB
TypeScript
111 lines
3.4 KiB
TypeScript
// Module ID: 12551
|
|
// Function ID: 12552
|
|
// Name: NotificationUtils
|
|
// Dependencies: [5, 17, 12542, 1074, 12545, 1240, 9817, 10032, 2]
|
|
|
|
// Module 12551 (NotificationUtils)
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1240 */;
|
|
import PushNotificationDefault from "PushNotification" /* 9817 */;
|
|
import SoundUtils from "SoundUtils" /* 10032 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
const NativeModules = fn(17).NativeModules;
|
|
const PermissionStateType = fn(12542).PermissionStateType;
|
|
const AnalyticEvents = fn(1074).AnalyticEvents;
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("utils/native/NotificationUtils.tsx");
|
|
|
|
export default {
|
|
hasPermission() {
|
|
return PushNotificationDefault.requestPermissions((badge) => {
|
|
({ alert: _alert, sound } = badge);
|
|
if (!_alert) {
|
|
_alert = badge.badge;
|
|
}
|
|
if (!_alert) {
|
|
_alert = sound;
|
|
}
|
|
return _alert;
|
|
});
|
|
},
|
|
requestPermission(arg0) {
|
|
_require = arg0;
|
|
let result = require("PushNotificationActionCreators").setPushPermissionState(PermissionStateType.REQUESTED);
|
|
let obj = require("PushNotificationActionCreators");
|
|
AnalyticsUtilsDefault.track(AnalyticEvents.PERMISSIONS_REQUESTED, { type: "notification" });
|
|
const permissions = PushNotificationDefault.requestPermissions();
|
|
permissions.then((sound) => {
|
|
({ alert: _alert, badge } = sound);
|
|
if (!_alert) {
|
|
_alert = sound.sound;
|
|
}
|
|
if (!_alert) {
|
|
_alert = badge;
|
|
}
|
|
let str = "denied";
|
|
if (_alert) {
|
|
str = "accepted";
|
|
}
|
|
AnalyticsUtilsDefault.track(AnalyticEvents.PERMISSIONS_ACKED, { type: "notification", action: str });
|
|
const NativePermissionManager = NativeModules.NativePermissionManager;
|
|
const notificationAuthorizationStatus = NativePermissionManager.getNotificationAuthorizationStatus();
|
|
notificationAuthorizationStatus.then((result) => {
|
|
if (null != result) {
|
|
result = closure_1_0(dependencyMap[4]).updateNotificationAuthorizationStatus(result);
|
|
const obj = closure_1_0(dependencyMap[4]);
|
|
}
|
|
});
|
|
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 (tmp3 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", 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: "HermesInternal", done: null };
|
|
}
|
|
} catch (tmp4) {
|
|
c0 = tmp;
|
|
throw tmp4;
|
|
}
|
|
}
|
|
})();
|
|
},
|
|
shouldRequestNotification: true,
|
|
playNotificationSound(arg0) {
|
|
let num = arg1;
|
|
if (arg1 === undefined) {
|
|
num = 1;
|
|
}
|
|
SoundUtils.playSound(arg0, num, undefined, arg2);
|
|
}
|
|
};
|