506 lines
18 KiB
TypeScript
506 lines
18 KiB
TypeScript
// Module ID: 16786
|
|
// Function ID: 16787
|
|
// Name: getDeliveredNotifications
|
|
// Dependencies: [5, 17, 7018, 4297, 676, 3, 16787, 10695, 11, 5244, 500, 8724, 698, 2]
|
|
|
|
// Module 16786 (getDeliveredNotifications)
|
|
import timestamp from "timestamp";
|
|
import { NativeModules } from "get ActivityIndicator";
|
|
import updateGuildUnreadSentinel from "updateGuildUnreadSentinel";
|
|
import generateOldThreadCutoff from "generateOldThreadCutoff";
|
|
import { AnalyticEvents } from "ME";
|
|
import "initialize";
|
|
|
|
let require = arg1;
|
|
function getDeliveredNotifications() {
|
|
const self = this;
|
|
const apply = _getDeliveredNotifications.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function _getDeliveredNotifications() {
|
|
const self = this;
|
|
const tmp = callback(function*() {
|
|
if (table === 2) {
|
|
table = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "T", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
table = 2;
|
|
if (0 === v0) {
|
|
if (arg0 === 1) {
|
|
table = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
table = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let closure_0 = tmp2;
|
|
let obj1 = outer1_0(table[6]);
|
|
if (obj1.shouldClearChannelNotificationsOnAppForeground({ location: "getDeliveredNotifications" })) {
|
|
v0 = 1;
|
|
table = 1;
|
|
obj1 = { value: null, done: false };
|
|
obj1[0] = v0(tmp8[7]).getDeliveredNotifications();
|
|
return obj1;
|
|
} else {
|
|
table = 3;
|
|
}
|
|
tmp8 = table;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
table = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
let closure_9 = arg1;
|
|
}
|
|
table = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} catch (tmp10) {
|
|
table = tmp;
|
|
throw tmp10;
|
|
}
|
|
}
|
|
});
|
|
const _getDeliveredNotifications = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function updateAndClearStaleNotifications() {
|
|
const self = this;
|
|
const apply = _updateAndClearStaleNotifications.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function _updateAndClearStaleNotifications() {
|
|
const self = this;
|
|
const tmp = callback(function*() {
|
|
if (c2 === 2) {
|
|
c2 = 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: "T", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c2 = 2;
|
|
if (0 === c1) {
|
|
if (arg0 === 1) {
|
|
c2 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c2 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let c0 = 0;
|
|
c1 = 1;
|
|
c2 = 1;
|
|
const obj1 = { value: null, done: false };
|
|
obj1[0] = outer1_10();
|
|
return obj1;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c2 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c2 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
(function clearStaleNotifications() {
|
|
if (obj.shouldClearChannelNotificationsOnAppForeground({ location: "clearStaleNotifications" })) {
|
|
const found = closure_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 = generateOldThreadCutoff.ackMessageId(userInfo.userInfo.channel_id);
|
|
let tmp3 = null != ackMessageIdResult;
|
|
if (tmp3) {
|
|
tmp3 = callback(table[8]).compare(ackMessageIdResult, message_id) > 0;
|
|
const obj = callback(table[8]);
|
|
}
|
|
return tmp3;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
const mapped = found.map((identifier) => identifier.identifier);
|
|
if (mapped.length > 0) {
|
|
const result = v1(table[7]).removeDeliveredNotifications(mapped);
|
|
callback();
|
|
const obj2 = v1(table[7]);
|
|
}
|
|
}
|
|
})();
|
|
c2 = 3;
|
|
return { value: "T", done: null };
|
|
}
|
|
} catch (tmp8) {
|
|
c2 = tmp;
|
|
throw tmp8;
|
|
}
|
|
}
|
|
});
|
|
const _updateAndClearStaleNotifications = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
const metroImportAll = new require("generateOldThreadCutoff")("NativeNotificationsManager");
|
|
let closure_9 = [];
|
|
let prototype = function NativeNotificationsManager() {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
applyArgumentsResult.handleAck = function handleAck(channelId) {
|
|
channelId = channelId.channelId;
|
|
if (obj.isIOS()) {
|
|
const result = callback(10695).setApplicationIconBadgeNumber(totalMentionCount.getTotalMentionCount());
|
|
const obj2 = callback(10695);
|
|
}
|
|
if (null != channelId) {
|
|
const DCDNotificationManager = closure_4.DCDNotificationManager;
|
|
if (DCDNotificationManager != null) {
|
|
const result1 = DCDNotificationManager.clearNotificationsForChannel(channelId);
|
|
}
|
|
}
|
|
};
|
|
const require = applyArgumentsResult;
|
|
applyArgumentsResult.handlePostConnectionOpen = callback(function*() {
|
|
if (logger === 2) {
|
|
logger = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp8 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "T", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
logger = 2;
|
|
if (0 === c7) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
logger = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let map = tmp3;
|
|
let c3 = tmp6;
|
|
let closure_0;
|
|
let closure_1;
|
|
let processing_notification_states;
|
|
c3 = undefined;
|
|
map = undefined;
|
|
let c5;
|
|
let dependencyMap;
|
|
c7 = undefined;
|
|
logger = undefined;
|
|
if (obj14.isIOS()) {
|
|
outer1_12();
|
|
} else {
|
|
let result = outer1_0.handleSetCallNotificationExperiment();
|
|
}
|
|
dependencyMap = 1;
|
|
function moveAndReadData(notifications_to_track, processing_notifications) {
|
|
const self = this;
|
|
const apply = _moveAndReadData.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function _moveAndReadData() {
|
|
const self = this;
|
|
const tmp = _undefined((arg0, arg1) => {
|
|
let closure_0 = arg0;
|
|
let closure_1 = arg1;
|
|
let c4 = 0;
|
|
let c5 = 0;
|
|
return (function*(arg0, arg1) {
|
|
let closure_2 = tmp2;
|
|
yield callback(outer1_2[11]).removeFile(callback, closure_1);
|
|
let obj5 = callback(outer1_2[11]);
|
|
yield obj5.moveFile(callback, callback, closure_1);
|
|
if (2 === tmp5) {
|
|
if (arg0 === 1) {
|
|
let c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj4 = { value: null, done: true };
|
|
obj4[0] = arg1;
|
|
return obj4;
|
|
} else {
|
|
let tmp6 = null;
|
|
if (arg1) {
|
|
const obj2 = callback(outer1_2[11]);
|
|
let c4 = 3;
|
|
c5 = 1;
|
|
obj5 = { value: null, done: false };
|
|
obj5[0] = obj2.readFile(callback, closure_1, "utf8");
|
|
return obj5;
|
|
}
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else {
|
|
tmp6 = arg1;
|
|
if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
}
|
|
}
|
|
return tmp6;
|
|
})();
|
|
});
|
|
const _moveAndReadData = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
function normalizeTimestampToMs(joined) {
|
|
if (null != joined) {
|
|
if (typeof joined === "number") {
|
|
const _Math = Math;
|
|
let rounded = Math.round(1000 * joined);
|
|
} else if (typeof joined === "string") {
|
|
const _parseInt = parseInt;
|
|
rounded = parseInt(joined, 10);
|
|
}
|
|
return rounded;
|
|
}
|
|
}
|
|
obj14 = outer1_0(outer1_2[10]);
|
|
let str2 = "cache";
|
|
if (obj8.isIOS()) {
|
|
str2 = "shared";
|
|
}
|
|
closure_0 = str2;
|
|
closure_1 = "processing_notifications";
|
|
processing_notification_states = "processing_notification_states";
|
|
c7 = 2;
|
|
logger = 1;
|
|
let obj1 = { value: null, done: false };
|
|
obj1[0] = moveAndReadData("notifications_to_track", "processing_notifications");
|
|
return obj1;
|
|
}
|
|
} else {
|
|
if (1 === tmp9) {
|
|
dependencyMap = 0;
|
|
outer1_12 = c5;
|
|
logger.error("Error tracking push notifications", outer1_12);
|
|
logger = 3;
|
|
} else {
|
|
if (2 === tmp9) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
dependencyMap = 0;
|
|
logger = 3;
|
|
let obj2 = { value: null, done: true };
|
|
obj2[0] = arg1;
|
|
return obj2;
|
|
} else {
|
|
const outer1_3 = arg1;
|
|
if (null == outer1_3) {
|
|
dependencyMap = 0;
|
|
logger = 3;
|
|
return { value: "T", done: null };
|
|
} else {
|
|
const _Map = Map;
|
|
map = new Map();
|
|
if (obj13.isIOS()) {
|
|
c7 = 3;
|
|
logger = 1;
|
|
const obj3 = { value: null, done: false };
|
|
obj3[0] = outer1_9("notification_states_to_track", outer1_2);
|
|
return obj3;
|
|
} else {
|
|
dependencyMap = outer1_3.trim().split("\n");
|
|
closure_1 = dependencyMap;
|
|
closure_1 = dependencyMap;
|
|
closure_0 = dependencyMap[Symbol.iterator]();
|
|
const str = outer1_3.trim();
|
|
}
|
|
obj13 = outer1_0(outer1_2[10]);
|
|
}
|
|
}
|
|
} else if (3 === tmp9) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
const outer1_5 = arg1;
|
|
if (null !== outer1_5) {
|
|
const parts = outer1_5.trim().split("\n");
|
|
const item = parts.forEach((arg0) => {
|
|
const parsed = JSON.parse(arg0);
|
|
const result = map.set(parsed._local_uuid, parsed.app_state);
|
|
});
|
|
const str13 = outer1_5.trim();
|
|
}
|
|
}
|
|
} else if (4 === tmp9) {
|
|
dependencyMap = 1;
|
|
closure_0.return();
|
|
throw c5;
|
|
} else {
|
|
if (5 === tmp9) {
|
|
if (arg0 === 1) {
|
|
logger = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
dependencyMap = 0;
|
|
logger = 3;
|
|
let obj4 = { value: null, done: true };
|
|
obj4[0] = arg1;
|
|
return obj4;
|
|
} else {
|
|
const obj12 = outer1_0(outer1_2[10]);
|
|
}
|
|
} else if (arg0 === 1) {
|
|
logger = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
dependencyMap = 0;
|
|
logger = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
}
|
|
dependencyMap = 0;
|
|
}
|
|
dependencyMap = 0;
|
|
logger = 3;
|
|
let obj5 = { value: null, done: true };
|
|
obj5[0] = arg1;
|
|
return obj5;
|
|
}
|
|
obj1 = outer1_0(outer1_2[11]);
|
|
c7 = 6;
|
|
logger = 1;
|
|
const obj6 = { value: null, done: false };
|
|
obj6[0] = obj1.removeFile(outer1_0, outer1_2);
|
|
return obj6;
|
|
}
|
|
} catch (tmp41) {
|
|
c5 = tmp41;
|
|
if (tmp4 === dependencyMap) {
|
|
logger = tmp2;
|
|
throw tmp41;
|
|
} else if (tmp === tmp43) {
|
|
c7 = tmp;
|
|
} else {
|
|
c7 = tmp5;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
applyArgumentsResult.handleSetCallNotificationExperiment = function handleSetCallNotificationExperiment() {
|
|
if (!obj.isIOS()) {
|
|
const DCDNotificationManager = closure_4.DCDNotificationManager;
|
|
const setShowMissedCallNotifications = DCDNotificationManager.setShowMissedCallNotifications;
|
|
if (setShowMissedCallNotifications != null) {
|
|
const result = setShowMissedCallNotifications(true);
|
|
}
|
|
const DCDNotificationManager2 = closure_4.DCDNotificationManager;
|
|
const setShowFullscreenCallUI = DCDNotificationManager2.setShowFullscreenCallUI;
|
|
if (setShowFullscreenCallUI != null) {
|
|
const result1 = setShowFullscreenCallUI(true);
|
|
}
|
|
const tmp = closure_4;
|
|
}
|
|
};
|
|
applyArgumentsResult.updateAndClearStaleNotifications = function updateAndClearStaleNotifications() {
|
|
callback2();
|
|
};
|
|
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 {
|
|
}
|
|
prototype = new prototype();
|
|
const tmp2 = new require("generateOldThreadCutoff")("NativeNotificationsManager");
|
|
let result = require("updateGuildUnreadSentinel").fileFinishedImporting("modules/notifications/native/NativeNotificationsManager.tsx");
|
|
|
|
export default prototype;
|