178 lines
12 KiB
TypeScript
178 lines
12 KiB
TypeScript
/* Metro module 11143; source: modules/media/native/AttachmentPreview.tsx; dependencies: [31, 27, 33, 4501, 697, 11144, 11145, 11146, 11147, 11148, 11149, 11150, 11151, 11152, 11153, 11154, 11155, 11156, 11157, 4655, 4573, 477, 5475, 1305, 9783, 9543, 2] */
|
|
function _fun85201(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#85201, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11329:6, offset: 0x01f66fee, size: 651 bytes, params: 8, frame: 24
|
|
const env0_0 = require;
|
|
const closure = AttachmentIcon_85202;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const value = importAll(31) /* metro dependency 31 */;
|
|
const value2 = require(27) /* metro dependency 27 */;
|
|
const env0_4 = value2.Image;
|
|
const env0_5 = value2.View;
|
|
const value3 = require(33) /* metro dependency 33 */;
|
|
const env0_6 = value3.jsx;
|
|
const env0_7 = value3.jsxs;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = createStylesModule.createStyles;
|
|
const object3 = {'flexDirection': 'row', 'alignItems': 'center', 'overflow': 'hidden', 'borderRadius': null,
|
|
'height': 75, 'padding': 12, 'flex': 1};
|
|
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object3.gap = PX_8;
|
|
const env0_8 = Reflect.apply(createStyles, createStylesModule, [{fileInfoAttachmentPreviewFile: object3,
|
|
attachmentFileIcon: {'height': 32, 'width': 24}, attachmentFileName: {'paddingRight': 4, 'paddingLeft': 4,
|
|
'maxWidth': 136}, videoIcon: {'position': 'absolute', 'top': 0, 'left': 0, 'right': 0, 'bottom': 0,
|
|
'alignItems': 'center', 'justifyContent': 'center'}}]);
|
|
object = {archive: importDefault(11144) /* metro dependency 11144 */,
|
|
acrobat: importDefault(11145) /* metro dependency 11145 */,
|
|
ae: importDefault(11146) /* metro dependency 11146 */, ai: importDefault(11147) /* metro dependency 11147 */,
|
|
audio: importDefault(11148) /* metro dependency 11148 */,
|
|
code: importDefault(11149) /* metro dependency 11149 */,
|
|
document: importDefault(11150) /* metro dependency 11150 */,
|
|
image: importDefault(11151) /* metro dependency 11151 */,
|
|
photoshop: importDefault(11152) /* metro dependency 11152 */,
|
|
sketch: importDefault(11153) /* metro dependency 11153 */,
|
|
spreadsheet: importDefault(11154) /* metro dependency 11154 */,
|
|
unknown: importDefault(11155) /* metro dependency 11155 */,
|
|
video: importDefault(11156) /* metro dependency 11156 */,
|
|
webcode: importDefault(11157) /* metro dependency 11157 */};
|
|
const env0_10 = value.memo(_fun85206);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/media/native/AttachmentPreview.tsx');
|
|
exports.default = AttachmentPreview;
|
|
exports.AttachmentIcon = closure;
|
|
}
|
|
|
|
function AttachmentIcon_85202({fileName}) { // fn#85202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11329:792, offset: 0x01f67279, size: 90 bytes, params: 2, frame: 17
|
|
const styles = useStyles();
|
|
return <Image style={styles.attachmentFileIcon} source={env0_3.useMemo(_fun85203, [fileName])} />;
|
|
}
|
|
|
|
function FilenameText({fileName}) { // fn#85204, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11329:996, offset: 0x01f67331, size: 289 bytes, params: 2, frame: 23
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
const styles = useStyles();
|
|
const regexp = RegExp('(?:\\.([^.]+))?$', '');
|
|
const value2 = '';
|
|
const value3 = regexp.exec(fileName ?? value2);
|
|
return (
|
|
<View>
|
|
{fileName != null && value2 !== fileName && <Text style={styles.attachmentFileName} ellipsizeMode="middle" lineClamp={1} variant="text-xs/medium" color="mobile-text-heading-primary">{fileName}</Text>}
|
|
<Text
|
|
style={styles.attachmentFileName}
|
|
lineClamp={1}
|
|
variant="text-xs/medium"
|
|
color="text-muted"
|
|
>
|
|
{value3 != null && value3[1] != null ? value3[1].toUpperCase() : 'UNKNOWN'}
|
|
</Text>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function DefaultAttachmentPreview({fileName, maxFileWidth, borderRadius}) { // fn#85205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11329:1436, offset: 0x01f67452, size: 142 bytes, params: 2, frame: 19
|
|
const styles = useStyles();
|
|
return (
|
|
<View style={[styles.fileInfoAttachmentPreviewFile, {maxWidth: maxFileWidth, borderRadius: borderRadius}]}>
|
|
<AttachmentIcon_85202 fileName={fileName} />
|
|
<FilenameText fileName={fileName} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function _fun85206({uri, width, height, borderRadius, style, fileName}) { // fn#85206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11329:1691, offset: 0x01f674e0, size: 423 bytes, params: 2, frame: 22
|
|
var r0;
|
|
const object3 = {uri: uri, width: width, height: height};
|
|
const object4 = {width: width, height: height, borderRadius: borderRadius};
|
|
let value = fileName != null;
|
|
let r1 = value && fileName !== '' && RegExp('\\.gif$', 'i').test(fileName);
|
|
if (r1) {
|
|
r0 = (require(477) /* metro dependency 477: PlatformUtils */).isIOS() && uri.startsWith('ph://');
|
|
if (!r0) {
|
|
value = require(477) /* metro dependency 477: PlatformUtils */;
|
|
value = value.isAndroid();
|
|
r0 = value && uri.startsWith('content://');
|
|
}
|
|
r1 = r0;
|
|
}
|
|
const viewProps = {style: [object4, style, {overflow: 'hidden'}]};
|
|
if (r1) {
|
|
viewProps.children = ((Component) => <Component style={[object4,
|
|
style]} source={object3} resizeMode="cover" enableAnimation />)(importDefault(5475) /* metro dependency 5475: FastImage */);
|
|
} else {
|
|
viewProps.children = ((ThumbnailImage) => <ThumbnailImage style={[object4,
|
|
style]} source={object3} localImageSource={object3} />)((require(1305) /* metro dependency 1305: native */).ThumbnailImage);
|
|
}
|
|
return <View {...viewProps} />;
|
|
}
|
|
|
|
function AttachmentPreview({uri, isImage, isVideo, width, height, maxFileWidth, fileName, borderRadius = importDefault(dependencyMap[4]).radii.sm, showPlayOnVideoPreview, defaultPreview = <DefaultAttachmentPreview fileName={fileName} maxFileWidth={maxFileWidth} borderRadius={borderRadius} />, style}) { // fn#85207, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11329:2322, offset: 0x01f67687, size: 676 bytes, params: 2, frame: 30
|
|
var r0;
|
|
var moduleValue;
|
|
var moduleValue2;
|
|
var moduleValue3;
|
|
width = width === undefined ? 75 : width;
|
|
height = height === undefined ? 75 : height;
|
|
showPlayOnVideoPreview = !(showPlayOnVideoPreview === undefined) && showPlayOnVideoPreview;
|
|
const styles = useStyles();
|
|
if (isImage) {
|
|
r0 = ((Component) => <Component uri={uri} width={width} height={height} borderRadius={borderRadius} style={style} fileName={fileName} />)(env0_10);
|
|
} else if (isVideo) {
|
|
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue.isAndroid()) {
|
|
r0 = showPlayOnVideoPreview ? <View style={style}>{((Component) => <Component uri={uri} width={width} height={height} borderRadius={borderRadius} style={style} fileName={fileName} />)(env0_10)}<View style={styles.videoIcon}>{((CirclePlayIcon) => <CirclePlayIcon size="md" color="white" secondaryColor="black" />)((require(9783) /* metro dependency 9783: CirclePlayIcon */).CirclePlayIcon)}</View></View> : ((Component) => <Component uri={uri} width={width} height={height} borderRadius={borderRadius} style={style} fileName={fileName} />)(env0_10);
|
|
} else {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isIOS()) {
|
|
if (uri.startsWith('ph://')) {
|
|
r0 = showPlayOnVideoPreview ? <View style={style}>{((Component) => <Component uri={uri} width={width} height={height} borderRadius={borderRadius} style={style} fileName={fileName} />)(env0_10)}<View style={styles.videoIcon}>{((CirclePlayIcon) => <CirclePlayIcon size="md" color="white" secondaryColor="black" />)((require(9783) /* metro dependency 9783: CirclePlayIcon */).CirclePlayIcon)}</View></View> : ((Component) => <Component uri={uri} width={width} height={height} borderRadius={borderRadius} style={style} fileName={fileName} />)(env0_10);
|
|
} else if (isVideo) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
r0 = moduleValue3.isIOS() ? <View style={style}>{((VideoComponent) => <VideoComponent style={{height: height,
|
|
|
|
|
|
|
|
width: width}} source={{uri: uri}} muted paused resizeMode="cover" preventsDisplaySleepDuringVideoPlayback={false} />)((require(9543) /* metro dependency 9543: Video */).VideoComponent)}</View> : defaultPreview;
|
|
} else {
|
|
r0 = defaultPreview;
|
|
}
|
|
} else if (isVideo) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
r0 = moduleValue3.isIOS() ? <View style={style}>{((VideoComponent) => <VideoComponent style={{height: height,
|
|
|
|
|
|
width: width}} source={{uri: uri}} muted paused resizeMode="cover" preventsDisplaySleepDuringVideoPlayback={false} />)((require(9543) /* metro dependency 9543: Video */).VideoComponent)}</View> : defaultPreview;
|
|
} else {
|
|
r0 = defaultPreview;
|
|
}
|
|
}
|
|
} else {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isIOS()) {
|
|
if (uri.startsWith('ph://')) {
|
|
r0 = showPlayOnVideoPreview ? <View style={style}>{((Component) => <Component uri={uri} width={width} height={height} borderRadius={borderRadius} style={style} fileName={fileName} />)(env0_10)}<View style={styles.videoIcon}>{((CirclePlayIcon) => <CirclePlayIcon size="md" color="white" secondaryColor="black" />)((require(9783) /* metro dependency 9783: CirclePlayIcon */).CirclePlayIcon)}</View></View> : ((Component) => <Component uri={uri} width={width} height={height} borderRadius={borderRadius} style={style} fileName={fileName} />)(env0_10);
|
|
} else if (isVideo) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
r0 = moduleValue3.isIOS() ? <View style={style}>{((VideoComponent) => <VideoComponent style={{height: height,
|
|
|
|
|
|
width: width}} source={{uri: uri}} muted paused resizeMode="cover" preventsDisplaySleepDuringVideoPlayback={false} />)((require(9543) /* metro dependency 9543: Video */).VideoComponent)}</View> : defaultPreview;
|
|
} else {
|
|
r0 = defaultPreview;
|
|
}
|
|
} else if (isVideo) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
r0 = moduleValue3.isIOS() ? <View style={style}>{((VideoComponent) => <VideoComponent style={{height: height,
|
|
|
|
width: width}} source={{uri: uri}} muted paused resizeMode="cover" preventsDisplaySleepDuringVideoPlayback={false} />)((require(9543) /* metro dependency 9543: Video */).VideoComponent)}</View> : defaultPreview;
|
|
} else {
|
|
r0 = defaultPreview;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun85203() { // fn#85203, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11329:853, offset: 0x01f672d3, size: 94 bytes, params: 1, frame: 16
|
|
const value = environment.__proto__;
|
|
const fileUtilsModule = require(4655) /* metro dependency 4655: FileUtils */;
|
|
return env1_9[fileUtilsModule.classifyFileName(fileName ?? '')] ?? (importDefault(11155) /* metro dependency 11155 */);
|
|
}
|
|
|