325 lines
17 KiB
TypeScript
325 lines
17 KiB
TypeScript
/* Metro module 11169; source: stores/ChannelPinsStore.tsx; dependencies: [6, 7, 15, 17, 18, 1949, 1379, 1945, 1867, 4814, 3793, 1878, 4625, 22, 4821, 566, 694, 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 Module00022 from '../by-id/module-00022.js'; /* Metro dependency 22 */
|
|
import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import GuildStore from './GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import UserStore from './UserStore.tsx'; /* Metro dependency 1878 */
|
|
import GuildMemberStore from './GuildMemberStore.tsx'; /* Metro dependency 1945 */
|
|
import LocaleStore from '../modules/user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
|
|
import RelationshipStore from './RelationshipStore.tsx'; /* Metro dependency 3793 */
|
|
import MessageStore from './MessageStore.tsx'; /* Metro dependency 4814 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ExplicitMediaRedactionUtilsModule from '../modules/explicit_media_redaction/ExplicitMediaRedactionUtils.tsx'; /* Metro dependency 4821 */
|
|
|
|
function _fun85277(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#85277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:6, offset: 0x01f69f3d, size: 588 bytes, params: 8, frame: 22
|
|
const env0_0 = require;
|
|
const CHANNEL_DELETE_852812 = CHANNEL_DELETE_85281;
|
|
const RELATIONSHIP_ADD_852822 = RELATIONSHIP_ADD_85282;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let env0_16 = {};
|
|
const Store = (Flux).Store;
|
|
let value = _fun85285(Store);
|
|
value.displayName = 'ChannelPinsStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
|
|
env0_16 = {};
|
|
}, LOAD_PINNED_MESSAGES: LOAD_PINNED_MESSAGES, LOAD_PINNED_MESSAGES_SUCCESS: LOAD_PINNED_MESSAGES_SUCCESS_85291,
|
|
LOAD_PINNED_MESSAGES_FAILURE: LOAD_PINNED_MESSAGES_FAILURE, CHANNEL_DELETE: CHANNEL_DELETE_852812,
|
|
THREAD_DELETE: CHANNEL_DELETE_852812, GUILD_DELETE: GUILD_DELETE_85294, MESSAGE_DELETE: MESSAGE_DELETE_85296,
|
|
MESSAGE_DELETE_BULK: MESSAGE_DELETE_BULK_85298, MESSAGE_UPDATE: MESSAGE_UPDATE_85300,
|
|
RELATIONSHIP_ADD: RELATIONSHIP_ADD_852822, RELATIONSHIP_REMOVE: RELATIONSHIP_ADD_852822,
|
|
RELATIONSHIP_UPDATE: RELATIONSHIP_ADD_852822,
|
|
MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT: MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT_85304});
|
|
(FileImportTrackerModule).fileFinishedImporting('stores/ChannelPinsStore.tsx');
|
|
exports.default = value;
|
|
exports.FetchState = {LOADING: 'LOADING', LOADED_HAS_MORE: 'LOADED_HAS_MORE', LOADED_FINISHED: 'LOADING_FINISHED',
|
|
FAILED: 'FAILED'};
|
|
function _isNativeReflectConstruct_85278() { // fn#85278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:220, offset: 0x01f6a189, 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_85278_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function CHANNEL_DELETE_85281({channel}) { // fn#85281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:561, offset: 0x01f6a1eb, size: 28 bytes, params: 2, frame: 2
|
|
delete env0_16[channel.id];
|
|
}
|
|
|
|
function RELATIONSHIP_ADD_85282() { // fn#85282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:618, offset: 0x01f6a207, size: 51 bytes, params: 1, frame: 14
|
|
const defaultImport = Module00022;
|
|
defaultImport.forEach(env0_16, function(a0) {
|
|
a0.items.forEach(_fun85284);
|
|
a0.items = a0.items.slice();
|
|
});
|
|
function _fun85283(a0) { // fn#85283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:674, offset: 0x01f6a23a, size: 53 bytes, params: 2, frame: 12
|
|
let items2 = a0.items;
|
|
items2.forEach(_fun85284);
|
|
items2 = a0.items;
|
|
a0.items = items2.slice();
|
|
function _fun85284({message}) { // fn#85284, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:695, offset: 0x01f6a26f, size: 75 bytes, params: 2, frame: 14
|
|
const set = message.set;
|
|
const value = environment.__proto__.__proto__;
|
|
Reflect.apply(set, message, ['blocked', RelationshipStore.isBlockedForMessage(message)]);
|
|
message.set('ignored', RelationshipStore.isIgnoredForMessage(message));
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _fun85285(a0) { // fn#85285, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:831, offset: 0x01f6a2ba, size: 97 bytes, params: 2, frame: 16
|
|
const ChannelPinsStore2 = ChannelPinsStore;
|
|
Inherits(ChannelPinsStore2, a0);
|
|
return CreateClass(ChannelPinsStore2, [{key: 'initialize', value: function() {
|
|
this.waitFor(ChannelStore, GuildMemberStore, GuildStore, LocaleStore, MessageStore, RelationshipStore,
|
|
UserStore);
|
|
}}, {key: 'getPins', value: value_85288}]);
|
|
function ChannelPinsStore() { // fn#85286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:843, offset: 0x01100674, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_3(this, ChannelPinsStore);
|
|
const value3 = env1_6(ChannelPinsStore);
|
|
return env1_5(this, _isNativeReflectConstruct_85278() ? global.Reflect.construct(value3, arguments,
|
|
env1_6(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_85288(a0) { // fn#85288, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1203, offset: 0x00df0ead, size: 16 bytes, params: 2, frame: 2
|
|
return env1_16[a0];
|
|
}
|
|
|
|
}
|
|
|
|
function LOAD_PINNED_MESSAGES(a0) { // fn#85290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1378, offset: 0x01f6a34e, size: 155 bytes, params: 2, frame: 15
|
|
var channel;
|
|
var value3;
|
|
const channelId = a0.channelId;
|
|
if (a0.reset) {
|
|
channel = ChannelStore.getChannel(channelId);
|
|
value3 = undefined;
|
|
env0_16[channelId] = {id: channelId, items: [], state: env0_15.LOADING,
|
|
guildId: (channel == null ? value3 : channel.getGuildId()) ?? value3};
|
|
} else if (env0_16[channelId] == null) {
|
|
channel = ChannelStore.getChannel(channelId);
|
|
value3 = undefined;
|
|
env0_16[channelId] = {id: channelId, items: [], state: env0_15.LOADING,
|
|
guildId: (channel == null ? value3 : channel.getGuildId()) ?? value3};
|
|
} else {
|
|
env0_16[channelId].state = env0_15.LOADING;
|
|
}
|
|
}
|
|
|
|
function LOAD_PINNED_MESSAGES_SUCCESS_85291({channelId, pins, hasMore}) { // fn#85291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1628, offset: 0x01f6a3e9, size: 126 bytes, params: 2, frame: 17
|
|
const property = env0_16[channelId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const value2 = pins.map(_fun85292);
|
|
const items3 = property.items;
|
|
const items2 = [];
|
|
arraySpread(items2, value2, arraySpread(items2, items3, 0, undefined), undefined);
|
|
property.items = items2;
|
|
const binding = env0_15;
|
|
property.state = hasMore ? binding.LOADED_HAS_MORE : binding.LOADED_FINISHED;
|
|
function _fun85292({pinned_at, message}) { // fn#85292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1731, offset: 0x01f6a467, size: 110 bytes, params: 2, frame: 14
|
|
const object = {};
|
|
const Date = global.Date;
|
|
const Date2 = global.Date;
|
|
let value = Date2.parse(pinned_at);
|
|
const value2 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
const date = new Date(value);
|
|
object.pinnedAt = date instanceof Object ? date : value2;
|
|
value = environment.__proto__;
|
|
object.message = (require(4625) /* metro dependency 4625: MessageRecordUtils */).createMessageRecord(message);
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
function LOAD_PINNED_MESSAGES_FAILURE({channelId}) { // fn#85293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:1939, offset: 0x01f6a4d5, size: 49 bytes, params: 2, frame: 3
|
|
const property = env0_16[channelId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const FAILED = env0_15.FAILED;
|
|
property.state = FAILED;
|
|
}
|
|
|
|
function GUILD_DELETE_85294({guild}) { // fn#85294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2109, offset: 0x01f6a506, size: 95 bytes, params: 2, frame: 13
|
|
env0_16 = (importDefault(22) /* metro dependency 22 */)(env0_16).filter(function({guildId}) {
|
|
return guildId !== guild.id;
|
|
}).keyBy('id').value();
|
|
}
|
|
|
|
function MESSAGE_DELETE_85296({id, channelId}) { // fn#85296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2227, offset: 0x01f6a57f, size: 136 bytes, params: 2, frame: 17
|
|
var r1;
|
|
var r0;
|
|
var value3;
|
|
var defaultImport;
|
|
var value4;
|
|
const property = env0_16[channelId];
|
|
const value2 = property != null;
|
|
if (value2) {
|
|
value3 = undefined;
|
|
defaultImport = importDefault(22) /* metro dependency 22 */;
|
|
value4 = defaultImport.remove(property.items, function(a0) {
|
|
return a0.message.id === id;
|
|
}).length !== 0;
|
|
if (value4) {
|
|
property.items = property.items.slice();
|
|
env0_16[channelId] = property;
|
|
r1 = value3;
|
|
} else {
|
|
r1 = value4;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function MESSAGE_DELETE_BULK_85298({ids, channelId}) { // fn#85298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2428, offset: 0x01f6a621, size: 74 bytes, params: 2, frame: 12
|
|
const property = env0_16[channelId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
property.items = property.items.filter(function({message}) {
|
|
return !ids.includes(message.id);
|
|
});
|
|
}
|
|
|
|
function MESSAGE_UPDATE_85300(a0) { // fn#85300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:2588, offset: 0x01f6a68e, size: 621 bytes, params: 2, frame: 21
|
|
var findIndex;
|
|
var items2;
|
|
var updateMessageRecord;
|
|
var value3;
|
|
var object;
|
|
var defaultImport2;
|
|
var index2;
|
|
var property3;
|
|
var unshift;
|
|
let message = a0.message;
|
|
const env0_0 = message.id;
|
|
const channel_id = a0.message.channel_id;
|
|
if (channel_id == null) {
|
|
return false;
|
|
}
|
|
var value;
|
|
const property = env0_16[channel_id];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
if (a0.message.author != null) {
|
|
if (a0.message.pinned) {
|
|
items2 = property.items;
|
|
property.items = items2.slice();
|
|
defaultImport2 = importDefault(22) /* metro dependency 22 */;
|
|
findIndex = defaultImport2.findIndex;
|
|
items2 = property.items;
|
|
index2 = Reflect.apply(findIndex, defaultImport2, [items2, function(a0) {
|
|
return a0.message.id === id;
|
|
}]);
|
|
if (index2 === -1) {
|
|
items2 = property.items;
|
|
unshift = items2.unshift;
|
|
object = {};
|
|
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
object.message = value.createMessageRecord(a0.message);
|
|
object.pinnedAt = new global.Date();
|
|
Reflect.apply(unshift, items2, [object]);
|
|
} else {
|
|
items2 = property.items;
|
|
property3 = items2[index2];
|
|
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
updateMessageRecord = value.updateMessageRecord;
|
|
items2 = property.items;
|
|
property3.message = Reflect.apply(updateMessageRecord, value, [items2[index2].message, a0.message]);
|
|
}
|
|
return undefined;
|
|
}
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
findIndex = value.findIndex;
|
|
items2 = property.items;
|
|
value = Reflect.apply(findIndex, value, [items2, _fun85302]);
|
|
if (value === -1) {
|
|
return false;
|
|
}
|
|
items2 = property.items;
|
|
property.items = items2.slice();
|
|
items2 = property.items;
|
|
items2.splice(value, 1);
|
|
} else {
|
|
var defaultImport = importDefault(22) /* metro dependency 22 */;
|
|
findIndex = defaultImport.findIndex;
|
|
items2 = property.items;
|
|
var index = Reflect.apply(findIndex, defaultImport, [items2, function(a0) {
|
|
return a0.message.id === id;
|
|
}]);
|
|
if (index === -1) {
|
|
return undefined;
|
|
}
|
|
items2 = property.items;
|
|
var {pinnedAt, message} = items2[index];
|
|
var moduleValue = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
var value2 = moduleValue.updateMessageRecord(message, a0.message);
|
|
if (value2 !== message) {
|
|
value3 = property.items.slice();
|
|
value3[index] = {pinnedAt: pinnedAt, message: value2};
|
|
env0_16[channel_id].items = value3;
|
|
}
|
|
}
|
|
function _fun85302({message}) { // fn#85302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:3053, offset: 0x01f6a607, size: 26 bytes, params: 2, frame: 2
|
|
return message.id === id;
|
|
}
|
|
|
|
}
|
|
|
|
function MESSAGE_EXPLICIT_CONTENT_SCAN_TIMEOUT_85304({messageId, channelId}) { // fn#85304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11355:3556, offset: 0x01f6a8fb, size: 189 bytes, params: 2, frame: 16
|
|
const property = env0_16[channelId];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const defaultImport = Module00022;
|
|
const index = defaultImport.findIndex(property.items, function(a0) {
|
|
return a0.message.id === messageId;
|
|
});
|
|
if (index === -1) {
|
|
return false;
|
|
}
|
|
property.items = property.items.slice();
|
|
const property2 = property.items[index];
|
|
property2.message = ExplicitMediaRedactionUtilsModule.handleExplicitMediaScanTimeoutForMessage(property.items[index].message);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun85277, 11169, [6, 7, 15, 17, 18, 1949, 1379, 1945, 1867, 4814, 3793, 1878, 4625, 22, 4821, 566, 694,
|
|
2]) /* metro module 11169, dependencies: [6, 7, 15, 17, 18, 1949, 1379, 1945, 1867, 4814, 3793, 1878, 4625, 22, 4821, 566, 694, 2] */;
|