decord/source/modules/accept_invite/native/AcceptInviteManager.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

158 lines
6.5 KiB
TypeScript

// Module ID: 17394
// Function ID: 17395
// Name: AcceptInviteManager
// Dependencies: [502, 1957, 2021, 1979, 4589, 4243, 7722, 1074, 7786, 1100, 4572, 4808, 17395, 1896, 7170, 17396, 573, 8808, 2]
// Module 17394 (AcceptInviteManager)
import DispatcherDefault from "Dispatcher" /* 573 */;
import asyncRequireImpl from "asyncRequireImpl" /* 1896 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4572 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4808 */;
import InviteTypeUtils from "InviteTypeUtils" /* 7786 */;
import FriendInviteUtils from "FriendInviteUtils" /* 17396 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import GuildMemberStore from "GuildMemberStore" /* 2021 */;
import GuildStore from "GuildStore" /* 1979 */;
import InviteStore from "InviteStore" /* 4589 */;
import PermissionStore from "PermissionStore" /* 4243 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7170 */;
require = fn;
const ACCEPT_INVITE_MODAL_KEY = fn(7722).ACCEPT_INVITE_MODAL_KEY;
const Constants = fn(1074);
({ InviteStates: c10, Permissions: closure_11, Routes: closure_12 } = Constants);
const prototype = function AcceptInviteManager() {
const applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
require = applyArgumentsResult;
applyArgumentsResult._isRegistration = false;
applyArgumentsResult.actions = {
DISPLAYED_INVITE_SHOW(code) {
return applyArgumentsResult._handleShowInvite(code);
},
DISPLAYED_INVITE_CLEAR() {
return applyArgumentsResult._handleClearInvite();
},
DEFERRED_INVITE_SHOW() {
return applyArgumentsResult._handleShowDeferredInvite();
},
REGISTER_SUCCESS() {
return applyArgumentsResult._handleRegisterSuccess();
}
};
applyArgumentsResult._handleShowInvite = function _handleShowInvite(code) {
code = code.code;
({ deeplinkAttemptId, invite_instance_id } = code);
if (AuthenticationStore.isAuthenticated()) {
obj._handleInvite(code, deeplinkAttemptId, invite_instance_id);
} else {
obj._deferredCode = code;
}
};
applyArgumentsResult._handleClearInvite = function _handleClearInvite() {
applyArgumentsResult._deferredCode = null;
applyArgumentsResult._isRegistration = false;
ModalActionCreatorsDefault.popWithKey(ACCEPT_INVITE_MODAL_KEY);
};
applyArgumentsResult._handleShowDeferredInvite = function _handleShowDeferredInvite() {
if (null != applyArgumentsResult._deferredCode) {
obj._handleInvite(obj._deferredCode);
obj._deferredCode = null;
}
};
applyArgumentsResult._handleInvite = function _handleInvite(_deferredCode, deeplinkAttemptId, invite_instance_id) {
const code = _deferredCode;
const inviteInstanceId = invite_instance_id;
const result = InviteStore.addConditionalChangeListener(() => {
const invite = InviteStore.getInvite(code);
let flag = null == invite;
if (!flag) {
flag = invite.state !== constants.RESOLVED && invite.state !== constants.EXPIRED && invite.state !== constants.BANNED && invite.state !== constants.ERROR;
const tmp4 = invite.state !== constants.RESOLVED && invite.state !== constants.EXPIRED && invite.state !== constants.BANNED && invite.state !== constants.ERROR;
}
if (!flag) {
if (null == invite.channel) {
if (null == invite.guild) {
if (null != invite.inviter) {
let str = "Accept Invite";
if (null != deeplinkAttemptId) {
str = "Deep Link";
}
const obj = { location: str };
FriendInviteUtils.acceptFriendInvite(invite, obj);
DispatcherDefault.wait(() => set(8808).clearDisplayedInvite());
flag = false;
}
}
}
let flag2 = false;
if (invite.state === constants.RESOLVED) {
flag2 = false;
if (!obj9.isStreamInvite(invite)) {
const guild = invite.guild;
let id;
if (guild != null) {
id = guild.id;
}
const target_channel_id = invite.target_channel_id;
flag2 = false;
if (null != id) {
flag2 = false;
if (null != target_channel_id) {
flag2 = false;
if (null != GuildStore.getGuild(id)) {
if (null != invite.roles) {
if (invite.roles.length > 0) {
const selfMember = GuildMemberStore.getSelfMember(id);
let roles1;
if (selfMember != null) {
roles1 = selfMember.roles;
}
if (roles1 == null) {
roles1 = [];
}
const set = new Set(roles1);
const roles = invite.roles;
flag2 = false;
}
}
let flag3 = PermissionStore.can(constants2.VIEW_CHANNEL, ChannelStore.getChannel(target_channel_id));
if (flag3) {
const target_message_id = invite.target_message_id;
tmp39(1100).transitionTo(closure_3_12.CHANNEL(id, target_channel_id, target_message_id), { navigationReplace: true, openChannel: true });
flag3 = true;
const tmp39Result = tmp39(1100);
}
flag2 = flag3;
}
}
}
}
obj9 = InviteTypeUtils;
tmp39 = require;
}
if (flag2) {
DispatcherDefault.wait(() => set(8808).clearDisplayedInvite());
flag = false;
} else {
ActionSheetActionCreatorsDefault.hideActionSheet();
const obj4 = { code, isRegistration: applyArgumentsResult._isRegistration, deeplinkAttemptId, inviteInstanceId };
ModalActionCreatorsDefault.pushLazy(asyncRequireImpl(17395, dependencyMap.paths), obj4, ACCEPT_INVITE_MODAL_KEY);
flag = false;
}
}
return flag;
});
};
applyArgumentsResult._handleRegisterSuccess = function _handleRegisterSuccess() {
applyArgumentsResult._isRegistration = true;
};
return applyArgumentsResult;
}.prototype;
class prototype extends tmp3 {
}
const prototype1 = new prototype();
const size = fn(2);
let result = size.fileFinishedImporting("modules/accept_invite/native/AcceptInviteManager.tsx");
export default prototype1;