decord/source/utils/native/NotificationUtils.tsx

112 lines
3.1 KiB
TypeScript
Raw Normal View History

2026-08-06 08:05:19 +00:00
// Module ID: 11705
// Function ID: 11706
// Dependencies: [5, 17, 11696, 676, 11699, 698, 10695, 9696, 2]
2026-07-20 16:05:17 +00:00
2026-08-06 08:05:19 +00:00
// Module 11705
2026-07-29 08:29:29 +00:00
import expandEventProperties from "expandEventProperties";
2026-07-23 10:11:24 +00:00
import { NativeModules } from "get ActivityIndicator";
2026-07-29 08:29:29 +00:00
import { PermissionStateType } from "set";
2026-07-23 10:11:24 +00:00
import { AnalyticEvents } from "ME";
const require = arg1;
2026-07-29 08:29:29 +00:00
let result = require("set").fileFinishedImporting("utils/native/NotificationUtils.tsx");
2026-07-20 16:05:17 +00:00
export default {
hasPermission() {
2026-08-06 08:05:19 +00:00
return importDefault(10695).requestPermissions((badge) => {
2026-07-20 16:05:17 +00:00
let _alert;
let sound;
({ alert: _alert, sound } = badge);
if (!_alert) {
_alert = badge.badge;
}
if (!_alert) {
_alert = sound;
}
return _alert;
});
},
requestPermission(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-06 08:05:19 +00:00
let result = _require(11699).setPushPermissionState(PermissionStateType.REQUESTED);
let obj = _require(11699);
2026-07-29 08:29:29 +00:00
importDefault(698).track(AnalyticEvents.PERMISSIONS_REQUESTED, { type: "notification" });
const obj2 = importDefault(698);
2026-08-06 08:05:19 +00:00
const permissions = importDefault(10695).requestPermissions();
2026-07-20 16:05:17 +00:00
permissions.then((sound) => {
let _alert;
let badge;
({ alert: _alert, badge } = sound);
if (!_alert) {
_alert = sound.sound;
}
if (!_alert) {
_alert = badge;
}
let str = "denied";
if (_alert) {
str = "accepted";
}
2026-07-29 08:29:29 +00:00
outer1_1(outer1_2[5]).track(outer1_6.PERMISSIONS_ACKED, { type: "notification", action: str });
2026-07-23 10:11:24 +00:00
const NativePermissionManager = outer1_4.NativePermissionManager;
2026-07-20 16:05:17 +00:00
const notificationAuthorizationStatus = NativePermissionManager.getNotificationAuthorizationStatus();
2026-07-29 08:29:29 +00:00
notificationAuthorizationStatus.then((closure_0) => {
if (null != closure_0) {
const result = callback(table[4]).updateNotificationAuthorizationStatus(closure_0);
const obj = callback(table[4]);
2026-07-20 16:05:17 +00:00
}
});
if (null != _alert) {
2026-07-29 08:29:29 +00:00
if (callback != null) {
2026-07-23 10:11:24 +00:00
callback(_alert);
2026-07-20 16:05:17 +00:00
}
}
});
},
showNotification() {
2026-07-29 08:29:29 +00:00
return callback(function*() {
if (c0 === 2) {
c0 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c0 = 2;
if (arg0 === 1) {
c0 = 3;
throw arg1;
} else if (arg0 === 2) {
c0 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c0 = 3;
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
}
} catch (tmp4) {
c0 = tmp;
throw tmp4;
}
}
})();
2026-07-20 16:05:17 +00:00
},
shouldRequestNotification: true,
playNotificationSound(arg0) {
let num = arg1;
if (arg1 === undefined) {
num = 1;
}
2026-08-06 08:05:19 +00:00
require(9696) /* createSoundForPack */.playSound(arg0, num, undefined, arg2);
2026-07-20 16:05:17 +00:00
}
};