decord/alpha/source/lib/pushnotification/PushNotification.tsx

360 lines
11 KiB
TypeScript
Raw Permalink Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 11031
// Function ID: 11032
// Name: PushNotification
2026-10-10 08:08:14 +00:00
// Dependencies: [17, 1382, 11032, 11033, 11034, 2]
2026-07-23 10:11:24 +00:00
2026-10-10 08:08:14 +00:00
// Module 11031 (PushNotification)
2026-10-09 10:00:15 +00:00
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-10 08:08:14 +00:00
import _modDef11032 from "module_11032" /* 11032 */;
import react_nativeDefault from "react-native" /* 11034 */;
2026-10-03 08:58:59 +00:00
import react_native2 from "react-native" /* 17 */;
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
const require = globalThis.__r;
let _require, lightsEnabled, soundsEnabled, vibrationsEnabled;
let tmp;
2026-10-10 08:08:14 +00:00
const react_native = tmp(11033);
2026-10-03 08:58:59 +00:00
function getData() {
let parsed;
const obj = { message: parsed };
const merged = Object.assign(message);
parsed = null;
const tmp = message;
if (null != message.message) {
const _JSON = JSON;
parsed = JSON.parse(tmp.message);
}
return obj;
}
function getMessage() {
const error = new Error("TODO: Implement on Android");
throw error;
}
function getSound() {
const error = new Error("TODO: Implement on Android");
throw error;
}
function getCategory() {
const error = new Error("TODO: Implement on Android");
throw error;
}
function getAlert() {
const error = new Error("TODO: Implement on Android");
throw error;
}
function getContentAvailable() {
const error = new Error("TODO: Implement on Android");
throw error;
}
function getBadgeCount() {
const error = new Error("TODO: Implement on Android");
throw error;
}
function finish(arg0) {
const error = new Error("Not implemented on Android: " + arg0);
throw error;
}
const NativeModules = react_native2.NativeModules;
2026-07-20 16:05:17 +00:00
const PushNotificationAndroid = NativeModules.PushNotificationAndroid;
let tmp32 = null;
2026-07-20 16:05:17 +00:00
if (null != PushNotificationAndroid) {
2026-10-03 08:58:59 +00:00
let self = this;
let self2 = this;
tmp32 = new tmp3(NativeModules.PushNotificationAndroid);
2026-07-20 16:05:17 +00:00
}
let closure_5 = tmp32;
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
getInitialNotification() {
2026-10-03 08:58:59 +00:00
let initialNotification;
let tmp = dependencyMap;
let obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
initialNotification = new Promise((arg0) => {
let closure_0 = arg0;
2026-07-29 08:29:29 +00:00
initialNotification = initialNotification.getInitialNotification();
initialNotification.then((result) => {
2026-10-03 08:58:59 +00:00
closure_0 = result;
2026-07-29 08:29:29 +00:00
let tmp2 = null;
2026-10-03 08:58:59 +00:00
let tmp = closure_0;
if (null != result) {
2026-10-03 08:58:59 +00:00
let obj = { getData, getMessage, getSound, getCategory, getAlert, getContentAvailable, getBadgeCount, finish };
2026-07-29 08:29:29 +00:00
tmp2 = obj;
}
2026-10-03 08:58:59 +00:00
tmp(tmp2);
2026-07-20 16:05:17 +00:00
});
});
} else {
2026-10-03 08:58:59 +00:00
let tmp2 = importDefault;
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
initialNotification = obj2.getInitialNotification();
2026-07-20 16:05:17 +00:00
}
return initialNotification;
},
setCurrentUser(username, id) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
PushNotificationAndroid.setCurrentUser(username, id);
}
},
setMultiAccountUsers(arg0) {
const json = JSON.stringify(arg0);
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-10-03 08:58:59 +00:00
const tmp5 = PushNotificationAndroid;
2026-07-29 08:29:29 +00:00
if (PushNotificationAndroid != null) {
const setMultiAccountUsernames = tmp5.setMultiAccountUsernames;
if (setMultiAccountUsernames != null) {
const result = setMultiAccountUsernames(json);
}
2026-07-20 16:05:17 +00:00
}
} else {
const NSUserDefaultsBridge = NativeModules.NSUserDefaultsBridge;
2026-07-29 08:29:29 +00:00
if (NSUserDefaultsBridge != null) {
const setMultiAccountUsersJSONString = NSUserDefaultsBridge.setMultiAccountUsersJSONString;
if (setMultiAccountUsersJSONString != null) {
const result1 = setMultiAccountUsersJSONString(json);
}
2026-07-20 16:05:17 +00:00
}
}
},
clearPushNotificationLogs() {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-10-03 08:58:59 +00:00
const _default = react_native.default;
_default.clearLogs();
2026-07-20 16:05:17 +00:00
}
},
setApplicationIconBadgeNumber(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (!obj.isAndroid()) {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const result = obj2.setApplicationIconBadgeNumber(arg0);
2026-07-20 16:05:17 +00:00
}
},
clearAllNotifications() {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
const result = PushNotificationAndroid.clearAllNotifications();
} else {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const result1 = obj2.setApplicationIconBadgeNumber(0);
2026-07-20 16:05:17 +00:00
}
},
presentLocalNotification(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
const result = PushNotificationAndroid.presentLocalNotification(arg0);
} else {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const result1 = obj2.presentLocalNotification(arg0);
2026-07-20 16:05:17 +00:00
}
},
getDeliveredNotifications() {
2026-10-03 08:58:59 +00:00
let resolveResult;
let obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-10-03 08:58:59 +00:00
resolveResult = _Promise.resolve([]);
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
2026-07-20 16:05:17 +00:00
resolveResult = new _Promise((arg0) => {
2026-10-10 08:08:14 +00:00
const obj = _modDef11032;
2026-10-03 08:58:59 +00:00
const deliveredNotifications = obj.getDeliveredNotifications(arg0);
2026-07-20 16:05:17 +00:00
});
}
return resolveResult;
},
removeDeliveredNotifications(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (!obj.isAndroid()) {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const result = obj2.removeDeliveredNotifications(arg0);
2026-07-20 16:05:17 +00:00
}
},
scheduleLocalNotification(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (!obj.isAndroid()) {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const result = obj2.scheduleLocalNotification(arg0);
2026-07-20 16:05:17 +00:00
}
},
getScheduledLocalNotifications(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (!obj.isAndroid()) {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const scheduledLocalNotifications = obj2.getScheduledLocalNotifications(arg0);
2026-07-20 16:05:17 +00:00
}
},
cancelLocalNotifications(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (!obj.isAndroid()) {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const result = obj2.cancelLocalNotifications(arg0);
2026-07-20 16:05:17 +00:00
}
},
cancelAllLocalNotifications() {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (!obj.isAndroid()) {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const result = obj2.cancelAllLocalNotifications();
2026-07-20 16:05:17 +00:00
}
},
checkPermissions(fn) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
fn({});
2026-07-20 16:05:17 +00:00
} else {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
obj2.checkPermissions(fn);
2026-07-20 16:05:17 +00:00
}
},
requestPermissions(arg0) {
2026-10-03 08:58:59 +00:00
let permissions;
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
permissions = new Promise((fn) => fn({}));
2026-07-20 16:05:17 +00:00
} else {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
permissions = obj2.requestPermissions(arg0);
2026-07-20 16:05:17 +00:00
}
return permissions;
},
openNotificationSettings() {
2026-10-03 08:58:59 +00:00
react_nativeDefault();
2026-07-20 16:05:17 +00:00
},
addNotificationEventListener(localNotification, handleLocalNotification) {
_require = handleLocalNotification;
2026-10-03 08:58:59 +00:00
let tmp = dependencyMap;
let obj = require("PlatformUtils");
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
if ("notification" === localNotification) {
2026-08-24 06:08:38 +00:00
closure_5.addListener("notification", (arg0) => {
handleLocalNotification = arg0;
2026-07-29 08:29:29 +00:00
let tmp = null;
if (null != arg0) {
2026-10-03 08:58:59 +00:00
tmp = { getData, getMessage, getSound, getCategory, getAlert, getContentAvailable, getBadgeCount, finish };
const obj = { getData, getMessage, getSound, getCategory, getAlert, getContentAvailable, getBadgeCount, finish };
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
if (null != tmp) {
2026-07-23 10:11:24 +00:00
handleLocalNotification(tmp);
2026-07-20 16:05:17 +00:00
}
});
}
if ("localNotification" === localNotification) {
2026-08-24 06:08:38 +00:00
closure_5.addListener("localNotification", (arg0) => {
handleLocalNotification = arg0;
2026-07-29 08:29:29 +00:00
let tmp = null;
if (null != arg0) {
2026-10-03 08:58:59 +00:00
tmp = { getData, getMessage, getSound, getCategory, getAlert, getContentAvailable, getBadgeCount, finish };
const obj = { getData, getMessage, getSound, getCategory, getAlert, getContentAvailable, getBadgeCount, finish };
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
if (null != tmp) {
2026-07-23 10:11:24 +00:00
handleLocalNotification(tmp);
2026-07-20 16:05:17 +00:00
}
});
}
const result = PushNotificationAndroid.registerEventListener(localNotification);
} else {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const listener = obj2.addEventListener(localNotification, handleLocalNotification);
2026-07-20 16:05:17 +00:00
}
},
addRegisterEventListener(handleToken) {
2026-10-03 08:58:59 +00:00
let closure_0 = handleToken;
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-08-24 06:08:38 +00:00
closure_5.addListener("register", (token) => {
2026-10-03 08:58:59 +00:00
closure_0(token.token);
2026-07-20 16:05:17 +00:00
});
const result = PushNotificationAndroid.registerEventListener("register");
} else {
2026-10-10 08:08:14 +00:00
const obj2 = _modDef11032;
2026-10-03 08:58:59 +00:00
const listener = obj2.addEventListener("register", handleToken);
2026-07-20 16:05:17 +00:00
}
},
getSoundsEnabled() {
2026-10-03 08:58:59 +00:00
const promise = new Promise((fn) => {
let closure_0 = fn;
const obj = require("PlatformUtils");
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-07-29 08:29:29 +00:00
soundsEnabled = soundsEnabled.getSoundsEnabled();
soundsEnabled.then((result) => closure_0(result));
2026-07-20 16:05:17 +00:00
} else {
fn(false);
2026-07-20 16:05:17 +00:00
}
});
2026-10-03 08:58:59 +00:00
return promise;
2026-07-20 16:05:17 +00:00
},
getVibrationsEnabled() {
2026-10-03 08:58:59 +00:00
const promise = new Promise((fn) => {
let closure_0 = fn;
const obj = require("PlatformUtils");
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-07-29 08:29:29 +00:00
vibrationsEnabled = vibrationsEnabled.getVibrationsEnabled();
vibrationsEnabled.then((result) => closure_0(result));
2026-07-20 16:05:17 +00:00
} else {
fn(false);
2026-07-20 16:05:17 +00:00
}
});
2026-10-03 08:58:59 +00:00
return promise;
2026-07-20 16:05:17 +00:00
},
getLightsEnabled() {
2026-10-03 08:58:59 +00:00
const promise = new Promise((fn) => {
let closure_0 = fn;
const obj = require("PlatformUtils");
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-07-29 08:29:29 +00:00
lightsEnabled = lightsEnabled.getLightsEnabled();
lightsEnabled.then((result) => closure_0(result));
2026-07-20 16:05:17 +00:00
} else {
fn(false);
2026-07-20 16:05:17 +00:00
}
});
2026-10-03 08:58:59 +00:00
return promise;
2026-07-20 16:05:17 +00:00
},
setSoundsEnabled(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
PushNotificationAndroid.setSoundsEnabled(arg0);
}
},
setVibrationsEnabled(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
PushNotificationAndroid.setVibrationsEnabled(arg0);
}
},
setLightsEnabled(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
PushNotificationAndroid.setLightsEnabled(arg0);
}
},
setAndroidNotifyEveryTime(arg0) {
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
PushNotificationAndroid.setNotifyEveryTime(arg0);
}
},
shouldAndroidNotifyEveryTime() {
2026-10-03 08:58:59 +00:00
const promise = new Promise((fn) => {
let closure_0 = fn;
const obj = require("PlatformUtils");
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
const result = PushNotificationAndroid.shouldNotifyEveryTime();
result.then((result) => closure_0(result));
2026-07-20 16:05:17 +00:00
} else {
fn(false);
2026-07-20 16:05:17 +00:00
}
});
2026-10-03 08:58:59 +00:00
return promise;
2026-07-20 16:05:17 +00:00
}
};
2026-10-03 08:58:59 +00:00
let result = size.fileFinishedImporting("lib/pushnotification/PushNotification.tsx");
export default obj;