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

195 lines
12 KiB
TypeScript

/* Metro module 12677; source: modules/share/native/ShareAttachments.tsx; dependencies: [31, 27, 33, 4017, 4589, 1305, 4501, 697, 4504, 4000, 1244, 11143, 4660, 2] */
import ReanimatedRexport from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import LinearGradient from '../../../by-id/module-04589-LinearGradient.js'; /* Metro dependency 4589 */
import AttachmentPreview from '../../media/native/AttachmentPreview.tsx'; /* Metro dependency 11143 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as TimingModule from '../../../design/animation/reanimated/timing/timing.tsx'; /* Metro dependency 4504 */
function _fun97136(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#97136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:6, offset: 0x02173f68, size: 569 bytes, params: 8, frame: 22
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = JsxRuntimeModule;
const env0_5 = value.jsx;
const env0_6 = value.jsxs;
const env0_7 = (ReanimatedRexport).createAnimatedComponent(LinearGradient);
object = {duration: 300};
const STANDARD_EASING = (NativeModule).STANDARD_EASING;
object.easing = STANDARD_EASING;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.containerRevamp = {marginHorizontal: -PX_16};
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.attachmentPreviewContentContainer = {flexDirection: 'row', gap: PX_8};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.attachmentPreviewContentContainerRevamp = {paddingHorizontal: PX_16};
const object4 = {'height': 60, 'backgroundColor': null, 'overflow': 'hidden'};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object4.backgroundColor = BACKGROUND_BASE_LOW;
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.attachmentPreview = object4;
object.leftGradient = {'width': 50, 'position': 'absolute', 'left': 0, 'top': 0, 'bottom': 0, 'zIndex': 100};
object.rightGradient = {'width': 50, 'position': 'absolute', 'right': 0, 'top': 0, 'bottom': 0, 'zIndex': 100};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object.gradient = {color: BACKGROUND_SURFACE_HIGH};
const env0_9 = Reflect.apply(createStyles, value, [object]);
object = {code: 'function ShareAttachmentsTsx1(){const{withTiming,contentOffset,GRADIENT_EASING_CONFIG}=this.__closure;return{opacity:withTiming(contentOffset.get()<=0?0:1,GRADIENT_EASING_CONFIG)};}'};
object = {code: 'function ShareAttachmentsTsx2(){const{withTiming,contentOffset,layoutWidth,contentWidth,GRADIENT_EASING_CONFIG}=this.__closure;return{opacity:withTiming(contentOffset.get()+layoutWidth.get()>=contentWidth.get()?0:1,GRADIENT_EASING_CONFIG)};}'};
object = {code: 'function ShareAttachmentsTsx3(event){const{contentOffset,contentWidth,layoutWidth}=this.__closure;contentOffset.set(event.contentOffset.x);contentWidth.set(event.contentSize.width);layoutWidth.set(event.layoutMeasurement.width);}'};
(FileImportTrackerModule).fileFinishedImporting('modules/share/native/ShareAttachments.tsx');
exports.default = ShareAttachments;
function ShareAttachments({attachments, isRevamp}) { // fn#97137, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:1597, offset: 0x021741a1, size: 956 bytes, params: 2, frame: 31
var r0;
var items3;
var ScrollView;
var object2;
var intl;
let value = undefined;
isRevamp = !(isRevamp === value) && isRevamp;
const styles = useStyles();
const value4 = (ReanimatedRexportModule).useSharedValue(0);
const value5 = (ReanimatedRexportModule).useSharedValue(0);
const value6 = (ReanimatedRexportModule).useSharedValue(0);
const env0_3 = value6;
let useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
let closure = ShareAttachmentsY;
const object = {};
object.withTiming = (require(4504) /* metro dependency 4504: timing */).withTiming;
object.contentOffset = value4;
let binding = env0_8;
object.GRADIENT_EASING_CONFIG = binding;
closure.__closure = object;
closure.__workletHash = 3302668154466;
closure.__initData = env0_10;
const value7 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [closure]);
useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
closure = ShareAttachmentsS;
closure.__closure = {withTiming: (require(4504) /* metro dependency 4504: timing */).withTiming,
contentOffset: value4, layoutWidth: value6, contentWidth: value5, GRADIENT_EASING_CONFIG: binding};
closure.__workletHash = 13996707009656;
closure.__initData = env0_11;
const value8 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [closure]);
const useAnimatedScrollHandler = ReanimatedRexportModule.useAnimatedScrollHandler;
closure = ShareAttachmentsV;
closure.__closure = {contentOffset: value4, contentWidth: value5, layoutWidth: value6};
closure.__workletHash = 12660577105859;
closure.__initData = env0_12;
const value9 = Reflect.apply(useAnimatedScrollHandler, ReanimatedRexportModule, [closure]);
binding = env0_3;
const value10 = binding.useCallback(_fun97141, [value6]);
const value11 = binding.useCallback(_fun97142, [value5]);
const useMemo = binding.useMemo;
let gradient = styles.gradient;
let color = gradient.color;
const value12 = Reflect.apply(useMemo, binding, [_fun97143, [color]]);
if (attachments.length === 0) {
r0 = null;
} else {
var viewBindingProps = {style: isRevamp ? styles.containerRevamp : value};
binding = env0_7;
gradient = styles.gradient;
color = gradient.color;
items3 = [
((Component) => <Component start={{'x': 0, 'y': 0}} end={{'x': 1, 'y': 0}} colors={[color,
value12]} style={[styles.leftGradient, value7]} pointerEvents="box-none" />)(binding),
];
gradient = styles.gradient;
color = gradient.color;
items3[1] = ((Component) => <Component start={{'x': 0, 'y': 0}} end={{'x': 1, 'y': 0}} colors={[value12,
color]} style={[styles.rightGradient, value8]} pointerEvents="box-none" />)(binding);
ScrollView = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).ScrollView;
var scrollViewProps = {contentContainerStyle: [styles.attachmentPreviewContentContainer,
isRevamp ? styles.attachmentPreviewContentContainerRevamp : value], horizontal: true, onScroll: value9,
onLayout: value10, onContentSizeChange: value11, scrollEventThrottle: 16,
showsHorizontalScrollIndicator: false,
accessibilityRole: 'list'};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
scrollViewProps.accessibilityLabel = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.RhtzFe);
items3[2] = (
<ScrollView {...scrollViewProps}>
{attachments.map(_fun97144)}
</ScrollView>
);
value = (
<View {...viewBindingProps}>
{items3}
</View>
);
r0 = value;
}
return r0;
function ShareAttachmentsY() { // fn#97138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:1785, owner: ShareAttachments.y, offset: 0x0217455d, size: 78 bytes, params: 1, frame: 16
const withTiming = TimingModule.withTiming;
const value3 = env0_1.get();
const value4 = 0;
return {opacity: Reflect.apply(withTiming, TimingModule, [value3 <= value4 ? value4 : 1, env1_8])};
}
function ShareAttachmentsS() { // fn#97139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:2002, owner: ShareAttachments.S, offset: 0x021745ab, size: 106 bytes, params: 1, frame: 17
const withTiming = TimingModule.withTiming;
let binding = env0_1;
let get = binding.get;
const value3 = Reflect.apply(get, binding, []);
binding = env0_3;
get = binding.get;
const value4 = value3 + Reflect.apply(get, binding, []);
binding = env0_2;
get = binding.get;
return {opacity: Reflect.apply(withTiming, TimingModule, [value4 >= Reflect.apply(get, binding, []) ? 0 : 1,
env1_8])};
}
function ShareAttachmentsV({contentOffset, contentSize, layoutMeasurement}) { // fn#97140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:2270, owner: ShareAttachments.v, offset: 0x02174615, size: 85 bytes, params: 2, frame: 13
let binding = env0_1;
binding.set(contentOffset.x);
binding = env0_2;
binding.set(contentSize.width);
binding = env0_3;
binding.set(layoutMeasurement.width);
}
function _fun97141({nativeEvent}) { // fn#97141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:2492, offset: 0x0217466a, size: 41 bytes, params: 2, frame: 11
const binding = env0_3;
binding.set(nativeEvent.layout.width);
}
function _fun97142(a0) { // fn#97142, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:2554, offset: 0x010c54ad, size: 24 bytes, params: 2, frame: 11
env0_2.set(a0);
}
function _fun97143() { // fn#97143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:2587, offset: 0x02174693, size: 59 bytes, params: 1, frame: 13
let value = environment.__proto__;
value = require(4000) /* metro dependency 4000: ColorUtils */;
return value.hexWithOpacity(styles.gradient.color, 0);
}
function _fun97144(a0, a1) { // fn#97144, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12867:3307, offset: 0x021746ce, size: 200 bytes, params: 3, frame: 24
let value = environment.__proto__;
const defaultImportProps = {'uri': null, 'width': 60, 'height': 60, uri: a0.uri};
value = require(4660) /* metro dependency 4660: UploadUtils */;
defaultImportProps.isImage = value.isImage(a0.uri, a0.mimeType);
value = require(4660) /* metro dependency 4660: UploadUtils */;
defaultImportProps.isVideo = value.isVideo(a0.uri, a0.mimeType);
defaultImportProps.fileName = a0.name;
defaultImportProps.showPlayOnVideoPreview = true;
return (
<View style={styles.attachmentPreview} key={a1}>
<AttachmentPreview {...defaultImportProps} />
</View>
);
}
}
}
global.__d(_fun97136, 12677, [31, 27, 33, 4017, 4589, 1305, 4501, 697, 4504, 4000, 1244, 11143, 4660,
2]) /* metro module 12677, dependencies: [31, 27, 33, 4017, 4589, 1305, 4501, 697, 4504, 4000, 1244, 11143, 4660, 2] */;