Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
456 lines
16 KiB
TypeScript
456 lines
16 KiB
TypeScript
// Module ID: 18267
|
|
// Function ID: 18268
|
|
// Name: NativeNotificationsManager
|
|
// Dependencies: [5, 17, 7877, 4773, 1078, 3, 18268, 9553, 11, 7365, 1368, 8479, 1245, 2]
|
|
|
|
// Module 18267 (NativeNotificationsManager)
|
|
import LoggerDefault from "Logger" /* 3 */;
|
|
import PushNotificationDefault from "PushNotification" /* 9553 */;
|
|
import ClearChannelNotificationsOnAppForegroundExperiment from "ClearChannelNotificationsOnAppForegroundExperiment" /* 18268 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import GuildReadStateStore from "GuildReadStateStore" /* 7877 */;
|
|
import ReadStateStore from "ReadStateStore" /* 4773 */;
|
|
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7365 */;
|
|
|
|
require = fn;
|
|
function getDeliveredNotifications() {
|
|
const self = this;
|
|
const apply = closure_11.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
let closure_11 = async function _getDeliveredNotifications(arg0, value) {
|
|
if (c2 === 2) {
|
|
c2 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
return { value: "IconComponent", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c2 = 2;
|
|
if (0 === c1) {
|
|
if (arg0 === 1) {
|
|
c2 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c2 = 3;
|
|
const obj5 = { value, done: true };
|
|
return obj5;
|
|
} else {
|
|
closure_0 = tmp2;
|
|
if (obj2.shouldClearChannelNotificationsOnAppForeground({ location: "getDeliveredNotifications" })) {
|
|
c1 = 1;
|
|
c2 = 1;
|
|
const obj6 = { value: require("PushNotification").getDeliveredNotifications(), done: false };
|
|
return obj6;
|
|
} else {
|
|
c2 = 3;
|
|
}
|
|
obj2 = ClearChannelNotificationsOnAppForegroundExperiment;
|
|
tmp8 = dependencyMap;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c2 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
closure_128_9 = value;
|
|
}
|
|
c2 = 3;
|
|
const obj = { value, done: true };
|
|
return obj;
|
|
} catch (tmp10) {
|
|
c2 = tmp;
|
|
throw tmp10;
|
|
}
|
|
}
|
|
};
|
|
function updateAndClearStaleNotifications() {
|
|
const self = this;
|
|
const apply = closure_13.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
let closure_13 = async function _updateAndClearStaleNotifications(arg0, value) {
|
|
if (c2 === 2) {
|
|
c2 = 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) {
|
|
let obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "IconComponent", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c2 = 2;
|
|
if (0 === c1) {
|
|
if (arg0 === 1) {
|
|
c2 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c2 = 3;
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
c0 = 0;
|
|
c1 = 1;
|
|
c2 = 1;
|
|
const obj4 = { value: getDeliveredNotifications(), done: false };
|
|
return obj4;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c2 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c2 = 3;
|
|
let obj = { value, done: true };
|
|
return obj;
|
|
} else {
|
|
(function clearStaleNotifications() {
|
|
if (obj.shouldClearChannelNotificationsOnAppForeground({ location: "clearStaleNotifications" })) {
|
|
const found = closure_1_9.filter((userInfo) => {
|
|
if (null != userInfo.userInfo) {
|
|
if (typeof userInfo.userInfo === "object") {
|
|
if (typeof userInfo.userInfo.channel_id !== "string") {
|
|
return false;
|
|
} else if (typeof userInfo.userInfo.notif_instance_id !== "string") {
|
|
return false;
|
|
} else {
|
|
let message_id = userInfo.userInfo.notif_instance_id;
|
|
if ("MESSAGE_CREATE" === userInfo.userInfo.type) {
|
|
if (typeof userInfo.userInfo.message_id !== "string") {
|
|
return false;
|
|
} else {
|
|
message_id = userInfo.userInfo.message_id;
|
|
}
|
|
} else if ("GENERIC_PUSH_NOTIFICATION_SENT" !== userInfo.userInfo.type) {
|
|
return false;
|
|
} else if ("REACTIONS_PUSH_NOTIFICATION" !== userInfo.userInfo.notification_type) {
|
|
return false;
|
|
}
|
|
if (null != message_id) {
|
|
if (typeof message_id === "string") {
|
|
const ackMessageIdResult = closure_1_6.ackMessageId(userInfo.userInfo.channel_id);
|
|
let tmp3 = null != ackMessageIdResult;
|
|
if (tmp3) {
|
|
tmp3 = closure_1_1(dependencyMap[8]).compare(ackMessageIdResult, message_id) > 0;
|
|
const obj = closure_1_1(dependencyMap[8]);
|
|
}
|
|
return tmp3;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
const mapped = found.map((identifier) => identifier.identifier);
|
|
if (mapped.length > 0) {
|
|
const result = closure_1_1(dependencyMap[7]).removeDeliveredNotifications(mapped);
|
|
closure_1_10();
|
|
const obj2 = closure_1_1(dependencyMap[7]);
|
|
}
|
|
}
|
|
})();
|
|
c2 = 3;
|
|
return { value: "IconComponent", done: null };
|
|
}
|
|
} catch (tmp8) {
|
|
c2 = tmp;
|
|
throw tmp8;
|
|
}
|
|
}
|
|
};
|
|
const NativeModules = fn(17).NativeModules;
|
|
const AnalyticEvents = fn(1078).AnalyticEvents;
|
|
let closure_8 = new LoggerDefault("NativeNotificationsManager");
|
|
let closure_9 = [];
|
|
const prototype = function NativeNotificationsManager() {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
applyArgumentsResult.handleAck = function handleAck(channelId) {
|
|
channelId = channelId.channelId;
|
|
if (obj.isIOS()) {
|
|
const result = PushNotificationDefault.setApplicationIconBadgeNumber(totalMentionCount.getTotalMentionCount());
|
|
}
|
|
if (null != channelId) {
|
|
const DCDNotificationManager = NativeModules.DCDNotificationManager;
|
|
if (DCDNotificationManager != null) {
|
|
const result1 = DCDNotificationManager.clearNotificationsForChannel(channelId);
|
|
}
|
|
}
|
|
};
|
|
require = applyArgumentsResult;
|
|
applyArgumentsResult.handlePostConnectionOpen = asyncGeneratorStep(async (arg0, value) => {
|
|
if (logger === 2) {
|
|
logger = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp8 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
return { value: "IconComponent", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
logger = 2;
|
|
if (0 === c7) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
logger = 3;
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
closure_4 = tmp3;
|
|
closure_3 = tmp6;
|
|
closure_131_0 = undefined;
|
|
closure_131_1 = undefined;
|
|
closure_131_2 = undefined;
|
|
closure_131_3 = undefined;
|
|
closure_131_4 = undefined;
|
|
closure_131_5 = undefined;
|
|
closure_131_6 = undefined;
|
|
closure_131_7 = undefined;
|
|
closure_131_8 = undefined;
|
|
if (obj14.isIOS()) {
|
|
updateAndClearStaleNotifications();
|
|
} else {
|
|
let result = applyArgumentsResult.handleSetCallNotificationExperiment();
|
|
}
|
|
c6 = 1;
|
|
function moveAndReadData() {
|
|
const self = this;
|
|
const apply = closure_10.apply;
|
|
if (typeof apply === "unknown") {
|
|
applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
closure_131_9 = moveAndReadData;
|
|
closure_131_10 = function _moveAndReadData() {
|
|
const self = this;
|
|
const tmp = closure_3(function*(arg0, value) {
|
|
closure_130_0 = closure_0;
|
|
closure_130_1 = closure_1;
|
|
yield closure_0(tmp2[11]).removeFile(closure_2_0, closure_1);
|
|
yield closure_0(tmp2[11]).moveFile(closure_131_0, closure_130_0, closure_130_1);
|
|
if (2 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
return { value, done: true };
|
|
} else {
|
|
let tmp6 = null;
|
|
if (value) {
|
|
c4 = 3;
|
|
c5 = 1;
|
|
return { value: closure_0(tmp2[11]).readFile(closure_131_0, closure_130_1, "utf8"), done: false };
|
|
}
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else {
|
|
tmp6 = value;
|
|
if (arg0 === 2) {
|
|
c5 = 3;
|
|
return { value, done: true };
|
|
}
|
|
}
|
|
return tmp6;
|
|
});
|
|
closure_10 = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
closure_131_11 = function normalizeTimestampToMs(match) {
|
|
if (null != match) {
|
|
if (typeof match === "number") {
|
|
const _Math = Math;
|
|
let rounded = Math.round(1000 * match);
|
|
} else if (typeof match === "string") {
|
|
const _parseInt = parseInt;
|
|
rounded = parseInt(match, 10);
|
|
}
|
|
return rounded;
|
|
}
|
|
};
|
|
obj14 = applyArgumentsResult(1368);
|
|
let str2 = "cache";
|
|
if (obj8.isIOS()) {
|
|
str2 = "shared";
|
|
}
|
|
closure_131_0 = str2;
|
|
closure_131_1 = "processing_notifications";
|
|
closure_131_2 = "processing_notification_states";
|
|
c7 = 2;
|
|
logger = 1;
|
|
const obj5 = { value: moveAndReadData("notifications_to_track", "processing_notifications"), done: false };
|
|
return obj5;
|
|
}
|
|
} else {
|
|
if (1 === tmp9) {
|
|
c6 = 0;
|
|
closure_131_12 = closure_5;
|
|
logger.error("Error tracking push notifications", closure_131_12);
|
|
logger = 3;
|
|
} else {
|
|
if (2 === tmp9) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c6 = 0;
|
|
logger = 3;
|
|
const obj6 = { value, done: true };
|
|
return obj6;
|
|
} else {
|
|
closure_131_3 = value;
|
|
if (null == closure_131_3) {
|
|
c6 = 0;
|
|
logger = 3;
|
|
return { value: "IconComponent", done: null };
|
|
} else {
|
|
const _Map = Map;
|
|
const map = new Map();
|
|
closure_131_4 = map;
|
|
if (obj13.isIOS()) {
|
|
c7 = 3;
|
|
logger = 1;
|
|
const obj7 = { value: closure_131_9("notification_states_to_track", closure_131_2), done: false };
|
|
return obj7;
|
|
} else {
|
|
closure_131_6 = closure_131_3.trim().split("\n");
|
|
closure_1 = closure_131_6;
|
|
closure_1 = closure_131_6;
|
|
applyArgumentsResult = closure_131_6[Symbol.iterator]();
|
|
const str = closure_131_3.trim();
|
|
}
|
|
obj13 = applyArgumentsResult(1368);
|
|
}
|
|
}
|
|
} else if (3 === tmp9) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
closure_131_5 = value;
|
|
if (null !== closure_131_5) {
|
|
const parts = closure_131_5.trim().split("\n");
|
|
const item = parts.forEach((item) => {
|
|
const parsed = JSON.parse(item);
|
|
const result = closure_1_4.set(parsed._local_uuid, parsed.app_state);
|
|
});
|
|
const str13 = closure_131_5.trim();
|
|
}
|
|
}
|
|
} else if (4 === tmp9) {
|
|
c6 = 1;
|
|
applyArgumentsResult.return();
|
|
throw closure_5;
|
|
} else {
|
|
if (5 === tmp9) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c6 = 0;
|
|
logger = 3;
|
|
const obj9 = { value, done: true };
|
|
return obj9;
|
|
} else {
|
|
const obj12 = applyArgumentsResult(1368);
|
|
}
|
|
} else if (arg0 === 1) {
|
|
logger = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c6 = 0;
|
|
logger = 3;
|
|
const obj = { value, done: true };
|
|
return obj;
|
|
}
|
|
c6 = 0;
|
|
}
|
|
c6 = 0;
|
|
logger = 3;
|
|
const obj10 = { value, done: true };
|
|
return obj10;
|
|
}
|
|
c7 = 6;
|
|
logger = 1;
|
|
const obj11 = { value: applyArgumentsResult(8479).removeFile(closure_131_0, closure_131_2), done: false };
|
|
return obj11;
|
|
}
|
|
} catch (tmp41) {
|
|
closure_5 = tmp41;
|
|
if (tmp4 === c6) {
|
|
logger = tmp2;
|
|
throw tmp41;
|
|
} else if (tmp === tmp43) {
|
|
c7 = tmp;
|
|
} else {
|
|
c7 = tmp5;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
applyArgumentsResult.handleSetCallNotificationExperiment = function handleSetCallNotificationExperiment() {
|
|
if (!obj.isIOS()) {
|
|
const DCDNotificationManager = NativeModules.DCDNotificationManager;
|
|
const setShowMissedCallNotifications = DCDNotificationManager.setShowMissedCallNotifications;
|
|
if (setShowMissedCallNotifications != null) {
|
|
const result = setShowMissedCallNotifications(true);
|
|
}
|
|
const DCDNotificationManager2 = NativeModules.DCDNotificationManager;
|
|
const setShowFullscreenCallUI = DCDNotificationManager2.setShowFullscreenCallUI;
|
|
if (setShowFullscreenCallUI != null) {
|
|
const result1 = setShowFullscreenCallUI(true);
|
|
}
|
|
}
|
|
};
|
|
applyArgumentsResult.updateAndClearStaleNotifications = function updateAndClearStaleNotifications() {
|
|
updateAndClearStaleNotifications();
|
|
};
|
|
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, APP_STATE_UPDATE: applyArgumentsResult.updateAndClearStaleNotifications };
|
|
return applyArgumentsResult;
|
|
}.prototype;
|
|
class prototype extends tmp3 {
|
|
}
|
|
const prototype1 = new prototype();
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/notifications/native/NativeNotificationsManager.tsx");
|
|
|
|
export default prototype1;
|