Files
discord-decomp/sources/modules/app_dms/useAppDMChatInputState.tsx
T
2026-07-27 16:20:00 +03:00

101 lines
6.0 KiB
TypeScript

/* Metro module 9707; source: modules/app_dms/useAppDMChatInputState.tsx; dependencies: [31, 7861, 4234, 5189, 4235, 1878, 661, 1909, 566, 8491, 694, 6777, 2] */
function _fun76295(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#76295, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:6, offset: 0x01dc95f8, size: 340 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
const env0_4 = (require(7861) /* metro dependency 7861: ApplicationCommandIndexStore */).useQueryState;
const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */;
const userProfileStore = importDefault(5189) /* metro dependency 5189: UserProfileStore */;
const applicationRecord = importDefault(4235) /* metro dependency 4235: ApplicationRecord */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const env0_9 = (require(661) /* metro dependency 661: Constants */).EMPTY_STRING_SNOWFLAKE_ID;
const ApplicationCommandType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandType;
const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT;
items = [PRIMARY_ENTRY_POINT];
const CHAT = ApplicationCommandType.CHAT;
items[1] = CHAT;
const MESSAGE = ApplicationCommandType.MESSAGE;
items[2] = MESSAGE;
const USER = ApplicationCommandType.USER;
items[3] = USER;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/app_dms/useAppDMChatInputState.tsx');
exports.default = useAppDMChatInputState;
}
function useAppDMChatInputState({context}) { // fn#76296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:459, offset: 0x01dc974c, size: 503 bytes, params: 2, frame: 22
const value = undefined;
const env0_3 = value;
const channel = context.channel;
let binding = env0_3;
const value3 = binding.useMemo(_fun76297, [channel]);
const appIdForBotUserId = (require(566) /* metro dependency 566: flux */).useStateFromStores([ApplicationStore],
_fun76298);
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserProfileStore], _fun76299);
const r7 = appIdForBotUserId ?? (value4 == null ? value : value4.id);
binding = env0_3;
binding.useEffect(_fun76300, [value3, r7]);
binding.useEffect(_fun76301, [value3 == null ? value : value3.id]);
const value5 = useQueryState({channel: channel, type: 'channel'}, {commandTypes: env0_10}, {applicationId: r7,
allowFetch: (value3 == null ? value : value3.id) != null,
allowApplicationState: true}).descriptors.find(_fun76302);
const application = value5 == null ? value : value5.application;
const value6 = application.useMemo(_fun76303, [application]);
const value7 = (require(6777) /* metro dependency 6777: useGetOrFetchApplications */).useGetOrFetchApplication(value6 == null ? r7 : value);
const bot = value3 == null ? value : value3.bot;
return {application: value6 ?? value7 ?? value, isAppDM: bot != null && bot};
}
function _fun76297() { // fn#76297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:539, offset: 0x01dc9943, size: 92 bytes, params: 1, frame: 14
let channelBinding = channel;
const value2 = null;
if (value2 == channelBinding) {
return value2;
}
if (channel.isDM() !== true) {
return value2;
}
const getUser = UserStore.getUser;
channelBinding = channel;
const getRecipientId = channelBinding.getRecipientId;
const value = Reflect.apply(getUser, UserStore, [Reflect.apply(getRecipientId, channelBinding, [])]);
return value === undefined || value.bot !== true ? value2 : value;
}
function _fun76298() { // fn#76298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:696, offset: 0x01dc999f, size: 47 bytes, params: 1, frame: 13
return ApplicationStore.getAppIdForBotUserId(env0_1?.id);
}
function _fun76299() { // fn#76299, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:780, offset: 0x01dc99ce, size: 74 bytes, params: 1, frame: 16
const value2 = undefined;
return env0_1 === null || UserProfileStore.getUserProfile(env0_1 == null ? value2 : env0_1.id) == null ? value2 : UserProfileStore.getUserProfile(env0_1 == null ? value2 : env0_1.id).application;
}
function _fun76300() { // fn#76300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:931, offset: 0x01dc9a18, size: 88 bytes, params: 1, frame: 17
var value2;
var value3;
if (env0_2 == null) {
value2 = environment.__proto__;
value3 = undefined;
(importDefault(8491) /* metro dependency 8491: maybeFetchUserProfile */)((env0_1 == null ? value3 : env0_1.id) ?? EMPTY_STRING_SNOWFLAKE_ID,
value3, {withMutualGuilds: true});
}
}
function _fun76301() { // fn#76301, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:1045, offset: 0x01dc9a70, size: 94 bytes, params: 1, frame: 14
var value3;
const value2 = undefined;
if ((env0_1 == null ? value2 : env0_1.id) != null) {
value3 = environment.__proto__;
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APP_DM_OPEN',
botUserId: env0_1.id});
}
return value2;
}
function _fun76303() { // fn#76303, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:1417, offset: 0x01dc9af3, size: 42 bytes, params: 1, frame: 12
return application != null ? ApplicationRecord.createFromServer(application) : undefined;
}