401 lines
18 KiB
TypeScript
401 lines
18 KiB
TypeScript
/* Metro module 11050; source: modules/stickers/StickersActionCreators.tsx; dependencies: [5, 4257, 1949, 4646, 1878, 6583, 661, 670, 4141, 694, 507, 4643, 7618, 1362, 22, 4647, 1244, 2] */
|
|
function _fun84602(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:6, offset: 0x01f51053, size: 425 bytes, params: 8, frame: 23
|
|
let env0_0 = require;
|
|
const cleanFavoriteStickers = function(a0) {
|
|
var r1;
|
|
var r0;
|
|
var value = a0;
|
|
if (GuildAvailabilityStore.totalUnavailableGuilds > 0) {
|
|
r0 = value;
|
|
} else {
|
|
if (GatewayConnectionStore.isConnected()) {
|
|
value = value.filter(_fun84604);
|
|
r1 = value;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const gatewayConnectionStore = importDefault(4257) /* metro dependency 4257: GatewayConnectionStore */;
|
|
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
|
|
const guildAvailabilityStore = importDefault(4646) /* metro dependency 4646: GuildAvailabilityStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const stickersStore = importDefault(6583) /* metro dependency 6583: StickersStore */;
|
|
const env0_9 = (require(661) /* metro dependency 661: Constants */).Endpoints;
|
|
let value = require(670) /* metro dependency 670: UserSettingsConstants */;
|
|
const env0_10 = value.MAX_FAVORITES;
|
|
const env0_11 = value.UserSettingsDelay;
|
|
value = _fun84605();
|
|
const value2 = _fun84609();
|
|
const value3 = _fun84614();
|
|
const value4 = _fun84618();
|
|
const value5 = _fun84623();
|
|
const value6 = _fun84627();
|
|
const value7 = _fun84631();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/stickers/StickersActionCreators.tsx');
|
|
exports.fetchStickerPack = value;
|
|
exports.fetchStickerPacks = value2;
|
|
exports.fetchSticker = value3;
|
|
exports.fetchGuildStickersWithCreator = value4;
|
|
exports.deleteGuildSticker = value5;
|
|
exports.createGuildSticker = value6;
|
|
exports.updateGuildSticker = value7;
|
|
exports.addStickerPreview = addStickerPreview;
|
|
exports.clearStickerPreview = clearStickerPreview;
|
|
exports.favoriteSticker = function(a0) {
|
|
var env0_0 = a0;
|
|
var FrecencyUserSettingsActionCreators = require(dependencyMap[13]).FrecencyUserSettingsActionCreators;
|
|
var INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
|
|
FrecencyUserSettingsActionCreators.updateAsync('favoriteStickers', _fun84638, INFREQUENT_USER_ACTION);
|
|
};
|
|
exports.unfavoriteSticker = function(a0) {
|
|
var env0_0 = a0;
|
|
var FrecencyUserSettingsActionCreators = require(dependencyMap[13]).FrecencyUserSettingsActionCreators;
|
|
var INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
|
|
FrecencyUserSettingsActionCreators.updateAsync('favoriteStickers', _fun84640, INFREQUENT_USER_ACTION);
|
|
};
|
|
}
|
|
|
|
function cleanFavoriteStickers(a0) { // fn#84603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:2689, offset: 0x01f511fc, size: 69 bytes, params: 2, frame: 13
|
|
var r1;
|
|
var r0;
|
|
let value = a0;
|
|
if (GuildAvailabilityStore.totalUnavailableGuilds > 0) {
|
|
r0 = value;
|
|
} else {
|
|
if (GatewayConnectionStore.isConnected()) {
|
|
value = value.filter(_fun84604);
|
|
r1 = value;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun84605() { // fn#84605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:228, offset: 0x01f5125e, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env0_3(_fun84607);
|
|
return _fun84608;
|
|
}
|
|
|
|
function _fun84609() { // fn#84609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:516, offset: 0x01f5132f, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env0_3(_fun84611);
|
|
return _fun84613;
|
|
}
|
|
|
|
function _fun84614() { // fn#84614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:933, offset: 0x01f514ae, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env0_3(_fun84616);
|
|
return _fun84617;
|
|
}
|
|
|
|
function _fun84618() { // fn#84618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:1339, offset: 0x01f5160d, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env0_3(_fun84620);
|
|
return _fun84622;
|
|
}
|
|
|
|
function _fun84623() { // fn#84623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:1668, offset: 0x01f51733, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env0_3(_fun84625);
|
|
return _fun84626;
|
|
}
|
|
|
|
function _fun84627() { // fn#84627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:1842, offset: 0x01f517ce, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env0_3(_fun84629);
|
|
return _fun84630;
|
|
}
|
|
|
|
function _fun84631() { // fn#84631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:2503, offset: 0x01f519c0, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env0_3(_fun84633);
|
|
return _fun84634;
|
|
}
|
|
|
|
function addStickerPreview(a0, a1, a2) { // fn#84635, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:3079, offset: 0x01f51a60, size: 72 bytes, params: 4, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'ADD_STICKER_PREVIEW', channelId: a0,
|
|
sticker: a1, draftType: a2});
|
|
}
|
|
|
|
function clearStickerPreview(a0, a1) { // fn#84636, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:3217, offset: 0x01f51aa8, size: 64 bytes, params: 3, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'CLEAR_STICKER_PREVIEW', channelId: a0,
|
|
draftType: a1});
|
|
}
|
|
|
|
function favoriteSticker(a0) { // fn#84637, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:3343, offset: 0x01f51ae8, size: 76 bytes, params: 2, frame: 16
|
|
const env0_0 = a0;
|
|
const FrecencyUserSettingsActionCreators = (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).FrecencyUserSettingsActionCreators;
|
|
const updateAsync = FrecencyUserSettingsActionCreators.updateAsync;
|
|
const INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
|
|
Reflect.apply(updateAsync, FrecencyUserSettingsActionCreators, ['favoriteStickers', _fun84638,
|
|
INFREQUENT_USER_ACTION]);
|
|
}
|
|
|
|
function unfavoriteSticker(a0) { // fn#84639, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:3772, offset: 0x01f51c4c, size: 76 bytes, params: 2, frame: 16
|
|
const env0_0 = a0;
|
|
const FrecencyUserSettingsActionCreators = (require(1362) /* metro dependency 1362: UserSettingsProtoActionCreators */).FrecencyUserSettingsActionCreators;
|
|
const updateAsync = FrecencyUserSettingsActionCreators.updateAsync;
|
|
const INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
|
|
Reflect.apply(updateAsync, FrecencyUserSettingsActionCreators, ['favoriteStickers', function(a0) {
|
|
a0.stickerIds = a0.stickerIds.filter(_fun84641);
|
|
a0.stickerIds = cleanFavoriteStickers(a0.stickerIds);
|
|
}, INFREQUENT_USER_ACTION]);
|
|
}
|
|
|
|
function _fun84604(a0) { // fn#84604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:2785, offset: 0x01f51241, size: 29 bytes, params: 2, frame: 11
|
|
const value = environment.__proto__;
|
|
return StickersStore.getStickerById(a0) != null;
|
|
}
|
|
|
|
function* _fun84607(a0, a1) { // fn#84607, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:248, offset: 0x01f5128d, size: 162 bytes, params: 3, frame: 17
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const value3 = env2_0(env2_2[8]);
|
|
const httpGetWithCountryCodeQuery = value3.httpGetWithCountryCodeQuery;
|
|
const object2 = {};
|
|
object2.url = env2_9.STICKER_PACK(a0);
|
|
object2.rejectWithError = false;
|
|
yield Reflect.apply(httpGetWithCountryCodeQuery, value3, [object2]);
|
|
const value4 = undefined;
|
|
if (false) {
|
|
return value4;
|
|
}
|
|
const body = value4.body;
|
|
value = env2_1(env2_2[9]);
|
|
value.dispatch({type: 'STICKER_PACK_FETCH_SUCCESS', packId: a0, pack: body, ingestStickers: a1});
|
|
return body;
|
|
}
|
|
|
|
async function _fun84611() { // fn#84611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:536, offset: 0x01f51367, size: 278 bytes, params: 1, frame: 18
|
|
var environment;
|
|
let value = a0;
|
|
if (true) {
|
|
var locale = (value !== undefined ? value : {}).locale;
|
|
locale = locale === undefined ? env2_5.locale : locale;
|
|
await undefined;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
if (!env2_8.isFetchingStickerPacks) {
|
|
if (env2_8.hasLoadedStickerPacks) {
|
|
return undefined;
|
|
}
|
|
var binding = env2_1;
|
|
var binding2 = env2_2;
|
|
binding(binding2[9]).wait(_fun84612);
|
|
binding = env2_0;
|
|
var HTTP = binding(binding2[10]).HTTP;
|
|
var get = HTTP.get;
|
|
var STICKER_PACKS = env2_9.STICKER_PACKS;
|
|
await Reflect.apply(get, HTTP, [{url: STICKER_PACKS, query: {locale: locale}, rejectWithError: false}]);
|
|
var value6 = undefined;
|
|
if (false) {
|
|
return value6;
|
|
}
|
|
var sticker_packs = value6.body.sticker_packs;
|
|
binding = env2_1;
|
|
binding(env2_2[9]).dispatch({type: 'STICKER_PACKS_FETCH_SUCCESS', packs: sticker_packs});
|
|
}
|
|
}
|
|
}
|
|
|
|
function* _fun84616(a0) { // fn#84616, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:953, offset: 0x01f514dd, size: 304 bytes, params: 2, frame: 17
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const HTTP = env2_0(env2_2[10]).HTTP;
|
|
const get = HTTP.get;
|
|
const object2 = {};
|
|
object2.url = env2_9.STICKER(a0);
|
|
object2.rejectWithError = false;
|
|
yield Reflect.apply(get, HTTP, [object2]);
|
|
const value3 = undefined;
|
|
if (false) {
|
|
return value3;
|
|
}
|
|
const body = value3.body;
|
|
const value5 = env2_0(env2_2[11]);
|
|
if (value5.isGuildSticker(body)) {
|
|
value = env2_1(env2_2[9]);
|
|
value.dispatch({type: 'GUILD_STICKER_FETCH_SUCCESS', sticker: body});
|
|
return undefined;
|
|
}
|
|
const value6 = env2_0(env2_2[11]);
|
|
if (value6.isStandardSticker(body)) {
|
|
value = env2_1(env2_2[9]);
|
|
value.dispatch({type: 'PACK_STICKER_FETCH_SUCCESS', sticker: body});
|
|
return undefined;
|
|
}
|
|
const Error = global.Error;
|
|
throw new Error('Invalid sticker type');
|
|
}
|
|
|
|
function* _fun84620(a0, a1) { // fn#84620, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:1359, offset: 0x01f5163c, size: 180 bytes, params: 3, frame: 17
|
|
var environment;
|
|
if (true) {
|
|
value = environment.__proto__.__proto__;
|
|
var HTTP = env2_0(env2_2[10]).HTTP;
|
|
var get = HTTP.get;
|
|
var object2 = {};
|
|
object2.url = env2_9.GUILD_STICKER_PACKS(a0);
|
|
object2.rejectWithError = false;
|
|
object2.signal = a1;
|
|
yield Reflect.apply(get, HTTP, [object2]);
|
|
var value3 = undefined;
|
|
if (false) {
|
|
return value3;
|
|
}
|
|
var body = value3.body;
|
|
value = env2_1(env2_2[9]);
|
|
var dispatch = value.dispatch;
|
|
object2 = {type: 'GUILD_STICKERS_FETCH_SUCCESS', guildId: a0};
|
|
object2.stickers = body.map(function(a0) {
|
|
var r4;
|
|
var r0;
|
|
var object;
|
|
var value = a0;
|
|
if (value.user == null) {
|
|
r0 = value;
|
|
} else {
|
|
object = {};
|
|
copyDataProperties(object, value, r4);
|
|
object['user_id'] = value.user.id;
|
|
object['user'] = value.user;
|
|
r0 = object;
|
|
}
|
|
return r0;
|
|
});
|
|
Reflect.apply(dispatch, value, [object2]);
|
|
}
|
|
}
|
|
|
|
function* _fun84625({guild_id, id}) { // fn#84625, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:1688, offset: 0x01f51762, size: 108 bytes, params: 2, frame: 18
|
|
if (true) {
|
|
value = environment.__proto__.__proto__;
|
|
var HTTP = env2_0(env2_2[10]).HTTP;
|
|
var del = HTTP.del;
|
|
var object2 = {};
|
|
object2.url = env2_9.GUILD_STICKER(guild_id, id);
|
|
object2.rejectWithError = false;
|
|
yield Reflect.apply(del, HTTP, [object2]);
|
|
}
|
|
}
|
|
|
|
function* _fun84629(a0) { // fn#84629, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:1862, offset: 0x01f517fd, size: 451 bytes, params: 2, frame: 22
|
|
var r12;
|
|
var r8;
|
|
var description;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const guildId = a0.guildId;
|
|
value = environment.__proto__.__proto__;
|
|
const binding = env2_0;
|
|
const value3 = undefined;
|
|
const HTTP = binding(env2_2[10]).HTTP;
|
|
const post = HTTP.post;
|
|
let object2 = {};
|
|
object2.url = env2_9.GUILD_STICKER_PACKS(guildId);
|
|
object2.body = a0.platform !== 'web' ? value3 : a0.body;
|
|
if (a0.platform !== 'mobile') {
|
|
r8 = value3;
|
|
} else {
|
|
description = a0.description;
|
|
r8 = [{name: 'name', value: a0.name}, {name: 'tags', value: a0.tags}, {name: 'description',
|
|
value: description}];
|
|
r12 = description;
|
|
}
|
|
object2.fields = r8;
|
|
object2.attachments = a0.platform !== 'mobile' ? value3 : [{name: 'file', file: {uri: a0.uri, name: a0.name,
|
|
type: a0.mimeType}}];
|
|
const value4 = env2_1(env2_2[12]);
|
|
object2.headers = value4.buildHeadersForMd5(a0.originalMd5);
|
|
object2.rejectWithError = false;
|
|
yield Reflect.apply(post, HTTP, [object2]);
|
|
const value5 = undefined;
|
|
if (false) {
|
|
return value5;
|
|
}
|
|
const value7 = env2_1(env2_2[9]);
|
|
const dispatch = value7.dispatch;
|
|
object2 = {type: 'GUILD_STICKERS_CREATE_SUCCESS', guildId: guildId};
|
|
const object3 = {};
|
|
copyDataProperties(object3, value5.body, r12);
|
|
value = env2_7.getCurrentUser();
|
|
object3['user_id'] = value == null ? value3 : value.id;
|
|
object2.sticker = object3;
|
|
Reflect.apply(dispatch, value7, [object2]);
|
|
return value5.body;
|
|
}
|
|
|
|
function* _fun84633(a0, a1, a2) { // fn#84633, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:2523, offset: 0x01f519ef, size: 113 bytes, params: 4, frame: 17
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const HTTP = env2_0(env2_2[10]).HTTP;
|
|
const patch = HTTP.patch;
|
|
const object2 = {};
|
|
object2.url = env2_9.GUILD_STICKER(a0, a1);
|
|
object2.body = a2;
|
|
object2.rejectWithError = false;
|
|
yield Reflect.apply(patch, HTTP, [object2]);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
return value.body;
|
|
}
|
|
|
|
function _fun84638(a0) { // fn#84638, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:3447, offset: 0x01f51b34, size: 280 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var value4;
|
|
var defaultImport2;
|
|
var show;
|
|
var object2;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const value = environment.__proto__;
|
|
const cleanFavoriteStickersBinding = cleanFavoriteStickers;
|
|
const stickerIds = a0.stickerIds;
|
|
const value2 = undefined;
|
|
a0.stickerIds = cleanFavoriteStickersBinding(stickerIds);
|
|
const defaultImport = importDefault(22) /* metro dependency 22 */;
|
|
if (defaultImport.size(a0.stickerIds) >= MAX_FAVORITES) {
|
|
defaultImport2 = importDefault(4647) /* metro dependency 4647: AlertActionCreators */;
|
|
show = defaultImport2.show;
|
|
object2 = {};
|
|
object2.title = intl.string(t['+XYXtZ']);
|
|
object2.body = intl.formatToPlainString(t.JaIyFi, {count: MAX_FAVORITES});
|
|
Reflect.apply(show, defaultImport2, [object2]);
|
|
r0 = false;
|
|
} else {
|
|
value4 = a0.stickerIds.includes(env0_0);
|
|
if (value4) {
|
|
r0 = !value4;
|
|
} else {
|
|
a0.stickerIds.push(env0_0);
|
|
r0 = value2;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun84640(a0) { // fn#84640, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:3878, offset: 0x01f51c98, size: 62 bytes, params: 2, frame: 12
|
|
const stickerIds = a0.stickerIds;
|
|
a0.stickerIds = stickerIds.filter(_fun84641);
|
|
a0.stickerIds = cleanFavoriteStickers(a0.stickerIds);
|
|
}
|
|
|
|
function _fun84612() { // fn#84612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11236:640, offset: 0x01f5147d, size: 49 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__.__proto__.__proto__;
|
|
env3_1(env3_2[9]).dispatch({type: 'STICKER_PACKS_FETCH_START'});
|
|
}
|
|
|