322 lines
17 KiB
TypeScript
322 lines
17 KiB
TypeScript
/* Metro module 15903; source: modules/guild_settings/native/GuildSettingsModalEmoji.tsx; dependencies: [57, 31, 27, 1867, 15904, 33, 22, 8629, 4501, 697, 1244, 6545, 8249, 566, 9077, 4573, 15906, 15910, 1305, 15911, 5461, 5462, 1484, 5282, 2] */
|
|
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
|
|
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import GuildSettingsEmojiStore from '../GuildSettingsEmojiStore.tsx'; /* Metro dependency 15904 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
|
|
import * as UseNavigationNativeModule from '../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
|
|
import * as NavigatorHeaderNativeModule from '../../../design/components/Navigator/native/NavigatorHeader.native.tsx'; /* Metro dependency 5282 */
|
|
import * as NavScrimAndroidModule from '../../../design/components/Navigator/native/NavScrim.android.tsx'; /* Metro dependency 5462 */
|
|
import * as GuildBoostingUtilsModule from '../../../utils/GuildBoostingUtils.tsx'; /* Metro dependency 8249 */
|
|
import * as EmojiActionCreatorsModule from '../../../actions/EmojiActionCreators.tsx'; /* Metro dependency 8629 */
|
|
import * as UseManageResourcePermissionsModule from '../../permissions/useManageResourcePermissions.tsx'; /* Metro dependency 9077 */
|
|
import * as HeaderRowModule from './GuildSettingsModalEmoji/HeaderRow.tsx'; /* Metro dependency 15910 */
|
|
import * as EmptyServerSettingsEmojiModule from '../../../design/components/Illustration/native/redesign/generated/EmptyServerSettingsEmoji.tsx'; /* Metro dependency 15911 */
|
|
|
|
function _fun122689(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#122689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:6, offset: 0x02571329, size: 520 bytes, params: 8, frame: 24
|
|
const env0_0 = require;
|
|
const ManageEmojisModal2 = ManageEmojisModal;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactNativeModule;
|
|
const env0_5 = value.View;
|
|
const env0_6 = value.FlatList;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_9 = value.jsx;
|
|
const env0_10 = value.jsxs;
|
|
const env0_11 = value.Fragment;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
const env0_12 = value.throttle((EmojiActionCreatorsModule).fetchEmoji, 1000);
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object = {loadingContainer: {'flex': 1, 'paddingTop': 40}};
|
|
object.emptyState = {paddingTop: 30};
|
|
const PX_12 = (Native).space.PX_12;
|
|
object.list = {paddingHorizontal: PX_12};
|
|
const PX_16 = (Native).space.PX_16;
|
|
object.section = {paddingVertical: PX_16};
|
|
object.titleContainer = {'paddingLeft': 16, 'paddingRight': 16};
|
|
const env0_13 = Reflect.apply(createStyles, value, [object]);
|
|
const computeSectionItem2 = computeSectionItem;
|
|
const closure3 = function(a0) {
|
|
return {type: 'EMOJI', key: a0.id, emoji: a0};
|
|
};
|
|
const env0_16 = (importDefault(22) /* metro dependency 22 */).memoize(_fun122700);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/guild_settings/native/GuildSettingsModalEmoji.tsx');
|
|
exports.default = GuildSettingsModalEmoji;
|
|
exports.computeSectionItem = computeSectionItem2;
|
|
exports.computeEmojiItem = closure3;
|
|
exports.ManageEmojisModal = ManageEmojisModal2;
|
|
function ManageEmojisModal({computeEmojiItems, contentContainerStyle, disabled, guild, headerDescription, onSelectRolesForEmoji}) { // fn#122690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1150, offset: 0x02571531, size: 689 bytes, params: 2, frame: 27
|
|
var r0;
|
|
disabled = !(disabled === undefined) && disabled;
|
|
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildSettingsEmojiStore],
|
|
function() {
|
|
var object = {};
|
|
var guildSettingsEmojiStoreBinding = GuildSettingsEmojiStore;
|
|
var guildBinding = guild;
|
|
object.emojis = guildSettingsEmojiStoreBinding.getEmojis(guildBinding.id);
|
|
object.revision = GuildSettingsEmojiStore.getEmojiRevision(guildBinding.id);
|
|
return object;
|
|
});
|
|
const emojis = value4.emojis;
|
|
const emojis2 = emojis;
|
|
const revision = value4.revision;
|
|
const useManageResourcePermissions = UseManageResourcePermissionsModule.useManageResourcePermissions;
|
|
const canManageGuildExpression = Reflect.apply(useManageResourcePermissions, UseManageResourcePermissionsModule,
|
|
[guild]).canManageGuildExpression;
|
|
const emojiItems = computeEmojiItems(emojis ?? [], guild);
|
|
const styles = useStyles();
|
|
let binding = emojis2;
|
|
const env0_9 = binding.useRef(revision);
|
|
emojis2.useEffect(_fun122692, [guild.id]);
|
|
emojis2.useEffect(_fun122693, [guild.id, revision]);
|
|
binding = emojis2;
|
|
let useCallback = binding.useCallback;
|
|
const value5 = Reflect.apply(useCallback, binding, [_fun122694, [guild.id, disabled, emojiItems, styles,
|
|
onSelectRolesForEmoji, canManageGuildExpression]]);
|
|
binding = emojis2;
|
|
useCallback = binding.useCallback;
|
|
items = [guild];
|
|
items[1] = emojis?.length;
|
|
items[2] = headerDescription;
|
|
items[3] = onSelectRolesForEmoji;
|
|
items[4] = disabled;
|
|
const value6 = Reflect.apply(useCallback, binding, [_fun122695, items]);
|
|
binding = emojis2;
|
|
useCallback = binding.useCallback;
|
|
if (emojis == null) {
|
|
r0 = (
|
|
<View style={styles.loadingContainer}>
|
|
{((ActivityIndicator) => <ActivityIndicator />)((require(5461) /* metro dependency 5461: ActivityIndicatorNative */).ActivityIndicator)}
|
|
{((NavScrim) => <NavScrim />)((require(5462) /* metro dependency 5462: NavScrimAndroid */).NavScrim)}
|
|
</View>
|
|
);
|
|
} else {
|
|
r0 = (
|
|
<FlatList
|
|
initialNumToRender={12}
|
|
ListHeaderComponent={value6}
|
|
ListEmptyComponent={Reflect.apply(useCallback, binding, [_fun122696, [styles]])}
|
|
windowSize={4}
|
|
data={emojiItems}
|
|
keyExtractor={emojis2.useCallback(function(a0) {
|
|
return a0.key;
|
|
}, [])}
|
|
renderItem={value5}
|
|
contentContainerStyle={[contentContainerStyle, styles.list]}
|
|
/>
|
|
);
|
|
}
|
|
return r0;
|
|
function _fun122692() { // fn#122692, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1549, offset: 0x02571826, size: 28 bytes, params: 1, frame: 11
|
|
env1_12(guild.id);
|
|
}
|
|
|
|
function _fun122693() { // fn#122693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1585, offset: 0x02571842, size: 61 bytes, params: 1, frame: 12
|
|
var value2;
|
|
if (env0_9.current < revision) {
|
|
value2 = environment.__proto__;
|
|
env1_12(guild.id);
|
|
}
|
|
env0_9.current = revision;
|
|
}
|
|
|
|
function _fun122694({item, index}) { // fn#122694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:1656, offset: 0x0257187f, size: 347 bytes, params: 2, frame: 21
|
|
var r5;
|
|
var r9;
|
|
var value;
|
|
var binding;
|
|
var property;
|
|
var value2;
|
|
var value5;
|
|
var EmojiRow;
|
|
var object;
|
|
var Text;
|
|
var section;
|
|
let type = item.type;
|
|
if (type === 'SECTION') {
|
|
value = environment.__proto__;
|
|
Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
object = {'style': null, 'variant': 'text-xs/bold', 'color': 'text-default'};
|
|
section = styles.section;
|
|
object.style = section;
|
|
section = item.section;
|
|
return (
|
|
<Text {...object}>
|
|
{section}
|
|
</Text>
|
|
);
|
|
}
|
|
if (type === 'EMOJI') {
|
|
binding = env0_7;
|
|
property = binding[index - 1];
|
|
value2 = undefined;
|
|
type = property == null ? value2 : property.type;
|
|
binding = env0_7;
|
|
property = binding[index + 1];
|
|
r5 = (property == null ? value2 : property.type) === 'SECTION' || index === env0_7.length - 1;
|
|
value5 = environment.__proto__;
|
|
EmojiRow = (require(15906) /* metro dependency 15906: EmojiRow */).EmojiRow;
|
|
var emojiRowProps = {emoji: item.emoji, guildId: guild.id};
|
|
r9 = disabled || !item.emoji.available;
|
|
r9 = !r9 ? !canManageGuildExpression(item.emoji) : r9;
|
|
emojiRowProps.disabled = r9;
|
|
emojiRowProps.onSelectRolesForEmoji = onSelectRolesForEmoji;
|
|
emojiRowProps.start = type === 'SECTION';
|
|
emojiRowProps.end = r5;
|
|
return <EmojiRow {...emojiRowProps} />;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function _fun122695() { // fn#122695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:2142, offset: 0x025719da, size: 123 bytes, params: 1, frame: 17
|
|
let value = environment.__proto__;
|
|
value = undefined;
|
|
const ConnectedHeaderRow = (HeaderRowModule).ConnectedHeaderRow;
|
|
return (
|
|
<ConnectedHeaderRow
|
|
guild={guild}
|
|
emojisLength={(emojis == null ? value : emojis.length) ?? 0}
|
|
description={headerDescription}
|
|
onSelectRolesForEmoji={onSelectRolesForEmoji}
|
|
uploadDisabled={disabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function _fun122696() { // fn#122696, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:2361, offset: 0x02571a55, size: 188 bytes, params: 1, frame: 19
|
|
const EmptyState = (NativeModule).EmptyState;
|
|
const object = {};
|
|
const EmptyServerSettingsEmoji = (EmptyServerSettingsEmojiModule).EmptyServerSettingsEmoji;
|
|
object.Illustration = EmptyServerSettingsEmoji;
|
|
object.style = styles.emptyState;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
let string = intl.string;
|
|
object.title = Reflect.apply(string, intl, [(require(1244) /* metro dependency 1244: indexNative */).t.lxsmBd]);
|
|
string = intl.string;
|
|
const RBbtMy = (require(1244) /* metro dependency 1244: indexNative */).t.RBbtMy;
|
|
object.body = Reflect.apply(string, intl, [RBbtMy]);
|
|
return <EmptyState {...object} />;
|
|
}
|
|
|
|
}
|
|
|
|
function computeSectionItem(a0, a1, a2) { // fn#122698, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:502, offset: 0x02571b11, size: 162 bytes, params: 4, frame: 18
|
|
const Math = global.Math;
|
|
let value = Math.max(a2 - a1, 0);
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
value = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.sgL8sI, {count: value});
|
|
value = '' + a0 + ' - ' + value;
|
|
value = value.toUpperCase();
|
|
return {type: 'SECTION', key: value, section: value};
|
|
}
|
|
|
|
function _fun122700(a0, a1) { // fn#122700, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:738, offset: 0x02571bd0, size: 380 bytes, params: 3, frame: 23
|
|
var r1;
|
|
var items2;
|
|
var items3;
|
|
const env0_0 = a1;
|
|
let value = a0.filter(_fun122701);
|
|
value = value.map(computeEmojiItem);
|
|
value = value.reverse();
|
|
const maxEmojiSlots = require(dependencyMap[12]).getMaxEmojiSlots(a1);
|
|
value = importDefault(dependencyMap[6]).partition(value, function(a0) {
|
|
return !a0.emoji.animated;
|
|
});
|
|
value = Module00057(value, 2);
|
|
const property = value[0];
|
|
const property2 = value[1];
|
|
const computeSectionItemBinding = computeSectionItem;
|
|
const intl = require(dependencyMap[10]).intl;
|
|
const string = intl.string;
|
|
const t = require(dependencyMap[10]).t;
|
|
value = Reflect.apply(string, intl, [t.sMOuuS]);
|
|
value = computeSectionItemBinding(value, property.length, maxEmojiSlots);
|
|
const sectionItem = computeSectionItemBinding(intl.string(t.wWjQye), property2.length, maxEmojiSlots);
|
|
if (property.length > 0) {
|
|
items2 = [value];
|
|
arraySpread(items2, property, 1, dependencyMap);
|
|
r1 = items2;
|
|
} else {
|
|
r1 = [];
|
|
}
|
|
items2 = [];
|
|
value = arraySpread(items2, r1, 0, dependencyMap);
|
|
if (property2.length > 0) {
|
|
items3 = [sectionItem];
|
|
arraySpread(items3, property2, 1, dependencyMap);
|
|
r1 = items3;
|
|
} else {
|
|
r1 = [];
|
|
}
|
|
arraySpread(items2, r1, value, dependencyMap);
|
|
return items2;
|
|
function _fun122701(a0) { // fn#122701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:762, offset: 0x02571d4c, size: 57 bytes, params: 2, frame: 13
|
|
let value = environment.__proto__;
|
|
value = require(6545) /* metro dependency 6545: RoleSubscriptionEmojiUtils */;
|
|
return !value.isRoleSubscriptionEmoji(a0, require.id);
|
|
}
|
|
|
|
}
|
|
|
|
function GuildSettingsModalEmoji({guildId, contentContainerStyle, isLandingScreen}) { // fn#122703, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:2954, offset: 0x02571d99, size: 373 bytes, params: 2, frame: 23
|
|
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
|
|
return GuildStore.getGuild(guildId);
|
|
});
|
|
const value2 = (UseNavigationNativeModule).useNavigation();
|
|
const styles = useStyles();
|
|
styles.useLayoutEffect(_fun122705, [value2, guild, isLandingScreen, styles]);
|
|
if (guild == null) {
|
|
return null;
|
|
}
|
|
const maxEmojiSlots = (GuildBoostingUtilsModule).getMaxEmojiSlots(guild);
|
|
const intl = (IndexNativeModule).intl;
|
|
const formatToPlainString = intl.formatToPlainString;
|
|
const TA1BR0 = (IndexNativeModule).t.TA1BR0;
|
|
const value4 = Reflect.apply(formatToPlainString, intl, [TA1BR0, {count: maxEmojiSlots}]);
|
|
const jsxRuntimeEnv0_11Binding = jsxRuntimeEnv0_11;
|
|
const manageEmojisModal = (
|
|
<ManageEmojisModal
|
|
guild={guild}
|
|
headerDescription={value4}
|
|
computeEmojiItems={env0_16}
|
|
contentContainerStyle={contentContainerStyle}
|
|
/>
|
|
);
|
|
const NavScrim = (NavScrimAndroidModule).NavScrim;
|
|
return (
|
|
<>
|
|
{manageEmojisModal}
|
|
<NavScrim />
|
|
</>
|
|
);
|
|
function _fun122705() { // fn#122705, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:3156, offset: 0x02571f0e, size: 58 bytes, params: 1, frame: 12
|
|
var binding;
|
|
if (isLandingScreen && guild !== undefined) {
|
|
binding = Module00057;
|
|
binding.setOptions({headerTitle: headerTitle_122706});
|
|
}
|
|
function headerTitle_122706() { // fn#122706, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16111:3202, offset: 0x02571f48, size: 95 bytes, params: 1, frame: 17
|
|
const NavigatorHeader = (NavigatorHeaderNativeModule).NavigatorHeader;
|
|
return (
|
|
<View style={styles.titleContainer}>
|
|
<NavigatorHeader title={guild.name} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun122689, 15903, [57, 31, 27, 1867, 15904, 33, 22, 8629, 4501, 697, 1244, 6545, 8249, 566, 9077, 4573,
|
|
15906, 15910, 1305, 15911, 5461, 5462, 1484, 5282,
|
|
2]) /* metro module 15903, dependencies: [57, 31, 27, 1867, 15904, 33, 22, 8629, 4501, 697, 1244, 6545, 8249, 566, 9077, 4573, 15906, 15910, 1305, 15911, 5461, 5462, 1484, 5282, 2] */;
|