112 lines
7.2 KiB
TypeScript
112 lines
7.2 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] */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import ApplicationStore from '../applications/ApplicationStore.tsx'; /* Metro dependency 4234 */
|
|
import ApplicationRecord from '../../records/ApplicationRecord.tsx'; /* Metro dependency 4235 */
|
|
import UserProfileStore from '../user_profile/UserProfileStore.tsx'; /* Metro dependency 5189 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
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 ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */
|
|
import * as ApplicationCommandIndexStoreModule from '../application_commands/ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
|
|
|
|
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 ApplicationCommandType = (ServerModule).ApplicationCommandType;
|
|
const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT;
|
|
items2 = [PRIMARY_ENTRY_POINT];
|
|
const CHAT = ApplicationCommandType.CHAT;
|
|
items2[1] = CHAT;
|
|
const MESSAGE = ApplicationCommandType.MESSAGE;
|
|
items2[2] = MESSAGE;
|
|
const USER = ApplicationCommandType.USER;
|
|
items2[3] = USER;
|
|
(FileImportTrackerModule).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 = (FluxModule).useStateFromStores([ApplicationStore],
|
|
_fun76298);
|
|
const value4 = (FluxModule).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 userStoreBinding = UserStore;
|
|
const getUser = userStoreBinding.getUser;
|
|
channelBinding = channel;
|
|
const getRecipientId = channelBinding.getRecipientId;
|
|
const value = Reflect.apply(getUser, userStoreBinding, [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 _fun76302({application}) { // fn#76302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9893:1321, offset: 0x01dc9ace, size: 37 bytes, params: 2, frame: 3
|
|
return application?.id === env0_2;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun76295, 9707, [31, 7861, 4234, 5189, 4235, 1878, 661, 1909, 566, 8491, 694, 6777,
|
|
2]) /* metro module 9707, dependencies: [31, 7861, 4234, 5189, 4235, 1878, 661, 1909, 566, 8491, 694, 6777, 2] */;
|