Files
discord-decomp/sources/components_native/invite/AdvancedInstantInvite.tsx
T
2026-07-28 01:06:53 +03:00

293 lines
19 KiB
TypeScript

/* Metro module 16131; source: components_native/invite/AdvancedInstantInvite.tsx; dependencies: [6, 7, 15, 17, 18, 31, 1379, 9152, 1867, 3784, 661, 33, 9158, 4647, 1244, 5282, 5277, 16132, 694, 16133, 9153, 566, 44, 22, 1484, 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 Module00044 from '../../by-id/module-00044.js'; /* Metro dependency 44 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import CreateInviteModalStore from '../../stores/CreateInviteModalStore.tsx'; /* Metro dependency 9152 */
import InstantInviteUtils from '../../utils/InstantInviteUtils.tsx'; /* Metro dependency 9153 */
import CreateInviteModalActionCreators from '../../actions/CreateInviteModalActionCreators.tsx'; /* Metro dependency 9158 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as moduleValue2 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as UseNavigationNativeModule from '../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
function _fun124548(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#124548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:6, offset: 0x025bcd85, size: 337 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const PureComponent = ReactModule.PureComponent;
const env0_14 = _fun124552(PureComponent);
(FileImportTrackerModule).fileFinishedImporting('components_native/invite/AdvancedInstantInvite.tsx');
exports.default = _default_124569;
function _isNativeReflectConstruct_124549() { // fn#124549, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:236, offset: 0x025bced6, 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_124549_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun124552(a0) { // fn#124552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:435, offset: 0x025bcf38, size: 177 bytes, params: 2, frame: 17
const AdvancedInstantInviteContainer2 = AdvancedInstantInviteContainer;
Inherits(AdvancedInstantInviteContainer2, a0);
return CreateClass(AdvancedInstantInviteContainer2, [{key: 'componentDidMount', value: value_124564},
{key: 'componentDidUpdate', value: function(a0) {
if (this.props.changed !== a0.changed) {
this.updateHeader();
}
}}, {key: 'componentWillUnmount', value: value_124566}, {key: 'render', value: value_124567}],
[{key: 'getDerivedStateFromProps', value: function(a0, a1) {
var channel = a0.channel;
var value = null;
return channel === a1.cachedChannel ? value : value != a0.channel ? {cachedChannel: a0.channel} : value;
}}]);
function AdvancedInstantInviteContainer(a0) { // fn#124553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:447, offset: 0x025bcfe9, size: 259 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, AdvancedInstantInviteContainer);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(AdvancedInstantInviteContainer);
binding = env1_5;
if (_isNativeReflectConstruct_124549()) {
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.state = {cachedChannel: value.props.channel};
value.handleChangeMaxUses = handleChangeMaxUses;
value.handleChangeMaxAge = handleChangeMaxAge;
value.handleChangeTemporary = handleChangeTemporary;
value.handleChangeFlags = handleChangeFlags;
value.handleChangeRoleIds = handleChangeRoleIds;
value.handlePressCancel = handlePressCancel;
value.handlePressSave = handlePressSave;
value.updateHeader = updateHeader;
return value;
function handleChangeMaxUses(a0) { // fn#124554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:785, owner: AdvancedInstantInviteContainer.handleChangeMaxUses, offset: 0x025bd0ec, size: 48 bytes, params: 2, frame: 13
const value = environment.__proto__.__proto__;
(CreateInviteModalActionCreators).updateSettings({maxUses: a0});
}
function handleChangeMaxAge(a0) { // fn#124555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:848, owner: AdvancedInstantInviteContainer.handleChangeMaxAge, offset: 0x025bd11c, size: 48 bytes, params: 2, frame: 13
const value = environment.__proto__.__proto__;
(CreateInviteModalActionCreators).updateSettings({maxAge: a0});
}
function handleChangeTemporary(a0) { // fn#124556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:913, owner: AdvancedInstantInviteContainer.handleChangeTemporary, offset: 0x025bd14c, size: 48 bytes, params: 2, frame: 13
const value = environment.__proto__.__proto__;
(CreateInviteModalActionCreators).updateSettings({temporary: a0});
}
function handleChangeFlags(a0) { // fn#124557, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:977, owner: AdvancedInstantInviteContainer.handleChangeFlags, offset: 0x025bd17c, size: 47 bytes, params: 2, frame: 13
const value = environment.__proto__.__proto__;
(CreateInviteModalActionCreators).updateSettings({flags: a0});
}
function handleChangeRoleIds(a0) { // fn#124558, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:1039, owner: AdvancedInstantInviteContainer.handleChangeRoleIds, offset: 0x025bd1ab, size: 48 bytes, params: 2, frame: 13
const value = environment.__proto__.__proto__;
(CreateInviteModalActionCreators).updateSettings({roleIds: a0});
}
function handlePressCancel() { // fn#124559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:1101, owner: AdvancedInstantInviteContainer.handlePressCancel, offset: 0x025bd1db, size: 37 bytes, params: 1, frame: 11
const value = environment.__proto__.__proto__;
(CreateInviteModalActionCreators).close();
}
function handlePressSave() { // fn#124560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:1142, owner: AdvancedInstantInviteContainer.handlePressSave, offset: 0x025bd200, size: 283 bytes, params: 1, frame: 22
var value2;
var permissionStoreBinding;
var defaultImport;
var show;
var object;
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
const channel = env0_0.props.channel;
if (channel == null) {
value = environment.__proto__.__proto__;
defaultImport = importDefault(4647) /* metro dependency 4647: AlertActionCreators */;
show = defaultImport.show;
object = {};
object.title = intl.string(t.VINpSK);
object.body = intl.string(t.RiiKV0);
object.onConfirm = (importDefault(9158) /* metro dependency 9158: CreateInviteModalActionCreators */).close;
Reflect.apply(show, defaultImport, [object]);
} else {
value2 = environment.__proto__.__proto__;
permissionStoreBinding = PermissionStore;
if (permissionStoreBinding.can(Permissions.CREATE_INSTANT_INVITE, channel)) {
(importDefault(9158) /* metro dependency 9158: CreateInviteModalActionCreators */).createInvite('IOS Regenerate');
env0_0.handlePressCancel();
} else {
value = environment.__proto__.__proto__;
defaultImport = importDefault(4647) /* metro dependency 4647: AlertActionCreators */;
show = defaultImport.show;
object = {};
object.title = intl.string(t.VINpSK);
object.body = intl.string(t.RiiKV0);
object.onConfirm = (importDefault(9158) /* metro dependency 9158: CreateInviteModalActionCreators */).close;
Reflect.apply(show, defaultImport, [object]);
}
}
}
function updateHeader() { // fn#124561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:1424, owner: AdvancedInstantInviteContainer.updateHeader, offset: 0x025bd31b, size: 61 bytes, params: 1, frame: 13
const navigation = env0_0.props.navigation;
navigation.setOptions({headerLeft: headerLeft_124562, headerRight: headerRight_124563});
function updateHeaderHeaderLeft(a0) { // fn#124562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:1471, owner: AdvancedInstantInviteContainer.updateHeader.headerLeft, offset: 0x025bd358, size: 119 bytes, params: 2, frame: 13
var value4;
var moduleValue;
let value = environment.__proto__;
const binding = env1_0;
let r0 = binding.props.changed || binding.props.navigation.getState().routes.length === 1;
if (r0) {
value4 = environment.__proto__.__proto__.__proto__;
moduleValue = require(5282) /* metro dependency 5282: NavigatorHeaderNative */;
value = moduleValue.getHeaderCloseButton(env1_0.handlePressCancel);
value = value(a0);
r0 = value;
}
return r0;
}
function updateHeaderHeaderRight() { // fn#124563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:1624, owner: AdvancedInstantInviteContainer.updateHeader.headerRight, offset: 0x025bd3cf, size: 133 bytes, params: 1, frame: 19
var r0;
var value3;
var HeaderActionButton;
var intl;
const value = environment.__proto__;
if (env1_0.props.changed) {
value3 = environment.__proto__.__proto__.__proto__;
HeaderActionButton = (require(5277) /* metro dependency 5277: HeaderActionButtonNative */).HeaderActionButton;
var headerActionButtonProps = {onPress: env1_0.handlePressSave};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
headerActionButtonProps.text = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['R3BPH+']);
r0 = <HeaderActionButton {...headerActionButtonProps} />;
} else {
r0 = undefined;
}
return r0;
}
}
}
function value_124564() { // fn#124564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:1871, offset: 0x025bd454, size: 315 bytes, params: 1, frame: 21
var r4;
var value2;
var guildId;
var show;
var object;
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
const channel = this.props.channel;
let value = null;
if (value == channel) {
value2 = environment.__proto__;
guildId = CreateInviteModalStore.getGuildId();
r4 = value != guildId ? (require(16132) /* metro dependency 16132: CreateInstantInviteUtils */).getInvitableChannelForGuild(guildId) : value;
if (value != r4) {
(importDefault(9158) /* metro dependency 9158: CreateInviteModalActionCreators */).updateSettings({channelId: r4.channel.id});
} else {
value = importDefault(4647) /* metro dependency 4647: AlertActionCreators */;
show = value.show;
object = {};
object.title = intl.string(t.VINpSK);
object.body = intl.string(t.kQ6fit);
object.onConfirm = this.props.navigation.pop;
Reflect.apply(show, value, [object]);
}
}
this.updateHeader();
}
function value_124566() { // fn#124566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:2343, offset: 0x025bd5b8, size: 56 bytes, params: 1, frame: 14
let value = environment.__proto__;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.wait((CreateInviteModalActionCreators).resetSettings);
}
function value_124567() { // fn#124567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:2414, offset: 0x025bd5f0, size: 188 bytes, params: 1, frame: 18
let value = environment.__proto__;
value = importDefault(16133) /* metro dependency 16133: AdvancedInstantInvite */;
const valueProps = {...this.props};
valueProps['channel'] = this.state.cachedChannel;
valueProps['onChangeMaxUses'] = this.handleChangeMaxUses;
valueProps['onChangeMaxAge'] = this.handleChangeMaxAge;
valueProps['onChangeTemporary'] = this.handleChangeTemporary;
valueProps['onChangeFlags'] = this.handleChangeFlags;
valueProps['onChangeRoleIds'] = this.handleChangeRoleIds;
const getMaxUsesOptions = (InstantInviteUtils).getMaxUsesOptions;
valueProps['maxUsesOptions'] = getMaxUsesOptions;
return ((Component) => <Component {...valueProps} />)(value);
}
}
function _default_124569() { // fn#124569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:2995, offset: 0x025bd6e4, size: 191 bytes, params: 1, frame: 19
const {settings, inviteSettings, channel,
guild} = (FluxModule).useStateFromStoresObject([ChannelStore,
CreateInviteModalStore, GuildStore], _fun124570);
return ((Component) => <Component changed={!moduleValue2.isEqual(settings,
inviteSettings)} channel={channel} guild={guild} navigation={(UseNavigationNativeModule).useNavigation()} {...settings} />)(env0_14);
function _fun124570() { // fn#124570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16339:3064, offset: 0x025bd7a3, size: 165 bytes, params: 1, frame: 20
const value = environment.__proto__;
const createInviteModalStoreBinding = CreateInviteModalStore;
const pendingSettings = createInviteModalStoreBinding.getPendingSettings();
const value3 = undefined;
(Module00044)(pendingSettings != null, 'Received null pending invite settings');
const inviteSettings = createInviteModalStoreBinding.getInviteSettings();
(Module00044)(inviteSettings != null, 'Received null invite settings');
const channel = ChannelStore.getChannel(pendingSettings.channelId);
const guildStoreBinding = GuildStore;
const getGuild = guildStoreBinding.getGuild;
return {settings: pendingSettings, inviteSettings: inviteSettings, channel: channel, guild: Reflect.apply(getGuild,
guildStoreBinding, [channel == null ? value3 : channel.getGuildId()])};
}
}
}
global.__d(_fun124548, 16131, [6, 7, 15, 17, 18, 31, 1379, 9152, 1867, 3784, 661, 33, 9158, 4647, 1244, 5282, 5277,
16132, 694, 16133, 9153, 566, 44, 22, 1484,
2]) /* metro module 16131, dependencies: [6, 7, 15, 17, 18, 31, 1379, 9152, 1867, 3784, 661, 33, 9158, 4647, 1244, 5282, 5277, 16132, 694, 16133, 9153, 566, 44, 22, 1484, 2] */;