826 lines
41 KiB
TypeScript
826 lines
41 KiB
TypeScript
/* Metro module 9597; source: modules/messages/MessageManager.tsx; dependencies: [6, 7, 15, 17, 18, 4257, 1383, 4791, 1379, 1867, 4605, 1934, 3969, 661, 1386, 672, 3, 4816, 9598, 4044, 8876, 7067, 9599, 587, 3974, 1230, 4793, 4647, 1244, 694, 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 ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import SelectedGuildStore from '../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */
|
|
import GatewayConnectionStore from '../gateway/GatewayConnectionStore.tsx'; /* Metro dependency 4257 */
|
|
import ReadStateStore from '../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
|
|
import ChannelSectionStore from '../../stores/ChannelSectionStore.tsx'; /* Metro dependency 4791 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as StorageModule from '../../external/discord_common/js/packages/storage/Storage.tsx'; /* Metro dependency 587 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
|
|
import * as ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */
|
|
import * as ClientModule from '../../flow/Client.tsx'; /* Metro dependency 4044 */
|
|
|
|
function _fun75202(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#75202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:6, offset: 0x01da5e5a, size: 734 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const handleChannelSelect_75209 = function(a0) {
|
|
var guildId = a0.guildId;
|
|
var channelId = a0.channelId;
|
|
var messageId = a0.messageId;
|
|
var jumpType = a0.jumpType;
|
|
if (a0.skipMessageFetch) {
|
|
return false;
|
|
}
|
|
fetchMessages_75206({guildId: guildId, channelId: channelId, messageId: messageId, jumpType: jumpType});
|
|
maybeLoadChannelSplitView(guildId, channelId);
|
|
};
|
|
const handleVoiceChannelSelect = function({guildId, channelId}) {
|
|
fetchMessages_75206({guildId: guildId, channelId: channelId});
|
|
};
|
|
const handleJumpToVoiceChannelMessage = function({guildId, channelId, messageId, jumpType}) {
|
|
fetchMessages_75206({guildId: guildId, channelId: channelId, messageId: messageId, jumpType: jumpType});
|
|
};
|
|
const maybeLoadChannelSplitView = function(a0, a1) {
|
|
var fetchMessages_75206Binding;
|
|
var object;
|
|
var value2 = ChannelSectionStore.getCurrentSidebarChannelId(a1);
|
|
if (value2 != null) {
|
|
fetchMessages_75206Binding = fetchMessages_75206;
|
|
object = {guildId: a0, channelId: value2};
|
|
object.messageId = ChannelSectionStore.getCurrentSidebarMessageId(a1);
|
|
fetchMessages_75206Binding(object);
|
|
}
|
|
};
|
|
const handleChannelSectionStoreChange = function() {
|
|
var value2 = SelectedChannelStore.getChannelId();
|
|
var value3 = SelectedGuildStore.getGuildId();
|
|
if (value3 != null) {
|
|
if (value2 != null) {
|
|
if (ChannelSectionStore.getSidebarState(value2)?.type !== require(dependencyMap[26]).SidebarType.VIEW_CHANNEL) {
|
|
maybeLoadChannelSplitView(value3, value2);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const handleChannelPreload = function({guildId, channelId, context}) {
|
|
if (context === CURRENT_APP_CONTEXT) {
|
|
fetchMessages_75206({guildId: guildId, channelId: channelId});
|
|
maybeLoadChannelSplitView(guildId, channelId);
|
|
}
|
|
};
|
|
const handleAppWillBecomeActive = function() {
|
|
var value2 = SelectedChannelStore.getChannelId();
|
|
if (value2 == null) {
|
|
return false;
|
|
}
|
|
importDefault(dependencyMap[21]).fetchNewLocalMessages(value2, MAX_MESSAGES_PER_CHANNEL);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ConstantsModule;
|
|
const env0_16 = value.MAX_MESSAGES_PER_CHANNEL;
|
|
const env0_17 = value.CURRENT_APP_CONTEXT;
|
|
const env0_18 = value.ChannelTypes;
|
|
const env0_19 = value.AbortCodes;
|
|
const env0_20 = value.Routes;
|
|
const env0_21 = value.ChannelTypesSets;
|
|
let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const SECOND = Millis.SECOND;
|
|
const env0_23 = 10 * SECOND;
|
|
value = importDefault(3) /* metro dependency 3: Logger */;
|
|
value = new value('MessageManager');
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const DAY = Millis.DAY;
|
|
const env0_26 = 90 * DAY;
|
|
const env0_28 = {};
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun75220(value);
|
|
value = new value();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/messages/MessageManager.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_75203() { // fn#75203, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:405, offset: 0x01da6138, 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_75203_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function fetchMessages_75206({guildId, channelId, messageId, forceFetch, isPreload, jumpType, skipLocalFetch, avoidInitialScroll, fetchKey}) { // fn#75206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:664, offset: 0x01da619a, size: 1598 bytes, params: 2, frame: 31
|
|
var type;
|
|
var r17;
|
|
var r1;
|
|
var r16;
|
|
var r8;
|
|
var r13;
|
|
var r10;
|
|
var r15;
|
|
var value;
|
|
var isStaticChannelRouteBinding;
|
|
var value2;
|
|
var channelStoreBinding;
|
|
var getChannel;
|
|
var value3;
|
|
var GUILD_STORE;
|
|
var GUILD_THREADS_ONLY;
|
|
var has;
|
|
var defaultImport;
|
|
var getOrCreate;
|
|
var value4;
|
|
var some;
|
|
var messageHasExpiredAttachmentUrl;
|
|
var binding;
|
|
var log;
|
|
var defaultImport2;
|
|
var clear;
|
|
var defaultImport3;
|
|
var value5;
|
|
var jumpTargetId;
|
|
var value6;
|
|
var value7;
|
|
var mutate;
|
|
var object;
|
|
const JumpTypes = (ClientModule).JumpTypes;
|
|
var ANIMATED;
|
|
var value8;
|
|
var defaultImport4;
|
|
var commit;
|
|
var focusTargetId;
|
|
var value9;
|
|
var value10;
|
|
var value11;
|
|
var defaultImport5;
|
|
var gatewayConnectionStoreBinding;
|
|
var isConnected;
|
|
var loadingMore;
|
|
var value12;
|
|
var ready;
|
|
var cached;
|
|
var value13;
|
|
var guildStoreBinding;
|
|
var getGuild;
|
|
var value14;
|
|
var value15;
|
|
var value16;
|
|
var value17;
|
|
var readStateStoreBinding;
|
|
var hasUnread;
|
|
var hasUnread2;
|
|
var value18;
|
|
var defaultImport6;
|
|
var value19;
|
|
var jumpToMessage;
|
|
var isThread;
|
|
var hasOpenedThread;
|
|
var hasOpenedThread2;
|
|
var value20;
|
|
const Storage = (StorageModule).Storage;
|
|
var get;
|
|
var value21;
|
|
var Date;
|
|
var now;
|
|
var value22;
|
|
var value23;
|
|
var properties;
|
|
var properties2;
|
|
var properties3;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var set;
|
|
var hasTrackedUnread;
|
|
var id;
|
|
var getTrackedAckMessageId;
|
|
var value24;
|
|
var concat;
|
|
var defaultImport7;
|
|
var fetchMessages;
|
|
var getMessageLimit;
|
|
var defaultImport8;
|
|
var defaultImport9;
|
|
if (channelId != null) {
|
|
value = environment;
|
|
isStaticChannelRouteBinding = isStaticChannelRoute;
|
|
value2 = undefined;
|
|
reducibleJoin59: while (true) {
|
|
if (isStaticChannelRouteBinding(channelId)) {
|
|
break reducibleJoin59;
|
|
}
|
|
channelStoreBinding = ChannelStore;
|
|
getChannel = channelStoreBinding.getChannel;
|
|
value3 = Reflect.apply(getChannel, channelStoreBinding, [channelId]);
|
|
reducibleJoin4: while (true) {
|
|
if (value3 == null) {
|
|
type = value2;
|
|
break reducibleJoin4;
|
|
}
|
|
type = value3.type;
|
|
break reducibleJoin4;
|
|
}
|
|
GUILD_STORE = ChannelTypes.GUILD_STORE;
|
|
if (type === GUILD_STORE) {
|
|
break reducibleJoin59;
|
|
}
|
|
reducibleJoin7: while (true) {
|
|
if (value3 == null) {
|
|
type = value2;
|
|
break reducibleJoin7;
|
|
}
|
|
type = value3.type;
|
|
break reducibleJoin7;
|
|
}
|
|
if (type != null) {
|
|
GUILD_THREADS_ONLY = ChannelTypesSets.GUILD_THREADS_ONLY;
|
|
has = GUILD_THREADS_ONLY.has;
|
|
type = value3.type;
|
|
reducibleJoin9: while (true) {
|
|
if (Reflect.apply(has, GUILD_THREADS_ONLY, [type])) {
|
|
break reducibleJoin59;
|
|
}
|
|
break reducibleJoin9;
|
|
}
|
|
}
|
|
defaultImport = importDefault(4816) /* metro dependency 4816: ChannelMessages */;
|
|
getOrCreate = defaultImport.getOrCreate;
|
|
value4 = Reflect.apply(getOrCreate, defaultImport, [channelId]);
|
|
some = value4.some;
|
|
messageHasExpiredAttachmentUrl = (require(9598) /* metro dependency 9598: SignedAttachmentLinkUtils */).messageHasExpiredAttachmentUrl;
|
|
reducibleJoin11: while (true) {
|
|
if (Reflect.apply(some, value4, [messageHasExpiredAttachmentUrl])) {
|
|
binding = env0_24;
|
|
log = binding.log;
|
|
Reflect.apply(log, binding, ['Found expired attachment link, clearing messages']);
|
|
defaultImport2 = importDefault(4816) /* metro dependency 4816: ChannelMessages */;
|
|
clear = defaultImport2.clear;
|
|
Reflect.apply(clear, defaultImport2, [channelId]);
|
|
defaultImport3 = importDefault(4816) /* metro dependency 4816: ChannelMessages */;
|
|
getOrCreate = defaultImport3.getOrCreate;
|
|
value5 = Reflect.apply(getOrCreate, defaultImport3, [channelId]);
|
|
r17 = value5;
|
|
break reducibleJoin11;
|
|
}
|
|
r17 = value4;
|
|
break reducibleJoin11;
|
|
}
|
|
jumpTargetId = r17.jumpTargetId;
|
|
value6 = jumpTargetId != null;
|
|
reducibleJoin13: while (true) {
|
|
if (value6) {
|
|
value7 = messageId == null;
|
|
r1 = value7;
|
|
break reducibleJoin13;
|
|
}
|
|
r1 = value6;
|
|
break reducibleJoin13;
|
|
}
|
|
reducibleJoin15: while (true) {
|
|
if (r1) {
|
|
mutate = r17.mutate;
|
|
ANIMATED = JumpTypes.ANIMATED;
|
|
value8 = Reflect.apply(mutate, r17, [{'jumpTargetId': null, 'jumped': false, jumpType: ANIMATED}]);
|
|
defaultImport4 = importDefault(4816) /* metro dependency 4816: ChannelMessages */;
|
|
commit = defaultImport4.commit;
|
|
Reflect.apply(commit, defaultImport4, [value8]);
|
|
r16 = value8;
|
|
break reducibleJoin15;
|
|
}
|
|
r16 = r17;
|
|
break reducibleJoin15;
|
|
}
|
|
focusTargetId = r16.focusTargetId;
|
|
value9 = focusTargetId != null;
|
|
reducibleJoin17: while (true) {
|
|
if (value9) {
|
|
value10 = messageId == null;
|
|
r8 = value10;
|
|
break reducibleJoin17;
|
|
}
|
|
r8 = value9;
|
|
break reducibleJoin17;
|
|
}
|
|
reducibleJoin19: while (true) {
|
|
if (r8) {
|
|
mutate = r16.mutate;
|
|
value11 = Reflect.apply(mutate, r16, [{focusTargetId: null}]);
|
|
defaultImport5 = importDefault(4816) /* metro dependency 4816: ChannelMessages */;
|
|
commit = defaultImport5.commit;
|
|
Reflect.apply(commit, defaultImport5, [value11]);
|
|
r1 = value11;
|
|
break reducibleJoin19;
|
|
}
|
|
r1 = r16;
|
|
break reducibleJoin19;
|
|
}
|
|
reducibleJoin31: while (true) {
|
|
reducibleJoin29: while (true) {
|
|
if (isPreload) {
|
|
gatewayConnectionStoreBinding = GatewayConnectionStore;
|
|
isConnected = gatewayConnectionStoreBinding.isConnected;
|
|
if (!Reflect.apply(isConnected, gatewayConnectionStoreBinding, [])) {
|
|
loadingMore = r1.loadingMore;
|
|
value12 = true;
|
|
if (!loadingMore) {
|
|
r8 = value12;
|
|
break reducibleJoin31;
|
|
}
|
|
}
|
|
loadingMore = r1.loadingMore;
|
|
if (loadingMore) {
|
|
break reducibleJoin29;
|
|
}
|
|
if (r1.ready) {
|
|
cached = r1.cached;
|
|
if (!cached) {
|
|
break reducibleJoin29;
|
|
}
|
|
}
|
|
value13 = guildId != null;
|
|
reducibleJoin27: while (true) {
|
|
if (value13) {
|
|
guildStoreBinding = GuildStore;
|
|
getGuild = guildStoreBinding.getGuild;
|
|
value14 = Reflect.apply(getGuild, guildStoreBinding, [guildId]) == null;
|
|
r13 = value14;
|
|
break reducibleJoin27;
|
|
}
|
|
r13 = value13;
|
|
break reducibleJoin27;
|
|
}
|
|
if (r13) {
|
|
r8 = forceFetch;
|
|
break reducibleJoin31;
|
|
}
|
|
r8 = true;
|
|
break reducibleJoin31;
|
|
}
|
|
loadingMore = r1.loadingMore;
|
|
if (loadingMore) {
|
|
break reducibleJoin29;
|
|
}
|
|
ready = r1.ready;
|
|
if (ready) {
|
|
cached = r1.cached;
|
|
if (!cached) {
|
|
break reducibleJoin29;
|
|
}
|
|
}
|
|
value13 = guildId != null;
|
|
reducibleJoin27: while (true) {
|
|
if (value13) {
|
|
guildStoreBinding = GuildStore;
|
|
getGuild = guildStoreBinding.getGuild;
|
|
value14 = Reflect.apply(getGuild, guildStoreBinding, [guildId]) == null;
|
|
r13 = value14;
|
|
break reducibleJoin27;
|
|
}
|
|
r13 = value13;
|
|
break reducibleJoin27;
|
|
}
|
|
if (r13) {
|
|
r8 = forceFetch;
|
|
break reducibleJoin31;
|
|
}
|
|
value15 = true;
|
|
r8 = value15;
|
|
break reducibleJoin31;
|
|
}
|
|
if (messageId == null) {
|
|
r8 = forceFetch;
|
|
break reducibleJoin31;
|
|
}
|
|
value16 = true;
|
|
r8 = value16;
|
|
break reducibleJoin31;
|
|
}
|
|
value17 = (importDefault(8876) /* metro dependency 8876: isChangelogChannel */)(channelId);
|
|
reducibleJoin33: while (true) {
|
|
if (value17) {
|
|
readStateStoreBinding = ReadStateStore;
|
|
hasUnread = readStateStoreBinding.hasUnread;
|
|
hasUnread2 = Reflect.apply(hasUnread, readStateStoreBinding, [channelId]);
|
|
r10 = hasUnread2;
|
|
break reducibleJoin33;
|
|
}
|
|
r10 = value17;
|
|
break reducibleJoin33;
|
|
}
|
|
reducibleJoin35: while (true) {
|
|
if (r10) {
|
|
value18 = true;
|
|
r8 = value18;
|
|
break reducibleJoin35;
|
|
}
|
|
break reducibleJoin35;
|
|
}
|
|
if (r8) {
|
|
defaultImport6 = importDefault(4816) /* metro dependency 4816: ChannelMessages */;
|
|
commit = defaultImport6.commit;
|
|
mutate = r1.mutate;
|
|
object = {};
|
|
value19 = true;
|
|
object.loadingMore = value19;
|
|
Reflect.apply(commit, defaultImport6, [Reflect.apply(mutate, r1, [object])]);
|
|
if (messageId == null) {
|
|
if (value3 != null) {
|
|
isThread = value3.isThread;
|
|
reducibleJoin52: while (true) {
|
|
if (Reflect.apply(isThread, value3, [])) {
|
|
readStateStoreBinding = ReadStateStore;
|
|
hasOpenedThread = readStateStoreBinding.hasOpenedThread;
|
|
hasOpenedThread2 = Reflect.apply(hasOpenedThread, readStateStoreBinding, [channelId]);
|
|
value20 = false;
|
|
reducibleJoin51: while (true) {
|
|
if (hasOpenedThread2) {
|
|
r10 = value20;
|
|
break reducibleJoin51;
|
|
}
|
|
reducibleJoin45: while (true) {
|
|
if (env0_25 != null) {
|
|
break reducibleJoin45;
|
|
}
|
|
get = Storage.get;
|
|
binding = env0_27;
|
|
value21 = Reflect.apply(get, Storage, [binding, {}]);
|
|
reducibleJoin44: while (true) {
|
|
if (value21 != null) {
|
|
r13 = value21;
|
|
break reducibleJoin44;
|
|
}
|
|
r13 = {};
|
|
break reducibleJoin44;
|
|
}
|
|
env0_25 = r13;
|
|
break reducibleJoin45;
|
|
}
|
|
if (channelId in env0_25) {
|
|
r10 = value20;
|
|
break reducibleJoin51;
|
|
}
|
|
binding = env0_25;
|
|
Date = global.Date;
|
|
now = Date.now;
|
|
binding[channelId] = Reflect.apply(now, Date, []);
|
|
Date = global.Date;
|
|
now = Date.now;
|
|
value22 = Reflect.apply(now, Date, []);
|
|
value23 = value22 - env0_26;
|
|
binding = env0_25;
|
|
properties = Object.keys(binding);
|
|
properties2 = 0;
|
|
properties3 = properties.length;
|
|
if (properties !== value2) {
|
|
r15 = properties2;
|
|
reducibleLoop47: while (true) {
|
|
propertyName = properties[r15];
|
|
propertyName2 = r15 + 1;
|
|
if (propertyName === value2) {
|
|
break reducibleLoop47;
|
|
}
|
|
if (env0_25[propertyName] < value23) {
|
|
delete env0_25[propertyName];
|
|
r15 = propertyName2;
|
|
continue reducibleLoop47;
|
|
}
|
|
r15 = propertyName2;
|
|
continue reducibleLoop47;
|
|
}
|
|
}
|
|
set = Storage.set;
|
|
binding = env0_27;
|
|
Reflect.apply(set, Storage, [binding, env0_25]);
|
|
r10 = value19;
|
|
break reducibleJoin51;
|
|
}
|
|
if (r10) {
|
|
binding = env0_24;
|
|
log = binding.log;
|
|
id = value3.id;
|
|
concat = global.HermesInternal.concat;
|
|
Reflect.apply(log, binding, ['Jumping to start of thread ' + id]);
|
|
defaultImport9 = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
fetchMessages = defaultImport9.fetchMessages;
|
|
object = {channelId: channelId};
|
|
value = require(9599) /* metro dependency 9599: getAdaptiveMessageLimitNative */;
|
|
object.limit = value.getMessageLimit('MessageManager.threadStart');
|
|
object.jump = {messageId: channelId, flash: value20};
|
|
object.isPreload = isPreload;
|
|
object.skipLocalFetch = skipLocalFetch;
|
|
object.avoidInitialScroll = avoidInitialScroll;
|
|
object.fetchKey = fetchKey;
|
|
return Reflect.apply(fetchMessages, defaultImport9, [object]);
|
|
}
|
|
break reducibleJoin52;
|
|
}
|
|
break reducibleJoin52;
|
|
}
|
|
}
|
|
if (value3 != null) {
|
|
isThread = value3.isThread;
|
|
reducibleJoin57: while (true) {
|
|
if (Reflect.apply(isThread, value3, [])) {
|
|
hasTrackedUnread = ReadStateStore.hasTrackedUnread;
|
|
id = value3.id;
|
|
if (Reflect.apply(hasTrackedUnread, readStateStoreBinding, [id])) {
|
|
ready = r1.ready;
|
|
if (!ready) {
|
|
readStateStoreBinding = ReadStateStore;
|
|
getTrackedAckMessageId = readStateStoreBinding.getTrackedAckMessageId;
|
|
id = value3.id;
|
|
value24 = Reflect.apply(getTrackedAckMessageId, readStateStoreBinding, [id]);
|
|
binding = env0_24;
|
|
log = binding.log;
|
|
id = value3.id;
|
|
concat = global.HermesInternal.concat;
|
|
Reflect.apply(log, binding,
|
|
['Jumping to most recent message in thread ' + id + ' - ' + value24]);
|
|
defaultImport7 = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
fetchMessages = defaultImport7.fetchMessages;
|
|
object = {channelId: channelId};
|
|
value = require(9599) /* metro dependency 9599: getAdaptiveMessageLimitNative */;
|
|
object.limit = value.getMessageLimit('MessageManager.threadUnread');
|
|
object.jump = {'messageId': null, 'flash': false, 'offset': 1,
|
|
messageId: value24};
|
|
object.isPreload = isPreload;
|
|
object.skipLocalFetch = skipLocalFetch;
|
|
object.avoidInitialScroll = avoidInitialScroll;
|
|
object.fetchKey = fetchKey;
|
|
return Reflect.apply(fetchMessages, defaultImport7, [object]);
|
|
}
|
|
break reducibleJoin57;
|
|
}
|
|
break reducibleJoin57;
|
|
}
|
|
break reducibleJoin57;
|
|
}
|
|
}
|
|
defaultImport8 = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
fetchMessages = defaultImport8.fetchMessages;
|
|
object = {channelId: channelId};
|
|
value = require(9599) /* metro dependency 9599: getAdaptiveMessageLimitNative */;
|
|
getMessageLimit = value.getMessageLimit;
|
|
object.limit = Reflect.apply(getMessageLimit, value, ['MessageManager.initialFetch']);
|
|
object.isPreload = isPreload;
|
|
object.skipLocalFetch = skipLocalFetch;
|
|
ANIMATED = JumpTypes.ANIMATED;
|
|
object.jump = {jumpType: ANIMATED};
|
|
object.avoidInitialScroll = avoidInitialScroll;
|
|
object.fetchKey = fetchKey;
|
|
return Reflect.apply(fetchMessages, defaultImport8, [object]);
|
|
}
|
|
value = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
jumpToMessage = value.jumpToMessage;
|
|
Reflect.apply(jumpToMessage, value, [{channelId: channelId, messageId: messageId, flash: value19,
|
|
isPreload: isPreload, skipLocalFetch: skipLocalFetch, jumpType: jumpType,
|
|
avoidInitialScroll: avoidInitialScroll}]);
|
|
break reducibleJoin59;
|
|
}
|
|
break reducibleJoin59;
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleConnectionOpen_75207() { // fn#75207, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:2873, offset: 0x01da67d8, size: 293 bytes, params: 1, frame: 24
|
|
var channel;
|
|
var id;
|
|
var value4;
|
|
var moduleValue;
|
|
var matchPath;
|
|
var moduleValue2;
|
|
var pathname;
|
|
var object;
|
|
var value5;
|
|
var fetchMessages_75206Binding;
|
|
var object2;
|
|
var messageId;
|
|
var maybeLoadChannelSplitViewBinding;
|
|
var guildId;
|
|
const channelId = SelectedChannelStore.getChannelId();
|
|
if (channelId != null) {
|
|
channel = ChannelStore.getChannel(channelId);
|
|
if (channel != null) {
|
|
id = channel.id;
|
|
value4 = undefined;
|
|
moduleValue = require(3974) /* metro dependency 3974: matchPathCompat */;
|
|
matchPath = moduleValue.matchPath;
|
|
moduleValue2 = require(1230) /* metro dependency 1230: router_utils */;
|
|
pathname = moduleValue2.getHistory().location.pathname;
|
|
object = {};
|
|
object.path = Routes.CHANNEL(':guild', ':channel', ':message');
|
|
object.exact = true;
|
|
value5 = Reflect.apply(matchPath, moduleValue, [pathname, object]);
|
|
object = {channelId: id};
|
|
object.messageId = value5 == null || value5.params == null ? value4 : value5.params.message;
|
|
fetchMessages_75206Binding = fetchMessages_75206;
|
|
object2 = {};
|
|
object2.guildId = channel.getGuildId();
|
|
id = channel.id;
|
|
object2.channelId = id;
|
|
messageId = object.messageId;
|
|
object2.messageId = messageId;
|
|
messageId = object.messageId;
|
|
object2.avoidInitialScroll = messageId != null;
|
|
fetchMessages_75206Binding(object2);
|
|
maybeLoadChannelSplitViewBinding = maybeLoadChannelSplitView;
|
|
guildId = channel.getGuildId();
|
|
id = channel.id;
|
|
maybeLoadChannelSplitViewBinding(guildId, id);
|
|
}
|
|
}
|
|
}
|
|
|
|
function loadSelectedChannelIfNecessary() { // fn#75208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:3386, offset: 0x01da68fd, size: 205 bytes, params: 1, frame: 16
|
|
var channel;
|
|
var orCreate;
|
|
var fetchMessages_75206Binding;
|
|
var object;
|
|
const channelId = SelectedChannelStore.getChannelId();
|
|
if (channelId != null) {
|
|
channel = ChannelStore.getChannel(channelId);
|
|
if (channel != null) {
|
|
if (isTextChannel(channel.type)) {
|
|
orCreate = (importDefault(4816) /* metro dependency 4816: ChannelMessages */).getOrCreate(channelId);
|
|
if (!(orCreate.ready && orCreate.hasFetched)) {
|
|
fetchMessages_75206Binding = fetchMessages_75206;
|
|
object = {};
|
|
object.guildId = channel.getGuildId();
|
|
object.channelId = channel.id;
|
|
fetchMessages_75206Binding(object);
|
|
}
|
|
maybeLoadChannelSplitView(channel.getGuildId(), channel.id);
|
|
} else {
|
|
maybeLoadChannelSplitView(channel.getGuildId(), channel.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleChannelCreate_75215({channel, messageId}) { // fn#75215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:4706, offset: 0x01da6b86, size: 94 bytes, params: 2, frame: 14
|
|
var r1;
|
|
const guild_id = channel.guild_id;
|
|
let value = guild_id != null;
|
|
if (value) {
|
|
value = SelectedChannelStore.getChannelId(guild_id);
|
|
value = value === channel.id;
|
|
r1 = value;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
if (r1) {
|
|
fetchMessages_75206({guildId: guild_id, channelId: channel.id, messageId: messageId});
|
|
}
|
|
}
|
|
|
|
function handleMessageEditEnd({response}) { // fn#75216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:4866, offset: 0x01da6be4, size: 260 bytes, params: 2, frame: 21
|
|
var retry_after;
|
|
var defaultImport;
|
|
var show;
|
|
var object;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
var formatToPlainString;
|
|
var qoxdQB;
|
|
var object2;
|
|
if (response == null) {
|
|
return null;
|
|
}
|
|
if (response.body == null) {
|
|
return null;
|
|
}
|
|
const code = response.body.code;
|
|
const CHANNEL_FOLLOWING_EDIT_RATE_LIMITED = AbortCodes.CHANNEL_FOLLOWING_EDIT_RATE_LIMITED;
|
|
if (code === CHANNEL_FOLLOWING_EDIT_RATE_LIMITED) {
|
|
retry_after = response.body.retry_after;
|
|
if (retry_after != null) {
|
|
defaultImport = importDefault(4647) /* metro dependency 4647: AlertActionCreators */;
|
|
show = defaultImport.show;
|
|
object = {};
|
|
object.title = intl.string(t.Whhv4w);
|
|
formatToPlainString = intl.formatToPlainString;
|
|
qoxdQB = t.qoxdQB;
|
|
object2 = {};
|
|
object2.retryAfterMinutes = global.Math.ceil(retry_after / 60);
|
|
object.body = Reflect.apply(formatToPlainString, intl, [qoxdQB, object2]);
|
|
Reflect.apply(show, defaultImport, [object]);
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleLoadMessagesSuccess({channelId, jump, isStale, isPreview}) { // fn#75217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:5204, offset: 0x01da6ce8, size: 267 bytes, params: 2, frame: 17
|
|
var r7;
|
|
var r1;
|
|
var Date;
|
|
var binding;
|
|
var channelId2;
|
|
var currentSidebarChannelId;
|
|
var defaultImport;
|
|
var fetchMessages;
|
|
var object;
|
|
isPreview = !(isPreview === undefined) && isPreview;
|
|
if (!isPreview) {
|
|
r7 = env0_28[channelId] ?? 0;
|
|
Date = global.Date;
|
|
if (!(Date.now() - r7 < env0_23)) {
|
|
binding = env0_28;
|
|
Date = global.Date;
|
|
binding[channelId] = Date.now();
|
|
channelId2 = SelectedChannelStore.getChannelId();
|
|
currentSidebarChannelId = ChannelSectionStore.getCurrentSidebarChannelId(channelId2);
|
|
r1 = isStale && GatewayConnectionStore.isConnected();
|
|
r1 = r1 && (channelId === channelId2 || channelId === currentSidebarChannelId);
|
|
if (r1) {
|
|
defaultImport = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
fetchMessages = defaultImport.fetchMessages;
|
|
object = {channelId: channelId};
|
|
object.limit = (require(9599) /* metro dependency 9599: getAdaptiveMessageLimitNative */).getMessageLimit('MessageManager.staleFetch');
|
|
object.jump = jump;
|
|
Reflect.apply(fetchMessages, defaultImport, [object]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleUploadFail({channelId, messageId, reason, noSendFailed, shouldSendNotification}) { // fn#75218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:5562, offset: 0x01da6df3, size: 134 bytes, params: 2, frame: 17
|
|
if (messageId != null && noSendFailed !== true) {
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'MESSAGE_SEND_FAILED',
|
|
channelId: channelId, messageId: messageId, reason: reason ?? null,
|
|
shouldNotify: shouldSendNotification !== false});
|
|
}
|
|
}
|
|
|
|
function _fun75220(a0) { // fn#75220, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:5921, offset: 0x01da6ebc, size: 97 bytes, params: 2, frame: 16
|
|
const MessageManager2 = MessageManager;
|
|
Inherits(MessageManager2, a0);
|
|
return CreateClass(MessageManager2, [{key: '_initialize', value: function() {
|
|
importDefault(dependencyMap[29]).subscribe('CONNECTION_OPEN', handleConnectionOpen_75207);
|
|
}}, {key: '_terminate', value: function() {
|
|
importDefault(dependencyMap[29]).unsubscribe('CONNECTION_OPEN', handleConnectionOpen_75207);
|
|
}}]);
|
|
function MessageManager(a0) { // fn#75221, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9783:5933, offset: 0x01da6f1d, size: 358 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, MessageManager);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(MessageManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_75203()) {
|
|
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.fetchMessages = fetchMessages_75206;
|
|
value.loadSelectedChannelIfNecessary = loadSelectedChannelIfNecessary;
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
value.stores = map.set(ChannelSectionStore, handleChannelSectionStoreChange);
|
|
const handleChannelCreate_75215Binding = handleChannelCreate_75215;
|
|
value.actions = {APP_STATE_UPDATE_WILL_BECOME_ACTIVE: handleAppWillBecomeActive,
|
|
OVERLAY_INITIALIZE: handleConnectionOpen_75207, CHANNEL_SELECT: handleChannelSelect_75209,
|
|
VOICE_CHANNEL_SELECT: handleVoiceChannelSelect, THREAD_CREATE: handleChannelCreate_75215Binding,
|
|
THREAD_LIST_SYNC: function() {
|
|
loadSelectedChannelIfNecessary();
|
|
}, CHANNEL_CREATE: handleChannelCreate_75215Binding, CHANNEL_PRELOAD: handleChannelPreload,
|
|
GUILD_CREATE: function() {
|
|
loadSelectedChannelIfNecessary();
|
|
}, MESSAGE_END_EDIT: handleMessageEditEnd, LOAD_MESSAGES_SUCCESS: handleLoadMessagesSuccess,
|
|
UPLOAD_FAIL: handleUploadFail, CHANNEL_DELETE: function() {
|
|
loadSelectedChannelIfNecessary();
|
|
}, THREAD_DELETE: function() {
|
|
loadSelectedChannelIfNecessary();
|
|
}, CHANNEL_RTC_JUMP_TO_VOICE_CHANNEL_MESSAGE: handleJumpToVoiceChannelMessage};
|
|
return value;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun75202, 9597, [6, 7, 15, 17, 18, 4257, 1383, 4791, 1379, 1867, 4605, 1934, 3969, 661, 1386, 672, 3,
|
|
4816, 9598, 4044, 8876, 7067, 9599, 587, 3974, 1230, 4793, 4647, 1244, 694, 4860,
|
|
2]) /* metro module 9597, dependencies: [6, 7, 15, 17, 18, 4257, 1383, 4791, 1379, 1867, 4605, 1934, 3969, 661, 1386, 672, 3, 4816, 9598, 4044, 8876, 7067, 9599, 587, 3974, 1230, 4793, 4647, 1244, 694, 4860, 2] */;
|