decord/source/modules/guild_invite/native/InviteSettingsModal.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

165 lines
7.5 KiB
TypeScript

// Module ID: 18004
// Function ID: 18005
// Name: InviteSettingsModal
// Dependencies: [32, 19, 1958, 9961, 1980, 4276, 1074, 21, 4638, 576, 1484, 504, 38, 12, 18005, 9966, 4982, 1115, 5077, 573, 7487, 8728, 18006, 9962, 1249, 5710, 7110, 2]
// Exports: default
// Module 18004 (InviteSettingsModal)
import nativeDefault from "native" /* 576 */;
import util from "util" /* 1115 */;
import discord_common_AnalyticsUtils from "discord_common/AnalyticsUtils" /* 1249 */;
import AlertActionCreatorsDefault from "AlertActionCreators" /* 4982 */;
import NavigatorHeader from "NavigatorHeader" /* 5710 */;
import Navigator from "Navigator" /* 7110 */;
import CreateInviteModalActionCreatorsDefault from "CreateInviteModalActionCreators" /* 9966 */;
import CreateInstantInviteUtils from "CreateInstantInviteUtils" /* 18005 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
import ChannelStore from "ChannelStore" /* 1958 */;
import CreateInviteModalStore from "CreateInviteModalStore" /* 9961 */;
import GuildStore from "GuildStore" /* 1980 */;
import PermissionStore from "PermissionStore" /* 4276 */;
require = fn;
function AdvancedInstantInviteScreen() {
let tmp = closure_12();
navigation = navigation(1484).useNavigation();
let obj = navigation(1484);
const items = [ChannelStore, CreateInviteModalStore, GuildStore];
const stateFromStoresObject = navigation(504).useStateFromStoresObject(items, () => {
const pendingSettings = CreateInviteModalStore.getPendingSettings();
channel(38)(null != pendingSettings, "Received null pending invite settings");
const inviteSettings = CreateInviteModalStore.getInviteSettings();
channel(38)(null != inviteSettings, "Received null invite settings");
channel = channel.getChannel(pendingSettings.channelId);
let guildId;
if (channel != null) {
guildId = channel.getGuildId();
}
return { settings: pendingSettings, inviteSettings, channel, guild: guild.getGuild(guildId) };
});
({ settings, channel } = stateFromStoresObject);
({ inviteSettings, guild } = stateFromStoresObject);
const tmp6 = callback(noop.useState(channel), 2);
const first = tmp6[0];
let tmp8 = null != channel;
if (tmp8) {
tmp8 = channel !== first;
}
if (tmp8) {
tmp6[1](channel);
}
let obj2 = navigation(504);
const tmp10 = !navigation(12).isEqual(settings, inviteSettings);
dependencyMap = tmp10;
const items1 = [channel];
const effect = obj3.useEffect(() => {
if (null == channel) {
const guildId = CreateInviteModalStore.getGuildId();
let invitableChannelForGuild = null;
if (null != guildId) {
invitableChannelForGuild = CreateInstantInviteUtils.getInvitableChannelForGuild(guildId);
}
if (null != invitableChannelForGuild) {
const obj3 = { channelId: invitableChannelForGuild.channel.id };
CreateInviteModalActionCreatorsDefault.updateSettings(obj3);
} else {
const obj5 = { title: null, body: null, onConfirm: null };
const intl = util.intl;
obj5.title = intl.string(util.t.VINpSK);
const intl2 = util.intl;
obj5.body = intl2.string(util.t.kQ6fit);
obj5.onConfirm = CreateInviteModalActionCreatorsDefault.close;
AlertActionCreatorsDefault.show(obj5);
}
}
}, items1);
const tmp2Result = navigation(12);
const unmountEffect = navigation(5077).useUnmountEffect(() => {
channel(573).wait(channel(9966).resetSettings);
});
const items2 = [channel];
callback = obj3.useCallback(() => {
if (null != channel) {
if (PermissionStore.can(constants2.CREATE_INSTANT_INVITE, tmp)) {
const invite = CreateInviteModalActionCreatorsDefault.createInvite("IOS Regenerate");
CreateInviteModalActionCreatorsDefault.close();
}
}
const obj2 = { title: null, body: null, onConfirm: null };
const intl = util.intl;
obj2.title = intl.string(util.t.VINpSK);
const intl2 = util.intl;
obj2.body = intl2.string(util.t.RiiKV0);
obj2.onConfirm = CreateInviteModalActionCreatorsDefault.close;
AlertActionCreatorsDefault.show(obj2);
}, items2);
const items3 = [navigation, tmp10, callback];
const effect1 = obj3.useEffect(() => {
navigation.setOptions({
headerRight() {
let tmp;
if (dependencyMap) {
const obj = { onPress, text: null };
const intl = navigation(1115).intl;
obj.text = intl.string(navigation(1115).t["R3BPH+"]);
tmp = jsx(navigation(7487).HeaderActionButton, { onPress, text: null });
}
return tmp;
}
});
}, items3);
const callback1 = obj3.useCallback((maxUses) => {
channel(9966).updateSettings({ maxUses });
}, []);
const callback2 = obj3.useCallback((maxAge) => {
channel(9966).updateSettings({ maxAge });
}, []);
const callback3 = obj3.useCallback((temporary) => {
channel(9966).updateSettings({ temporary });
}, []);
const callback4 = obj3.useCallback((flags) => {
channel(9966).updateSettings({ flags });
}, []);
const callback5 = obj3.useCallback((roleIds) => {
channel(9966).updateSettings({ roleIds });
}, []);
let obj4 = { contentContainerStyle: tmp.formContainer, children: null };
let obj5 = { style: tmp.formContent, channel: first, guild, maxAge: settings.maxAge, maxUses: settings.maxUses, maxUsesOptions: null, temporary: null, flags: null, roleIds: null, onChangeMaxAge: null, onChangeMaxUses: null, onChangeTemporary: null, onChangeFlags: null, onChangeRoleIds: null };
const tmp2Result2 = navigation(5077);
obj5.maxUsesOptions = channel(9962).getMaxUsesOptions;
({ temporary: obj7.temporary, flags: obj7.flags, roleIds: obj7.roleIds } = settings);
obj5.onChangeMaxAge = callback2;
obj5.onChangeMaxUses = callback1;
obj5.onChangeTemporary = callback3;
obj5.onChangeFlags = callback4;
obj5.onChangeRoleIds = callback5;
obj4.children = jsx(channel(18006), { style: tmp.formContent, channel: first, guild, maxAge: settings.maxAge, maxUses: settings.maxUses, maxUsesOptions: null, temporary: null, flags: null, roleIds: null, onChangeMaxAge: null, onChangeMaxUses: null, onChangeTemporary: null, onChangeFlags: null, onChangeRoleIds: null });
return jsx(navigation(8728).Form, { contentContainerStyle: tmp.formContainer, children: null });
}
const Constants = fn(1074);
({ InviteModalScenes: closure_9, Permissions: c10 } = Constants);
const jsx = fn(21).jsx;
const createStyles = fn(4638);
let obj2 = { formContainer: { paddingTop: nativeDefault.space.PX_16, paddingBottom: nativeDefault.space.PX_32 }, formContent: null };
let obj3 = { paddingTop: nativeDefault.space.PX_16, paddingBottom: nativeDefault.space.PX_32 };
obj2.formContent = { paddingHorizontal: nativeDefault.modules.mobile.TABLE_ROW_PADDING };
let closure_12 = createStyles.createStyles(obj2);
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_invite/native/InviteSettingsModal.tsx");
export default function InviteSettingsModal() {
const memo = noop.useMemo(() => {
const obj = {};
const obj2 = { impressionName: discord_common_AnalyticsUtils.ImpressionNames.GUILD_INVITE_LINK_SETTINGS, title: null, headerLeft: null, render: null };
const intl = util.intl;
obj2.title = intl.string(util.t.Yx4IiC);
obj2.headerLeft = NavigatorHeader.getHeaderCloseButton(CreateInviteModalActionCreatorsDefault.close);
obj2.render = function render() {
return closure_1_11(closure_1_13, {});
};
obj[constants.ADVANCED] = obj2;
return obj;
}, []);
return jsx(Navigator.Navigator, { screens: memo, initialRouteName: constants.ADVANCED });
};