Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
94 lines
3.7 KiB
TypeScript
94 lines
3.7 KiB
TypeScript
// Module ID: 18277
|
|
// Function ID: 18278
|
|
// Name: MessageSendFailureNotificationManager
|
|
// Dependencies: [2099, 4580, 1376, 1983, 1078, 9315, 12959, 12961, 9553, 1119, 7365, 2]
|
|
|
|
// Module 18277 (MessageSendFailureNotificationManager)
|
|
import util from "util" /* 1119 */;
|
|
import PushNotificationDefault from "PushNotification" /* 9553 */;
|
|
import InAppNotificationUtils from "InAppNotificationUtils" /* 12959 */;
|
|
import InAppNotificationActionCreatorsDefault from "InAppNotificationActionCreators" /* 12961 */;
|
|
import SelectedChannelStore from "SelectedChannelStore" /* 2099 */;
|
|
import SelectedGuildStore from "SelectedGuildStore" /* 4580 */;
|
|
import UserStore from "UserStore" /* 1376 */;
|
|
import AppStateStore from "AppStateStore" /* 1983 */;
|
|
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7365 */;
|
|
|
|
require = fn;
|
|
function handleMessageSendFailure(shouldNotify) {
|
|
({ channelId, messageId } = shouldNotify);
|
|
if (shouldNotify.shouldNotify) {
|
|
if ("active" !== AppStateStore.getState()) {
|
|
const obj2 = { category: "local", alertTitle: null, alertBody: null, userInfo: null };
|
|
const intl = util.intl;
|
|
obj2.alertTitle = intl.string(util.t.LdlH2M);
|
|
const intl2 = util.intl;
|
|
obj2.alertBody = intl2.string(util.t.xxRPOT);
|
|
const obj3 = { channelId, messageId, type: LocalNotificationTypes.MESSAGE_SEND_FAILED };
|
|
obj2.userInfo = obj3;
|
|
const result = PushNotificationDefault.presentLocalNotification(obj2);
|
|
} else if (channelId !== SelectedChannelStore.getChannelId(SelectedGuildStore.getGuildId())) {
|
|
const MESSAGE_FAILED_TO_SEND = constants.MESSAGE_FAILED_TO_SEND;
|
|
const notificationDuration = InAppNotificationUtils.getNotificationDuration(MESSAGE_FAILED_TO_SEND);
|
|
const obj6 = {
|
|
type: MESSAGE_FAILED_TO_SEND,
|
|
channelId,
|
|
messageId,
|
|
key: `${channelId}-${messageId}`,
|
|
duration: notificationDuration,
|
|
onDismiss() {
|
|
InAppNotificationActionCreatorsDefault.clearNotification();
|
|
},
|
|
inAppNotificationId: null
|
|
};
|
|
const obj5 = InAppNotificationActionCreatorsDefault;
|
|
obj6.inAppNotificationId = InAppNotificationUtils.generateInAppNotificationId();
|
|
obj5.enqueueNotification(obj6);
|
|
}
|
|
}
|
|
}
|
|
function handleMessageCreate(message) {
|
|
message = message.message;
|
|
const sendMessageOptions = message.sendMessageOptions;
|
|
let prop;
|
|
if (sendMessageOptions != null) {
|
|
prop = sendMessageOptions.isHydratingExpiredPendingMessage;
|
|
}
|
|
if (prop) {
|
|
prop = message.state === constants2.SEND_FAILED;
|
|
}
|
|
if (prop) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let id;
|
|
if (currentUser != null) {
|
|
id = currentUser.id;
|
|
}
|
|
const author = message.author;
|
|
let id1;
|
|
if (author != null) {
|
|
id1 = author.id;
|
|
}
|
|
prop = id === id1;
|
|
}
|
|
if (prop) {
|
|
const _setTimeout = setTimeout;
|
|
const timerId = setTimeout(() => {
|
|
handleMessageSendFailure({ channelId: message.channel_id, messageId: message.id, shouldNotify: true });
|
|
}, 3000);
|
|
}
|
|
}
|
|
const Constants = fn(1078);
|
|
({ InAppNotificationTypes: closure_7, MessageStates: closure_8 } = Constants);
|
|
const LocalNotificationTypes = fn(9315).LocalNotificationTypes;
|
|
const prototype = function MessageSendFailureNotificationManager() {
|
|
const applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
applyArgumentsResult.actions = { MESSAGE_CREATE: handleMessageCreate, MESSAGE_SEND_FAILED: handleMessageSendFailure };
|
|
return applyArgumentsResult;
|
|
}.prototype;
|
|
class prototype extends tmp3 {
|
|
}
|
|
const prototype1 = new prototype();
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/messages/native/MessageSendFailureNotificationManager.tsx");
|
|
|
|
export default prototype1;
|