Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
315 lines
12 KiB
TypeScript
315 lines
12 KiB
TypeScript
// Module ID: 12281
|
|
// Function ID: 12282
|
|
// Name: ScheduledMessagesUtils
|
|
// Dependencies: [5, 7828, 1114, 4196, 7896, 4808, 12282, 1896, 12292, 7898, 7895, 7899, 7246, 4572, 11784, 2]
|
|
// Exports: cancelScheduledMessage, openRescheduleMessageActionSheet, openScheduleMessageActionSheet, openScheduledMessageEditContentModal, pickScheduledMessageTime, sendScheduledMessageNow, showScheduledMessagesModal
|
|
|
|
// Module 12281 (ScheduledMessagesUtils)
|
|
import util from "util" /* 1114 */;
|
|
import asyncRequireImpl from "asyncRequireImpl" /* 1896 */;
|
|
import _modDef4196 from "module_4196" /* 4196 */;
|
|
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4572 */;
|
|
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4808 */;
|
|
import DraftActionCreatorsDefault from "DraftActionCreators" /* 7828 */;
|
|
import ScheduledMessageUtils from "ScheduledMessageUtils" /* 7896 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
function editScheduledMessage() {
|
|
const self = this;
|
|
const apply = closure_5.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
let closure_5 = async function _editScheduledMessage(scheduledMessageId, arg1) {
|
|
closure_1 = arg1;
|
|
c6 = 0;
|
|
c7 = 0;
|
|
c5 = 0;
|
|
return (async (arg0, value) => {
|
|
if (c7 === 2) {
|
|
c7 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp6 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c7 = 2;
|
|
if (0 === c6) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
const obj5 = { value, done: true };
|
|
return obj5;
|
|
} else {
|
|
closure_3 = tmp3;
|
|
closure_2 = tmp7;
|
|
c5 = 1;
|
|
const obj6 = { scheduledMessageId };
|
|
const merged = Object.assign(closure_1);
|
|
c6 = 2;
|
|
c7 = 1;
|
|
const obj7 = { value: require("ScheduledMessageActionCreators").updateScheduledMessage(obj6), done: false };
|
|
return obj7;
|
|
}
|
|
} else if (1 === tmp7) {
|
|
c5 = 0;
|
|
closure_130_0 = closure_4;
|
|
const result = closure_131_0(closure_131_2[11]).showScheduledMessageEditFailureToast(closure_130_0.message);
|
|
c7 = 3;
|
|
return { value: false, done: true };
|
|
} else if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 0;
|
|
c7 = 3;
|
|
const obj8 = { value, done: true };
|
|
return obj8;
|
|
} else {
|
|
const result1 = closure_131_0(closure_131_2[11]).showScheduledMessageEditSuccessToast();
|
|
c5 = 0;
|
|
c7 = 3;
|
|
return { value: true, done: true };
|
|
}
|
|
} catch (tmp26) {
|
|
closure_4 = tmp26;
|
|
if (tmp4 === c5) {
|
|
c7 = tmp2;
|
|
throw tmp26;
|
|
} else {
|
|
c6 = tmp;
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
};
|
|
let closure_6 = async function _cancelScheduledMessage(arg0, arg1) {
|
|
closure_2 = tmp3;
|
|
await require("ScheduledMessageActionCreators").deleteScheduledMessage(closure_0);
|
|
if (1 === tmp7) {
|
|
c4 = 0;
|
|
closure_129_0 = closure_3;
|
|
const result = closure_130_0(closure_130_2[11]).showScheduleMessageDeleteFailureToast(closure_129_0.message);
|
|
c6 = 3;
|
|
closure_130_0(closure_130_2[11]);
|
|
} else if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
const result1 = closure_130_0(closure_130_2[11]).showScheduleMessageDeleteSuccessToast();
|
|
c4 = 0;
|
|
closure_130_0(closure_130_2[11]);
|
|
}
|
|
return arg1;
|
|
};
|
|
let closure_7 = async function _sendScheduledMessageNow(arg0, arg1) {
|
|
closure_2 = tmp3;
|
|
await require("ScheduledMessageActionCreators").sendScheduledMessageNow(closure_0);
|
|
if (1 === tmp7) {
|
|
c4 = 0;
|
|
closure_129_0 = closure_3;
|
|
const result = closure_130_0(closure_130_2[11]).showScheduleMessageSentNowFailureToast(closure_129_0.message);
|
|
c6 = 3;
|
|
closure_130_0(closure_130_2[11]);
|
|
} else if (arg0 === 1) {
|
|
c6 = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
const result1 = closure_130_0(closure_130_2[11]).showScheduleMessageSentNowSuccessToast();
|
|
c4 = 0;
|
|
closure_130_0(closure_130_2[11]);
|
|
}
|
|
return arg1;
|
|
};
|
|
function openSendTimeActionSheet(title) {
|
|
title = title.title;
|
|
({ startDate: importDefault, scheduledMessageId: dependencyMap, onSelect: asyncGeneratorStep, onClear } = title);
|
|
({ key, entryPoint, isEditing, channelId } = title);
|
|
const result = title(7896).trackScheduledMessageTimePickerOpened({ entryPoint, isEditing, channelId });
|
|
let obj = title(7896);
|
|
let obj2 = _modDef4196();
|
|
const addResult = _modDef4196().add(1, "day");
|
|
const result1 = _modDef4196().add(1, "day").startOf("day").set("hours", 9);
|
|
const startOfResult = _modDef4196().add(1, "day").startOf("day");
|
|
const obj5 = _modDef4196();
|
|
const addResult1 = _modDef4196().add(1, "day");
|
|
const result2 = _modDef4196().add(1, "day").startOf("day").set("hours", 13);
|
|
const startOfResult1 = _modDef4196().add(1, "day").startOf("day");
|
|
const obj8 = _modDef4196();
|
|
const startOfResult2 = _modDef4196().startOf("isoWeek");
|
|
let obj3 = { label: null, value: null };
|
|
const result3 = _modDef4196().startOf("isoWeek").add(1, "week").set("hours", 9);
|
|
const intl = title(1114).intl;
|
|
obj3.label = intl.string(title(1114).t.tjIn9i);
|
|
obj3.value = result1;
|
|
const items = [obj3, , ];
|
|
let obj4 = { label: null, value: null };
|
|
const intl2 = title(1114).intl;
|
|
obj4.label = intl2.string(title(1114).t.EMRZyS);
|
|
obj4.value = result2;
|
|
items[1] = obj4;
|
|
const obj6 = { label: null, value: null };
|
|
const intl3 = title(1114).intl;
|
|
obj6.label = intl3.string(title(1114).t["+P5MmK"]);
|
|
obj6.value = result3;
|
|
items[2] = obj6;
|
|
const addResult2 = _modDef4196().startOf("isoWeek").add(1, "week");
|
|
const obj7 = { key, header: { title }, hasIcons: false, options: null };
|
|
const items1 = [
|
|
...items.map((label) => {
|
|
title = label.value;
|
|
return {
|
|
label: label.label,
|
|
onPress() {
|
|
return asyncGeneratorStep(value);
|
|
}
|
|
};
|
|
})
|
|
];
|
|
const obj9 = { label: null, onPress: null };
|
|
const intl4 = title(1114).intl;
|
|
obj9.label = intl4.string(title(1114).t.stHooC);
|
|
obj9.onPress = function onPress() {
|
|
ActionSheetActionCreatorsDefault.hideActionSheet();
|
|
const obj2 = ModalActionCreatorsDefault;
|
|
const obj3 = { title, defaultValue, minimumDate: null, maximumDate: null, getError: null, createReminder: null, onClose: null };
|
|
const tmp2 = asyncRequireImpl(11784, dependencyMap.paths);
|
|
obj3.minimumDate = ScheduledMessageUtils.getEarliestScheduledTime();
|
|
obj3.maximumDate = ScheduledMessageUtils.getLatestScheduledTime(closure_1_2);
|
|
obj3.getError = function getError(isBefore) {
|
|
return title(7896).getScheduledTimeError(isBefore, dependencyMap);
|
|
};
|
|
obj3.createReminder = function createReminder(arg0) {
|
|
return closure_1_3(defaultValue(4196)(arg0));
|
|
};
|
|
obj3.onClose = ModalActionCreatorsDefault.pop;
|
|
obj2.pushLazy(tmp2, obj3, "scheduled-message-custom-time", { presentation: "modal" });
|
|
};
|
|
items1[tmp7] = obj9;
|
|
if (null != onClear) {
|
|
const obj10 = { label: null, onPress: null };
|
|
const intl5 = tmp(1114).intl;
|
|
obj10.label = intl5.string(tmp(1114).t.VkKicb);
|
|
obj10.onPress = onClear;
|
|
const items2 = [obj10];
|
|
let items3 = items2;
|
|
} else {
|
|
items3 = [];
|
|
}
|
|
HermesBuiltin.arraySpread(items3, tmp7 + 1);
|
|
obj7.options = items1;
|
|
const result4 = title(7246).showSimpleActionSheet(obj7);
|
|
}
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/scheduled_messages/native/ScheduledMessagesUtils.native.tsx");
|
|
|
|
export const openScheduleMessageActionSheet = function openScheduleMessageActionSheet(id, ATTACH_MENU, scheduledTimestamp) {
|
|
_require = id;
|
|
const obj = {
|
|
onSelect(scheduledTimestamp) {
|
|
return DraftActionCreatorsDefault.changeScheduledMessage(closure_0, { scheduledTimestamp });
|
|
},
|
|
currentTimestamp: scheduledTimestamp,
|
|
entryPoint: ATTACH_MENU,
|
|
channelId: id
|
|
};
|
|
({ onSelect: closure_0, currentTimestamp } = obj);
|
|
const obj2 = { key: "schedule-message", title: null, startDate: null, onSelect: null, onClear: null, entryPoint: null, isEditing: null, channelId: null };
|
|
({ onClear, entryPoint, channelId } = obj);
|
|
const intl = require("util").intl;
|
|
obj2.title = intl.string(require("util").t["3+ii4F"]);
|
|
if (null != currentTimestamp) {
|
|
let defaultScheduledTime = _modDef4196(currentTimestamp);
|
|
} else {
|
|
defaultScheduledTime = require("ScheduledMessageUtils").getDefaultScheduledTime();
|
|
const tmp2Result = require("ScheduledMessageUtils");
|
|
}
|
|
obj2.startDate = defaultScheduledTime;
|
|
obj2.onSelect = function onSelect(toISOString) {
|
|
return id(toISOString.toISOString());
|
|
};
|
|
obj2.onClear = onClear;
|
|
obj2.entryPoint = entryPoint;
|
|
obj2.isEditing = null != currentTimestamp;
|
|
obj2.channelId = channelId;
|
|
openSendTimeActionSheet(obj2);
|
|
};
|
|
export const pickScheduledMessageTime = function pickScheduledMessageTime(arg0) {
|
|
({ onSelect: require, currentTimestamp } = arg0);
|
|
const obj = { key: "schedule-message", title: null, startDate: null, onSelect: null, onClear: null, entryPoint: null, isEditing: null, channelId: null };
|
|
({ onClear, entryPoint, channelId } = arg0);
|
|
const intl = util.intl;
|
|
obj.title = intl.string(util.t["3+ii4F"]);
|
|
if (null != currentTimestamp) {
|
|
let defaultScheduledTime = _modDef4196(currentTimestamp);
|
|
} else {
|
|
defaultScheduledTime = ScheduledMessageUtils.getDefaultScheduledTime();
|
|
const tmp2Result = ScheduledMessageUtils;
|
|
}
|
|
obj.startDate = defaultScheduledTime;
|
|
obj.onSelect = function onSelect(toISOString) {
|
|
return id(toISOString.toISOString());
|
|
};
|
|
obj.onClear = onClear;
|
|
obj.entryPoint = entryPoint;
|
|
obj.isEditing = null != currentTimestamp;
|
|
obj.channelId = channelId;
|
|
openSendTimeActionSheet(obj);
|
|
};
|
|
export const showScheduledMessagesModal = function showScheduledMessagesModal() {
|
|
ModalActionCreatorsDefault.pushLazy(asyncRequireImpl(12282, dependencyMap.paths), {}, "scheduled-messages-modal", { presentation: "modal" });
|
|
};
|
|
export const openScheduledMessageEditContentModal = function openScheduledMessageEditContentModal(scheduledMessage) {
|
|
ModalActionCreatorsDefault.pushLazy(asyncRequireImpl(12292, dependencyMap.paths), { scheduledMessage }, "scheduled-message-edit-content", { presentation: "modal" });
|
|
};
|
|
export const openRescheduleMessageActionSheet = function openRescheduleMessageActionSheet(scheduledMessageId, sendAtTimestamp, channelId) {
|
|
_require = scheduledMessageId;
|
|
const obj = { key: "reschedule-message", title: null, startDate: null, scheduledMessageId: null, onSelect: null, entryPoint: null, isEditing: true, channelId: null };
|
|
const intl = require("util").intl;
|
|
obj.title = intl.string(require("util").t.jbdHj3);
|
|
obj.startDate = _modDef4196(sendAtTimestamp);
|
|
obj.scheduledMessageId = scheduledMessageId;
|
|
obj.onSelect = function onSelect(toISOString) {
|
|
return editScheduledMessage(closure_0, { scheduledTimestamp: toISOString.toISOString() });
|
|
};
|
|
obj.entryPoint = require("ScheduledMessageTypes").ScheduledMessageEntryPoint.INBOX;
|
|
obj.channelId = channelId;
|
|
openSendTimeActionSheet(obj);
|
|
};
|
|
export { editScheduledMessage };
|
|
export const cancelScheduledMessage = function cancelScheduledMessage() {
|
|
const self = this;
|
|
const apply = closure_6.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const sendScheduledMessageNow = function sendScheduledMessageNow() {
|
|
const self = this;
|
|
const apply = closure_7.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|