165 lines
9.1 KiB
TypeScript
165 lines
9.1 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] */
|
|
import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import SelectedChannelStore from '../../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import SelectedGuildStore from '../../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */
|
|
import AppStateStore from '../../../stores/native/AppStateStore.tsx'; /* Metro dependency 7030 */
|
|
import InAppNotificationActionCreators from '../../../actions/native/InAppNotificationActionCreators.tsx'; /* Metro dependency 10920 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as ConstantsModule2 from '../../local_push_notification/native/Constants.tsx'; /* Metro dependency 12560 */
|
|
|
|
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});
|
|
let value = ConstantsModule;
|
|
const env0_12 = value.InAppNotificationTypes;
|
|
const env0_13 = value.MessageStates;
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun124884(value);
|
|
value = new value();
|
|
(FileImportTrackerModule).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 guildId;
|
|
var selectedChannelStoreBinding;
|
|
var defaultImport;
|
|
var enqueueNotification;
|
|
var object;
|
|
var defaultImport2;
|
|
var presentLocalNotification;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).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;
|
|
object = {category: 'local'};
|
|
object.alertTitle = intl.string(t.LdlH2M);
|
|
object.alertBody = intl.string(t.xxRPOT);
|
|
object.userInfo = {channelId: channelId, messageId: messageId,
|
|
type: LocalNotificationTypes.MESSAGE_SEND_FAILED};
|
|
Reflect.apply(presentLocalNotification, defaultImport2, [object]);
|
|
return undefined;
|
|
}
|
|
guildId = SelectedGuildStore.getGuildId();
|
|
selectedChannelStoreBinding = SelectedChannelStore;
|
|
if (channelId === selectedChannelStoreBinding.getChannelId(guildId)) {
|
|
return undefined;
|
|
}
|
|
defaultImport = importDefault(10920) /* metro dependency 10920: InAppNotificationActionCreators */;
|
|
enqueueNotification = defaultImport.enqueueNotification;
|
|
object = {};
|
|
object.type = InAppNotificationTypes.MESSAGE_FAILED_TO_SEND;
|
|
object.channelId = channelId;
|
|
object.messageId = messageId;
|
|
object.key = channelId + '-' + messageId;
|
|
object.duration = 5000;
|
|
object.onDismiss = onDismiss_124881;
|
|
object.inAppNotificationId = (require(10921) /* metro dependency 10921: InAppNotificationUtils */).generateInAppNotificationId();
|
|
Reflect.apply(enqueueNotification, defaultImport, [object]);
|
|
}
|
|
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__;
|
|
(InAppNotificationActionCreators).clearNotification();
|
|
}
|
|
|
|
}
|
|
|
|
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 MessageSendFailureNotificationManager2 = MessageSendFailureNotificationManager;
|
|
Inherits(MessageSendFailureNotificationManager2, a0);
|
|
return CreateClass(MessageSendFailureNotificationManager2);
|
|
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 items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(MessageSendFailureNotificationManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_124877()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.actions = {MESSAGE_CREATE: handleMessageCreate_124882, MESSAGE_SEND_FAILED: handleMessageSendFailure};
|
|
return value;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun124876, 16154, [7, 6, 15, 17, 18, 1934, 3969, 1878, 7030, 661, 12560, 10920, 10921, 10741, 1244,
|
|
4860,
|
|
2]) /* metro module 16154, dependencies: [7, 6, 15, 17, 18, 1934, 3969, 1878, 7030, 661, 12560, 10920, 10921, 10741, 1244, 4860, 2] */;
|