decord/alpha/source/modules/notifications/native/NativeNotificationsManager.tsx

401 lines
17 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 18496
// Function ID: 18497
// Name: NativeNotificationsManager
2026-10-09 10:00:15 +00:00
// Dependencies: [5, 17, 6084, 1085, 3, 6804, 1382, 10991, 8315, 1265, 2]
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 18496 (NativeNotificationsManager)
import LoggerDefault from "Logger" /* 3 */;
2026-10-03 08:58:59 +00:00
import react_native from "react-native" /* 17 */;
import Constants from "Constants" /* 1085 */;
2026-10-09 10:00:15 +00:00
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-03 08:58:59 +00:00
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
2026-10-09 10:00:15 +00:00
import GuildReadStateStore from "GuildReadStateStore" /* 6084 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6804 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-10-09 10:00:15 +00:00
let c4, c5, c8, closure_0, closure_3, logger, map;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const NativeModules = react_native.NativeModules;
const AnalyticEvents = Constants.AnalyticEvents;
2026-10-06 11:16:32 +00:00
let closure_7 = new LoggerDefault("NativeNotificationsManager");
2026-10-03 08:58:59 +00:00
const tmp2 = new LoggerDefault("NativeNotificationsManager");
class NativeNotificationsManager extends AutomaticLifecycleManager {
constructor() {
let totalMentionCount;
let applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
applyArgumentsResult.handleAck = function handleAck(channelId) {
channelId = channelId.channelId;
2026-10-06 11:16:32 +00:00
const obj = PlatformUtils;
2026-10-03 08:58:59 +00:00
const tmp = dependencyMap;
if (obj.isIOS()) {
const obj2 = require("PushNotification");
const result = obj2.setApplicationIconBadgeNumber(totalMentionCount.getTotalMentionCount());
}
if (null != channelId) {
const DCDNotificationManager = NativeModules.DCDNotificationManager;
if (DCDNotificationManager != null) {
const result1 = DCDNotificationManager.clearNotificationsForChannel(channelId);
}
}
};
require = applyArgumentsResult;
applyArgumentsResult.handlePostConnectionOpen = _asyncToGenerator(async function(arg0, value) {
let background_str;
let closure_5;
let str1;
2026-10-06 11:16:32 +00:00
let v1;
if (c8 === 2) {
c8 = 3;
2026-10-03 08:58:59 +00:00
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) {
let obj3 = { value, done: true };
return obj3;
} else {
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
2026-10-03 08:58:59 +00:00
}
} else {
2026-10-06 11:16:32 +00:00
let tmp73;
2026-10-03 08:58:59 +00:00
let c6;
try {
let str3;
let processing_notifications;
let processing_notification_states;
let PUSH_NOTIFICATION_RECEIVED;
2026-10-06 11:16:32 +00:00
let closure_8;
2026-10-03 08:58:59 +00:00
let moveAndReadData;
2026-10-06 11:16:32 +00:00
let obj;
2026-10-03 08:58:59 +00:00
let normalizeTimestampToMs;
2026-10-06 11:16:32 +00:00
c8 = 2;
const tmp4 = logger;
if (0 === logger) {
2026-10-03 08:58:59 +00:00
if (arg0 === 1) {
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
throw value;
} else if (arg0 === 2) {
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
let obj4 = { value, done: true };
return obj4;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
let closure_4 = tmp;
str3 = undefined;
processing_notifications = undefined;
processing_notification_states = undefined;
map = undefined;
2026-10-06 11:16:32 +00:00
tmp73 = undefined;
c6 = undefined;
2026-10-03 08:58:59 +00:00
PUSH_NOTIFICATION_RECEIVED = undefined;
2026-10-06 11:16:32 +00:00
closure_8 = undefined;
const obj15 = applyArgumentsResult(background_str[6]);
if (!obj15.isIOS()) {
2026-10-03 08:58:59 +00:00
let result = require.handleSetCallNotificationExperiment();
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
c6 = 1;
moveAndReadData = function moveAndReadData() {
return closure_1_10(...arguments);
};
obj = function _moveAndReadData() {
obj = PUSH_NOTIFICATION_RECEIVED(function*(arg0, value) {
let obj3;
let obj6;
let obj9;
closure_0 = arg0;
closure_1 = value;
if (c5 === 2) {
2026-08-04 21:03:28 +00:00
c5 = 3;
2026-10-03 08:58:59 +00:00
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 {
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
2026-10-03 08:58:59 +00:00
}
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
try {
let closure_2;
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj4 = { value, done: true };
return obj4;
} else {
closure_3 = tmp4;
closure_2 = tmp;
c4 = 1;
c5 = 1;
const obj5 = { value: obj9.removeFile(str3, closure_1), done: false };
2026-10-06 11:16:32 +00:00
obj9 = closure_0(closure_2[8]);
2026-10-03 08:58:59 +00:00
return obj5;
}
} else if (1 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj7 = { value, done: true };
return obj7;
} else {
c4 = 2;
c5 = 1;
const obj8 = { value: obj6.moveFile(closure_131_0, closure_0, closure_1), done: false };
2026-10-06 11:16:32 +00:00
obj6 = closure_0(closure_2[8]);
2026-10-03 08:58:59 +00:00
return obj8;
}
} else {
let tmp5;
if (2 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj10 = { value, done: true };
return obj10;
} else {
tmp5 = null;
if (value) {
c4 = 3;
c5 = 1;
const obj11 = { value: obj3.readFile(closure_131_0, closure_1, "utf8"), done: false };
2026-10-06 11:16:32 +00:00
obj3 = closure_0(closure_2[8]);
2026-10-03 08:58:59 +00:00
return obj11;
}
}
} else if (arg0 === 1) {
c5 = 3;
throw value;
} else {
tmp5 = value;
if (arg0 === 2) {
c5 = 3;
obj = { value, done: true };
return obj;
}
}
c5 = 3;
const obj12 = { value: tmp5, done: true };
return obj12;
}
} catch (tmp24) {
c5 = 3;
throw tmp24;
2026-07-29 08:29:29 +00:00
}
}
2026-10-03 08:58:59 +00:00
});
return obj(...arguments);
};
normalizeTimestampToMs = function normalizeTimestampToMs(timestamp) {
if (null != timestamp) {
let rounded;
if (typeof timestamp === "number") {
const _Math = Math;
rounded = Math.round(1000 * timestamp);
} else if (typeof timestamp === "string") {
const _parseInt = parseInt;
rounded = parseInt(timestamp, 10);
}
2026-10-03 08:58:59 +00:00
return rounded;
}
2026-10-03 08:58:59 +00:00
};
2026-10-06 11:16:32 +00:00
let obj11 = applyArgumentsResult(background_str[6]);
2026-10-03 08:58:59 +00:00
str3 = "cache";
if (obj11.isIOS()) {
str3 = "shared";
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
processing_notifications = "processing_notifications";
processing_notification_states = "processing_notification_states";
PUSH_NOTIFICATION_RECEIVED = moveAndReadData("notifications_to_track", "processing_notifications");
2026-10-06 11:16:32 +00:00
logger = 2;
c8 = 1;
2026-10-03 08:58:59 +00:00
let obj5 = { value: PUSH_NOTIFICATION_RECEIVED, done: false };
return obj5;
2026-07-29 08:29:29 +00:00
}
} else {
2026-10-03 08:58:59 +00:00
if (1 === tmp4) {
c6 = 0;
2026-10-09 10:00:15 +00:00
let closure_12 = tmp73;
2026-10-03 08:58:59 +00:00
logger.error("Error tracking push notifications", closure_12);
} else {
if (2 === tmp4) {
if (arg0 === 1) {
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
throw value;
} else if (arg0 === 2) {
2026-08-24 06:08:38 +00:00
c6 = 0;
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
let obj6 = { value, done: true };
return obj6;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
PUSH_NOTIFICATION_RECEIVED = value;
if (null == PUSH_NOTIFICATION_RECEIVED) {
c6 = 0;
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
const _Map = Map;
const self = this;
const self2 = this;
map = new Map();
2026-10-06 11:16:32 +00:00
PUSH_NOTIFICATION_RECEIVED = applyArgumentsResult(background_str[6]);
2026-10-03 08:58:59 +00:00
if (PUSH_NOTIFICATION_RECEIVED.isIOS()) {
PUSH_NOTIFICATION_RECEIVED = moveAndReadData("notification_states_to_track", processing_notification_states);
2026-10-06 11:16:32 +00:00
logger = 3;
c8 = 1;
2026-10-03 08:58:59 +00:00
let obj8 = { value: PUSH_NOTIFICATION_RECEIVED, done: false };
return obj8;
}
2026-07-29 08:29:29 +00:00
}
}
2026-10-03 08:58:59 +00:00
} else if (3 === tmp4) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-10-06 11:16:32 +00:00
c8 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
2026-08-24 06:08:38 +00:00
c6 = 0;
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
let obj9 = { value, done: true };
return obj9;
2026-07-29 08:29:29 +00:00
} else {
2026-10-06 11:16:32 +00:00
tmp73 = value;
PUSH_NOTIFICATION_RECEIVED = tmp73;
if (null !== tmp73) {
const str14 = tmp73.trim();
2026-10-03 08:58:59 +00:00
const parts = str14.split("\n");
const item = parts.forEach((item) => {
const parsed = JSON.parse(item);
const result = closure_1_4.set(parsed._local_uuid, parsed.app_state);
});
}
}
} else if (4 === tmp4) {
c6 = 1;
PUSH_NOTIFICATION_RECEIVED = applyArgumentsResult;
applyArgumentsResult.return();
2026-10-06 11:16:32 +00:00
throw tmp73;
2026-10-03 08:58:59 +00:00
} else {
if (5 === tmp4) {
if (arg0 === 1) {
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
throw value;
} else if (arg0 === 2) {
c6 = 0;
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
let obj10 = { value, done: true };
return obj10;
} else {
2026-10-06 11:16:32 +00:00
PUSH_NOTIFICATION_RECEIVED = applyArgumentsResult(background_str[6]);
2026-10-03 08:58:59 +00:00
if (PUSH_NOTIFICATION_RECEIVED.isIOS()) {
let tmp5 = PUSH_NOTIFICATION_RECEIVED;
2026-10-06 11:16:32 +00:00
let obj2 = applyArgumentsResult(background_str[8]);
2026-10-03 08:58:59 +00:00
PUSH_NOTIFICATION_RECEIVED = obj2.removeFile(str3, processing_notification_states);
2026-10-06 11:16:32 +00:00
logger = 6;
c8 = 1;
2026-10-03 08:58:59 +00:00
let obj12 = { value: PUSH_NOTIFICATION_RECEIVED, done: false };
return obj12;
}
}
} else if (arg0 === 1) {
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
throw value;
} else if (arg0 === 2) {
c6 = 0;
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-03 08:58:59 +00:00
obj = { value, done: true };
return obj;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
c6 = 0;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const str = PUSH_NOTIFICATION_RECEIVED.trim();
2026-10-06 11:16:32 +00:00
c6 = str.split("\n");
let closure_1 = c6;
applyArgumentsResult = c6[Symbol.iterator]();
2026-10-03 08:58:59 +00:00
PUSH_NOTIFICATION_RECEIVED = applyArgumentsResult.next();
while (applyArgumentsResult !== undefined) {
c6 = 2;
let _JSON = JSON;
2026-10-06 11:16:32 +00:00
closure_8 = JSON.parse(PUSH_NOTIFICATION_RECEIVED);
PUSH_NOTIFICATION_RECEIVED = applyArgumentsResult(background_str[6]);
2026-10-03 08:58:59 +00:00
let isIOSResult = PUSH_NOTIFICATION_RECEIVED.isIOS();
if (isIOSResult) {
2026-10-06 11:16:32 +00:00
isIOSResult = undefined !== closure_8._local_uuid;
2026-10-03 08:58:59 +00:00
}
if (isIOSResult) {
2026-10-06 11:16:32 +00:00
PUSH_NOTIFICATION_RECEIVED = closure_8;
let tmp24 = closure_8;
value = map.get(closure_8._local_uuid);
2026-10-03 08:58:59 +00:00
background_str = value;
if (value == null) {
background_str = "background";
}
PUSH_NOTIFICATION_RECEIVED.app_state = background_str;
}
2026-10-06 11:16:32 +00:00
let tmp31 = closure_1(background_str[9]);
PUSH_NOTIFICATION_RECEIVED = c6.PUSH_NOTIFICATION_RECEIVED;
let obj13 = { notification_received_timestamp: normalizeTimestampToMs(closure_8.timestamp), push_action_type: closure_8.push_action_type, notif_instance_id: closure_8.notif_instance_id, notif_type_id: closure_8.notif_type_id, join_id: closure_8.join_id, notif_user_id: closure_8.notif_user_id, receiving_user_id: closure_8.receiving_user_id, message_id: closure_8.message_id, message_type: closure_8.message_type, guild_id: closure_8.guild_id, channel_id: closure_8.channel_id, channel_type: str1, rel_type: closure_8.rel_type, mention_type: closure_8.mention_type, app_state: closure_8.app_state, os_enabled: closure_8.os_enabled };
2026-10-03 08:58:59 +00:00
let track = tmp31.track;
2026-10-06 11:16:32 +00:00
let str2 = closure_8.channel_type;
2026-10-03 08:58:59 +00:00
str1 = undefined;
if (str2 != null) {
str1 = str2.toString();
}
let trackResult = track(PUSH_NOTIFICATION_RECEIVED, obj13);
c6 = 1;
continue;
}
2026-10-06 11:16:32 +00:00
let obj7 = applyArgumentsResult(background_str[8]);
2026-10-03 08:58:59 +00:00
PUSH_NOTIFICATION_RECEIVED = obj7.removeFile(str3, processing_notifications);
2026-10-06 11:16:32 +00:00
logger = 5;
c8 = 1;
2026-10-03 08:58:59 +00:00
const obj14 = { value: PUSH_NOTIFICATION_RECEIVED, done: false };
return obj14;
2026-07-20 16:05:17 +00:00
}
2026-10-06 11:16:32 +00:00
c8 = 3;
2026-10-05 08:00:40 +00:00
return { value: "IconComponent", done: null };
2026-10-03 08:58:59 +00:00
}
2026-10-06 11:16:32 +00:00
} catch (tmp73) {
2026-10-03 08:58:59 +00:00
if (0 === c6) {
2026-10-06 11:16:32 +00:00
c8 = 3;
throw tmp73;
} else if (1 === tmp75) {
logger = 1;
2026-10-03 08:58:59 +00:00
} else {
2026-10-06 11:16:32 +00:00
logger = 4;
2026-07-20 16:05:17 +00:00
}
}
}
2026-10-03 08:58:59 +00:00
});
applyArgumentsResult.handleSetCallNotificationExperiment = function handleSetCallNotificationExperiment() {
2026-10-06 11:16:32 +00:00
const obj = PlatformUtils;
2026-10-03 08:58:59 +00:00
if (!obj.isIOS()) {
const DCDNotificationManager = NativeModules.DCDNotificationManager;
const setShowMissedCallNotifications = DCDNotificationManager.setShowMissedCallNotifications;
const tmp = NativeModules;
if (setShowMissedCallNotifications != null) {
const result = setShowMissedCallNotifications(true);
}
const DCDNotificationManager2 = tmp.DCDNotificationManager;
const setShowFullscreenCallUI = DCDNotificationManager2.setShowFullscreenCallUI;
if (setShowFullscreenCallUI != null) {
const result1 = setShowFullscreenCallUI(true);
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
};
2026-10-06 11:16:32 +00:00
applyArgumentsResult.actions = { MESSAGE_ACK: applyArgumentsResult.handleAck, CHANNEL_SELECT: applyArgumentsResult.handleAck, POST_CONNECTION_OPEN: applyArgumentsResult.handlePostConnectionOpen, EXPERIMENT_OVERRIDE_BUCKET: applyArgumentsResult.handleSetCallNotificationExperiment, EXPERIMENTS_FETCH_SUCCESS: applyArgumentsResult.handleSetCallNotificationExperiment };
2026-10-03 08:58:59 +00:00
return applyArgumentsResult;
}
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const nativeNotificationsManager = new NativeNotificationsManager();
let result = size.fileFinishedImporting("modules/notifications/native/NativeNotificationsManager.tsx");
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
export default nativeNotificationsManager;