decord/source/utils/native/NotificationUtils.tsx
github-actions cd74c1f217 chore: update source for alpha 345.5
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9667_m.js (378 MB)
2026-09-05 10:56:28 +00:00

110 lines
3.3 KiB
TypeScript

// Module ID: 12418
// Function ID: 12419
// Dependencies: [5, 17, 12409, 1074, 12412, 1242, 9687, 9902, 2]
// Module 12418
import expandEventPropertiesDefault from "expandEventProperties" /* 1242 */;
import NativeModulesDefault from "NativeModules" /* 9687 */;
import createSoundForPack from "createSoundForPack" /* 9902 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import { NativeModules } from "get ActivityIndicator" /* 17 */;
import { PermissionStateType } from "set" /* 12409 */;
import { AnalyticEvents } from "ME" /* 1074 */;
require = arg1;
let result = require("set").fileFinishedImporting("utils/native/NotificationUtils.tsx");
export default {
hasPermission() {
return NativeModulesDefault.requestPermissions((badge) => {
({ alert: _alert, sound } = badge);
if (!_alert) {
_alert = badge.badge;
}
if (!_alert) {
_alert = sound;
}
return _alert;
});
},
requestPermission(arg0) {
const _require = arg0;
let result = _require(12412).setPushPermissionState(PermissionStateType.REQUESTED);
let obj = _require(12412);
expandEventPropertiesDefault.track(AnalyticEvents.PERMISSIONS_REQUESTED, { type: "notification" });
const obj2 = expandEventPropertiesDefault;
const permissions = NativeModulesDefault.requestPermissions();
permissions.then((sound) => {
({ alert: _alert, badge } = sound);
if (!_alert) {
_alert = sound.sound;
}
if (!_alert) {
_alert = badge;
}
let str = "denied";
if (_alert) {
str = "accepted";
}
closure_1_1(closure_1_2[5]).track(closure_1_6.PERMISSIONS_ACKED, { type: "notification", action: str });
const NativePermissionManager = closure_1_4.NativePermissionManager;
const notificationAuthorizationStatus = NativePermissionManager.getNotificationAuthorizationStatus();
notificationAuthorizationStatus.then((closure_0) => {
if (null != closure_0) {
const result = callback(table[4]).updateNotificationAuthorizationStatus(closure_0);
const obj = callback(table[4]);
}
});
if (null != _alert) {
if (callback != null) {
callback(_alert);
}
}
});
},
showNotification() {
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 {
return { value: "HermesInternal", done: null };
}
} 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;
return { value: "HermesInternal", done: null };
}
} catch (tmp4) {
c0 = tmp;
throw tmp4;
}
}
})();
},
shouldRequestNotification: true,
playNotificationSound(arg0) {
let num = arg1;
if (arg1 === undefined) {
num = 1;
}
createSoundForPack.playSound(arg0, num, undefined, arg2);
}
};