Files
discord-decomp/sources/modules/messages/native/MessageSendFailureNotificationManager.tsx
T
2026-07-27 16:20:00 +03:00

153 lines
7.5 KiB
TypeScript

/* Metro module 16154; source: modules/messages/native/MessageSendFailureNotificationManager.tsx; dependencies: [7, 6, 15, 17, 18, 1934, 3969, 1878, 7030, 661, 12560, 10920, 10921, 10741, 1244, 4860, 2] */
function _fun124876(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#124876, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16362:6, offset: 0x025c6084, size: 370 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const appStateStore = importDefault(7030) /* metro dependency 7030: AppStateStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_12 = value.InAppNotificationTypes;
const env0_13 = value.MessageStates;
const env0_14 = (require(12560) /* metro dependency 12560: Constants */).LocalNotificationTypes;
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun124884(value);
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/messages/native/MessageSendFailureNotificationManager.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_124877() { // fn#124877, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16362:277, offset: 0x025c61f6, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_124877_isNativeReflectConstruct = function() {
return !!result;
})();
}
function handleMessageSendFailure(a0) { // fn#124880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16362:470, offset: 0x025c6258, size: 407 bytes, params: 2, frame: 21
var defaultImport;
var enqueueNotification;
var object2;
var defaultImport2;
var presentLocalNotification;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const channelId = a0.channelId;
const messageId = a0.messageId;
if (a0.shouldNotify) {
if (AppStateStore.getState() !== 'active') {
defaultImport2 = importDefault(10741) /* metro dependency 10741: PushNotification */;
presentLocalNotification = defaultImport2.presentLocalNotification;
object2 = {category: 'local'};
object2.alertTitle = intl.string(t.LdlH2M);
object2.alertBody = intl.string(t.xxRPOT);
object2.userInfo = {channelId: channelId, messageId: messageId,
type: LocalNotificationTypes.MESSAGE_SEND_FAILED};
Reflect.apply(presentLocalNotification, defaultImport2, [object2]);
return undefined;
}
if (channelId === SelectedChannelStore.getChannelId(SelectedGuildStore.getGuildId())) {
return undefined;
}
defaultImport = importDefault(10920) /* metro dependency 10920: InAppNotificationActionCreators */;
enqueueNotification = defaultImport.enqueueNotification;
object2 = {};
object2.type = InAppNotificationTypes.MESSAGE_FAILED_TO_SEND;
object2.channelId = channelId;
object2.messageId = messageId;
object2.key = channelId + '-' + messageId;
object2.duration = 5000;
object2.onDismiss = onDismiss_124881;
object2.inAppNotificationId = (require(10921) /* metro dependency 10921: InAppNotificationUtils */).generateInAppNotificationId();
Reflect.apply(enqueueNotification, defaultImport, [object2]);
}
}
function handleMessageCreate_124882({message, sendMessageOptions}) { // fn#124882, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16362:1069, offset: 0x025c6414, size: 153 bytes, params: 2, frame: 17
var id;
var value2;
var author;
let value = sendMessageOptions != null;
let r1 = value && sendMessageOptions.isHydratingExpiredPendingMessage && message.state === MessageStates.SEND_FAILED;
if (r1) {
value = UserStore.getCurrentUser();
value2 = undefined;
id = value == null ? value2 : value.id;
author = message.author;
value = id === (author == null ? value2 : author.id);
r1 = value;
}
if (r1) {
global.setTimeout(function() {
var handleMessageSendFailureBinding = handleMessageSendFailure;
var messageBinding = message;
handleMessageSendFailureBinding({channelId: messageBinding.channel_id, messageId: messageBinding.id,
shouldNotify: true});
}, 3000);
}
}
function _fun124884(a0) { // fn#124884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16362:1405, offset: 0x025c64df, size: 42 bytes, params: 2, frame: 14
const closure = MessageSendFailureNotificationManager;
env0_7(closure, a0);
return env0_3(closure);
}
function handleMessageSendFailureOnDismiss() { // fn#124881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16362:972, owner: handleMessageSendFailure.onDismiss, offset: 0x025c63ef, size: 37 bytes, params: 1, frame: 11
const value = environment.__proto__;
(importDefault(10920) /* metro dependency 10920: InAppNotificationActionCreators */).clearNotification();
}
function MessageSendFailureNotificationManager(a0) { // fn#124885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16362:1417, offset: 0x025c6509, size: 152 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_4;
binding(this, MessageSendFailureNotificationManager);
const items = [];
arraySpread(items, value, 0, items);
value = env1_6(MessageSendFailureNotificationManager);
binding = env1_5;
if (_isNativeReflectConstruct_124877()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items);
r0 = value;
}
value = binding(this, r0);
value.actions = {MESSAGE_CREATE: handleMessageCreate_124882, MESSAGE_SEND_FAILED: handleMessageSendFailure};
return value;
}