decord/source/modules/accept_invite/native/AcceptInviteManager.tsx

159 lines
6.5 KiB
TypeScript
Raw Normal View History

// Module ID: 17453
// Function ID: 17454
// Name: AcceptInviteManager
// Dependencies: [502, 1958, 2022, 1980, 4623, 4278, 7776, 1074, 7840, 1101, 4606, 4842, 17454, 1897, 7225, 17455, 573, 8867, 2]
2026-07-20 16:05:17 +00:00
// Module 17453 (AcceptInviteManager)
import DispatcherDefault from "Dispatcher" /* 573 */;
import asyncRequireImpl from "asyncRequireImpl" /* 1897 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4606 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4842 */;
import InviteTypeUtils from "InviteTypeUtils" /* 7840 */;
import FriendInviteUtils from "FriendInviteUtils" /* 17455 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import ChannelStore from "ChannelStore" /* 1958 */;
import GuildMemberStore from "GuildMemberStore" /* 2022 */;
import GuildStore from "GuildStore" /* 1980 */;
import InviteStore from "InviteStore" /* 4623 */;
import PermissionStore from "PermissionStore" /* 4278 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7225 */;
2026-07-23 10:11:24 +00:00
require = fn;
const ACCEPT_INVITE_MODAL_KEY = fn(7776).ACCEPT_INVITE_MODAL_KEY;
const Constants = fn(1074);
({ InviteStates: c10, Permissions: closure_11, Routes: closure_12 } = Constants);
const prototype = function AcceptInviteManager() {
2026-07-29 08:29:29 +00:00
const applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
2026-08-24 06:08:38 +00:00
require = applyArgumentsResult;
2026-07-29 08:29:29 +00:00
applyArgumentsResult._isRegistration = false;
applyArgumentsResult.actions = {
2026-08-04 08:36:32 +00:00
DISPLAYED_INVITE_SHOW(code) {
return applyArgumentsResult._handleShowInvite(code);
2026-07-29 08:29:29 +00:00
},
DISPLAYED_INVITE_CLEAR() {
return applyArgumentsResult._handleClearInvite();
},
DEFERRED_INVITE_SHOW() {
return applyArgumentsResult._handleShowDeferredInvite();
},
REGISTER_SUCCESS() {
return applyArgumentsResult._handleRegisterSuccess();
}
};
2026-08-04 08:36:32 +00:00
applyArgumentsResult._handleShowInvite = function _handleShowInvite(code) {
code = code.code;
({ deeplinkAttemptId, invite_instance_id } = code);
if (AuthenticationStore.isAuthenticated()) {
2026-08-04 08:36:32 +00:00
obj._handleInvite(code, deeplinkAttemptId, invite_instance_id);
2026-07-29 08:29:29 +00:00
} else {
obj._deferredCode = code;
}
};
applyArgumentsResult._handleClearInvite = function _handleClearInvite() {
applyArgumentsResult._deferredCode = null;
applyArgumentsResult._isRegistration = false;
ModalActionCreatorsDefault.popWithKey(ACCEPT_INVITE_MODAL_KEY);
2026-07-29 08:29:29 +00:00
};
applyArgumentsResult._handleShowDeferredInvite = function _handleShowDeferredInvite() {
if (null != applyArgumentsResult._deferredCode) {
2026-08-04 08:36:32 +00:00
obj._handleInvite(obj._deferredCode);
2026-07-29 08:29:29 +00:00
obj._deferredCode = null;
}
};
2026-08-04 08:36:32 +00:00
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);
2026-08-04 08:36:32 +00:00
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;
2026-08-04 08:36:32 +00:00
}
if (!flag) {
2026-07-29 08:29:29 +00:00
if (null == invite.channel) {
if (null == invite.guild) {
if (null != invite.inviter) {
2026-08-04 08:36:32 +00:00
let str = "Accept Invite";
if (null != deeplinkAttemptId) {
2026-08-04 08:36:32 +00:00
str = "Deep Link";
2026-07-29 08:29:29 +00:00
}
const obj = { location: str };
FriendInviteUtils.acceptFriendInvite(invite, obj);
DispatcherDefault.wait(() => set(8867).clearDisplayedInvite());
2026-08-04 08:36:32 +00:00
flag = false;
2026-07-29 08:29:29 +00:00
}
}
}
2026-08-04 08:36:32 +00:00
let flag2 = false;
if (invite.state === constants.RESOLVED) {
2026-08-04 08:36:32 +00:00
flag2 = false;
if (!obj9.isStreamInvite(invite)) {
2026-07-29 08:29:29 +00:00
const guild = invite.guild;
let id;
if (guild != null) {
id = guild.id;
}
const target_channel_id = invite.target_channel_id;
2026-08-04 08:36:32 +00:00
flag2 = false;
2026-07-29 08:29:29 +00:00
if (null != id) {
2026-08-04 08:36:32 +00:00
flag2 = false;
2026-07-29 08:29:29 +00:00
if (null != target_channel_id) {
2026-08-04 08:36:32 +00:00
flag2 = false;
if (null != GuildStore.getGuild(id)) {
2026-07-29 08:29:29 +00:00
if (null != invite.roles) {
if (invite.roles.length > 0) {
const selfMember = GuildMemberStore.getSelfMember(id);
let roles1;
2026-07-29 08:29:29 +00:00
if (selfMember != null) {
roles1 = selfMember.roles;
2026-07-29 08:29:29 +00:00
}
if (roles1 == null) {
roles1 = [];
2026-07-29 08:29:29 +00:00
}
const set = new Set(roles1);
const roles = invite.roles;
2026-08-04 08:36:32 +00:00
flag2 = false;
2026-07-29 08:29:29 +00:00
}
}
let flag3 = PermissionStore.can(constants2.VIEW_CHANNEL, ChannelStore.getChannel(target_channel_id));
2026-08-04 08:36:32 +00:00
if (flag3) {
2026-07-29 08:29:29 +00:00
const target_message_id = invite.target_message_id;
tmp39(1101).transitionTo(closure_3_12.CHANNEL(id, target_channel_id, target_message_id), { navigationReplace: true, openChannel: true });
2026-08-04 08:36:32 +00:00
flag3 = true;
const tmp39Result = tmp39(1101);
2026-07-29 08:29:29 +00:00
}
2026-08-04 08:36:32 +00:00
flag2 = flag3;
2026-07-29 08:29:29 +00:00
}
}
}
}
obj9 = InviteTypeUtils;
tmp39 = require;
2026-07-29 08:29:29 +00:00
}
2026-08-04 08:36:32 +00:00
if (flag2) {
DispatcherDefault.wait(() => set(8867).clearDisplayedInvite());
2026-08-04 08:36:32 +00:00
flag = false;
2026-07-29 08:29:29 +00:00
} else {
ActionSheetActionCreatorsDefault.hideActionSheet();
const obj4 = { code, isRegistration: applyArgumentsResult._isRegistration, deeplinkAttemptId, inviteInstanceId };
ModalActionCreatorsDefault.pushLazy(asyncRequireImpl(17454, dependencyMap.paths), obj4, ACCEPT_INVITE_MODAL_KEY);
2026-08-04 08:36:32 +00:00
flag = false;
2026-07-29 08:29:29 +00:00
}
}
2026-08-04 08:36:32 +00:00
return flag;
2026-07-29 08:29:29 +00:00
});
};
applyArgumentsResult._handleRegisterSuccess = function _handleRegisterSuccess() {
applyArgumentsResult._isRegistration = true;
2026-07-29 08:29:29 +00:00
};
return applyArgumentsResult;
}.prototype;
class prototype extends tmp3 {
2026-07-20 16:05:17 +00:00
}
const prototype1 = new prototype();
const size = fn(2);
let result = size.fileFinishedImporting("modules/accept_invite/native/AcceptInviteManager.tsx");
2026-07-20 16:05:17 +00:00
export default prototype1;