This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,65 @@
// Metro module 11352 (f11353).
import { useEffect, useRef } from "react";
import { View } from "react-native";
import { DraftType } from "../../../../../stores/DraftStore";
import UploadAttachmentStore from "../../../../../stores/UploadAttachmentStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import AttachmentPreview from "../../../../media/native/AttachmentPreview";
import { FileIcon } from "../../../../../design/components/Icon/native/redesign/generated/FileIcon";
import { ApplicationCommandOptionType } from "../../../../../flow/Server";
import { useFileTypesFormattedString } from "../../../../interactions/FileTypeFiltering";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import UploadAttachmentActionCreators from "../../../../../actions/UploadAttachmentActionCreators";
import AppLauncherSelectOptionFormRow from "../../base_components/AppLauncherSelectOptionFormRow";
import { intl, t } from "../../../../../intl/index.native";
import { UploadPlatform } from "../../../../../lib/uploader/Upload";
import { ImageFileIcon } from "../../../../../design/components/Icon/native/redesign/generated/ImageFileIcon";
let useStyles;
const AttachmentPreviewAppLauncher = function AttachmentPreviewAppLauncher(props) {
const { uri, isImage, isVideo } = props;
const styles = useStyles();
const selectedImage = styles.selectedImage;
return <AttachmentPreview uri={uri} isImage={isImage} isVideo={isVideo} width={selectedImage.width} height={selectedImage.height} style={styles.selectedImage} defaultPreview={<FileIcon size="sm" />} />;
};
useStyles = createStyles({
imageIconWrapper: {
justifyContent: "center",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_MOD_SUBTLE,
width: 32,
height: 32,
borderRadius: Module712.radii.lg
},
selectedImage: {
width: 32,
height: 32,
borderRadius: Module712.radii.sm
}
});
export default function AppLauncherAttachmentOption(props) {
let ref;
const { option, channel, style, autoFocus, hasError, onPress, onSelectAttachment } = props;
ref = void 0;
const styles = useStyles();
const fileTypesFormattedString = useFileTypesFormattedString(option.type === ApplicationCommandOptionType.ATTACHMENT ? option.fileTypes : void 0);
const stateFromStores = useStateFromStores([UploadAttachmentStore], () => UploadAttachmentStore.getUpload(channel.id, option.name, DraftType.ApplicationLauncherCommand));
useEffect(() => () => UploadAttachmentActionCreators.remove(channel.id, option.name, DraftType.ApplicationLauncherCommand), [channel.id, option.name]);
ref = useRef(onSelectAttachment);
useEffect(() => {
ref.current = onSelectAttachment;
});
useEffect(() => {
if (stateFromStores?.filename != null) {
const current = ref.current;
if (current != null) {
current.call(ref, stateFromStores.filename);
}
}
}, [stateFromStores?.filename]);
return <AppLauncherSelectOptionFormRow style={style} hasError={hasError} option={option} selected={stateFromStores != null} selectedItemName={stateFromStores != null ? stateFromStores.filename : void 0} unselectedSubLabel={fileTypesFormattedString != null ? intl.format(t.NRRxmz, {
types: fileTypesFormattedString
}) : void 0} leading={stateFromStores != null && stateFromStores.item.platform === UploadPlatform.REACT_NATIVE ? <AttachmentPreviewAppLauncher uri={stateFromStores.item.uri} isImage={stateFromStores.isImage} isVideo={stateFromStores.isVideo} /> : <View style={styles.imageIconWrapper}>
<ImageFileIcon size="sm" color="interactive-text-default" />
</View>} onPress={onPress} autoFocus={autoFocus} />;
};