Files
discord-decomp/sources/modules/interaction_components/useFileUploadComponentState.tsx
T
2026-07-28 01:06:53 +03:00

76 lines
5.1 KiB
TypeScript

/* Metro module 15742; source: modules/interaction_components/useFileUploadComponentState.tsx; dependencies: [31, 4645, 4644, 8357, 44, 1909, 2] */
import Module00044 from '../../by-id/module-00044.js'; /* Metro dependency 44 */
import UploadAttachmentStore from '../../stores/UploadAttachmentStore.tsx'; /* Metro dependency 4644 */
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 DraftStoreModule from '../../stores/DraftStore.tsx'; /* Metro dependency 4645 */
import * as ComponentStateContextModule from './ComponentStateContext.tsx'; /* Metro dependency 8357 */
function _fun120893(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:6, offset: 0x02539b60, size: 159 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/interaction_components/useFileUploadComponentState.tsx');
exports.useFileUploadComponentState = useFileUploadComponentState;
function useFileUploadComponentState(a0) { // fn#120894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:262, offset: 0x02539bff, size: 324 bytes, params: 2, frame: 20
const value2 = (ComponentStateContextModule).useComponentStateContext();
(Module00044)(value2 != null,
'useFileUploadComponentState must be used within a ComponentStateContextProvider');
const channelId = value2.channelId;
(Module00044)(channelId != null,
'useFileUploadComponentState must be used inside a channel');
const {state, executeStateUpdate, error} = value2.useComponentState(a0);
const value4 = ReactModule.useMemo(function() {
return state?.type === require(dependencyMap[5]).ComponentType.FILE_UPLOAD ? state.uploadIds : [];
}, [state]);
const uploadAttachmentStoreBinding = UploadAttachmentStore;
const getUploads = uploadAttachmentStoreBinding.getUploads;
const InteractionModal = DraftType.InteractionModal;
let value = Reflect.apply(getUploads, uploadAttachmentStoreBinding, [channelId, InteractionModal]);
value = ReactModule.useMemo(_fun120896, [value4, value]);
const value5 = ReactModule.useCallback(function(a0) {
var executeStateUpdateBinding = executeStateUpdate;
var object = {};
object.type = require(dependencyMap[5]).ComponentType.FILE_UPLOAD;
object.uploadIds = a0;
return executeStateUpdateBinding(object);
}, [executeStateUpdate]);
ReactModule.useEffect(_fun120901, [value4, value, value5]);
return {uploadIds: value4, setUploadIds: value5, currentUploads: value, error: error};
function _fun120896() { // fn#120896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:757, offset: 0x02539d99, size: 45 bytes, params: 1, frame: 12
return env0_2.map(_fun120897).filter(function(a0) {
return a0 != null;
});
function _fun120897(a0) { // fn#120897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:768, offset: 0x02539dc6, size: 36 bytes, params: 2, frame: 11
const env0_0 = a0;
return env1_3.find(_fun120898);
function _fun120898({id}) { // fn#120898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:779, offset: 0x00db0c48, size: 21 bytes, params: 2, frame: 2
return id === env0_0;
}
}
}
function _fun120901() { // fn#120901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:926, offset: 0x02539e2b, size: 63 bytes, params: 1, frame: 12
if (env0_2.length > DraftStoreModule.DraftType.length) {
env0_5(env0_2.filter(_fun120902));
}
function _fun120902(a0) { // fn#120902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:969, offset: 0x02539e6a, size: 36 bytes, params: 2, frame: 11
const env0_0 = a0;
return env1_4.some(_fun120903);
function _fun120903({id}) { // fn#120903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:980, offset: 0x00db0c48, size: 21 bytes, params: 2, frame: 2
return id === env0_0;
}
}
}
}
}
global.__d(_fun120893, 15742, [31, 4645, 4644, 8357, 44, 1909,
2]) /* metro module 15742, dependencies: [31, 4645, 4644, 8357, 44, 1909, 2] */;