Files
discord-decomp/sources/modules/quests/native/VideoQuestModal/VideoQuestModal.tsx
T
2026-07-27 16:20:00 +03:00

305 lines
18 KiB
TypeScript

/* Metro module 13596; source: modules/quests/native/VideoQuestModal/VideoQuestModal.tsx; dependencies: [57, 31, 27, 661, 33, 4501, 697, 13597, 7717, 7110, 13573, 8621, 4017, 4577, 1585, 8141, 13598, 6618, 13601, 13629, 9480, 9483, 10183, 6531, 10121, 2] */
function _fun103329(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#103329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:6, offset: 0x0226266f, size: 577 bytes, params: 8, frame: 29
var object3;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
let value = importAll(31) /* metro dependency 31 */;
const value2 = require(27) /* metro dependency 27 */;
const env0_5 = value2.View;
const StyleSheet = value2.StyleSheet;
const env0_6 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
const value3 = require(33) /* metro dependency 33 */;
const env0_7 = value3.jsx;
const env0_8 = value3.jsxs;
const env0_9 = {'mass': 1.9, 'damping': 18, 'stiffness': 80, 'overshootClamping': true};
object3 = {WATCH_VIDEO: 0};
object3[0] = 'WATCH_VIDEO';
object3.POST_WATCH_VIDEO = 1;
object3[1] = 'POST_WATCH_VIDEO';
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
const object5 = {wrapper: {'flexDirection': 'column', 'flexGrow': 1, 'flexShrink': 1, 'zIndex': 1}};
object5.contentWrapper = {flex: 1};
const object7 = {};
copyDataProperties(object7, StyleSheet.absoluteFillObject, undefined);
object7['borderRadius'] = (importDefault(697) /* metro dependency 697: native */).radii.lg;
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object7['backgroundColor'] = BACKGROUND_BASE_LOWEST;
object5.contentBackground = object7;
object5.modalContentWrapper = {zIndex: 2};
const object8 = {};
copyDataProperties(object8, StyleSheet.absoluteFillObject, undefined);
object8['borderRadius'] = (importDefault(697) /* metro dependency 697: native */).radii.lg;
object8['flex'] = 1;
object8['overflow'] = 'hidden';
object8['pointerEvents'] = 'none';
object8['zIndex'] = 1;
object5.backgroundWrapper = object8;
const env0_11 = Reflect.apply(createStyles, createStylesModule, [object5]);
const env0_12 = {code: 'function VideoQuestModalTsx1(){const{withSpring,clamp,postWatchAnimationState,BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG,interpolate,CLOUDS_BACKGROUND_INVISIBLE_OFFSET_Y}=this.__closure;return{opacity:withSpring(clamp(postWatchAnimationState.get(),0,1),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG),transform:[{translateY:withSpring(interpolate(postWatchAnimationState.get(),[0,1],[CLOUDS_BACKGROUND_INVISIBLE_OFFSET_Y,0]),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG)}]};}'};
const env0_13 = {code: 'function VideoQuestModalTsx2(){const{withSpring,interpolate,postWatchAnimationState,safeAreaInsets,BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG}=this.__closure;return{transform:[{translateY:withSpring(interpolate(postWatchAnimationState.get(),[0,1],[safeAreaInsets.top,0]),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG)}],opacity:withSpring(postWatchAnimationState.get(),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG)};}'};
const env0_14 = value.memo(_fun103330);
value = value.memo(VideoQuestModal);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/native/VideoQuestModal/VideoQuestModal.tsx');
exports.default = value;
exports.VideoQuestModalSteps = object3;
}
function _fun103330({onClose, initialStep, sourceQuestContent}) { // fn#103330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:1689, offset: 0x022628b0, size: 1314 bytes, params: 2, frame: 38
var object2;
var r12;
var value;
const {quest,
videoSessionId} = (require(13597) /* metro dependency 13597: VideoQuestModalContext */).useVideoQuestModalContext();
const env0_3 = videoSessionId;
const userStatus = quest.userStatus;
const value4 = userStatus?.completedAt != null;
let binding = env0_4;
let useState = binding.useState;
const value5 = Reflect.apply(useState, binding,
[initialStep ?? (value4 ? env0_10.POST_WATCH_VIDEO : env0_10.WATCH_VIDEO)]);
binding = env0_3;
const value6 = binding(value5, 2);
const property = value6[0];
const env0_6 = value6[1];
const binding3 = env0_4;
useState = binding3.useState;
const value9 = binding(Reflect.apply(useState, binding3, [false]), 2);
const property2 = value9[0];
const env0_7 = value9[1];
const value10 = binding3.useCallback(_fun103331, [quest.id, videoSessionId, sourceQuestContent]);
const useContext = binding3.useContext;
const QuestDockGestureContext = (require(13573) /* metro dependency 13573: QuestDockGestureContext */).QuestDockGestureContext;
const windowDimensions = Reflect.apply(useContext, binding3, [QuestDockGestureContext]).windowDimensions;
const styles = useStyles();
const height = (importDefault(8621) /* metro dependency 8621: useStateFromSharedValue */)(windowDimensions).height;
binding3.useLayoutEffect(_fun103332, [value4, initialStep]);
let closure = _fun103333;
const value11 = binding3.useCallback(closure, []);
const value12 = binding3.useCallback(_fun103334, [value10]);
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useSharedValue = reanimatedRexportModule.useSharedValue;
let POST_WATCH_VIDEO = env0_10.POST_WATCH_VIDEO;
const value13 = Reflect.apply(useSharedValue, reanimatedRexportModule, [property !== POST_WATCH_VIDEO ? 0 : 1]);
const env0_9 = value13;
const moduleValue3 = reanimatedRexportModule;
let useAnimatedStyle = moduleValue3.useAnimatedStyle;
closure = M_103335;
object2 = {withSpring: (require(4577) /* metro dependency 4577: spring */).withSpring,
clamp: reanimatedRexportModule.clamp, postWatchAnimationState: value13};
binding = env0_9;
object2.BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG = binding;
object2.interpolate = reanimatedRexportModule.interpolate;
object2.CLOUDS_BACKGROUND_INVISIBLE_OFFSET_Y = -100;
closure.__closure = object2;
closure.__workletHash = 11571705142399;
closure.__initData = env0_12;
const value14 = Reflect.apply(useAnimatedStyle, moduleValue3, [closure]);
const value15 = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)();
var env0_10 = value15;
const moduleValue4 = reanimatedRexportModule;
useAnimatedStyle = moduleValue4.useAnimatedStyle;
closure = U_103336;
closure.__closure = {withSpring: (require(4577) /* metro dependency 4577: spring */).withSpring,
interpolate: reanimatedRexportModule.interpolate, postWatchAnimationState: value13, safeAreaInsets: value15,
BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG: binding};
closure.__workletHash = 9769051401109;
closure.__initData = env0_13;
const value16 = Reflect.apply(useAnimatedStyle, moduleValue4, [closure]);
env0_4.useEffect(_fun103337, [value13, property]);
const ReanimatedNativeView = importDefault(8141) /* metro dependency 8141: ReanimatedNativeView */;
const view = <View style={[styles.backgroundWrapper,
{height: height}]}><ReanimatedNativeView style={[styles.contentBackground,
{top: value15.top}]} /><ReanimatedNativeView style={[styles.contentBackground,
value16]} /><ReanimatedNativeView style={value14}>{((Component) => <Component align="top" />)(importDefault(13598) /* metro dependency 13598: QuestModalContentCloudBackground */)}</ReanimatedNativeView></View>;
const SafeAreaPaddingView = (require(6618) /* metro dependency 6618: SafeAreaView */).SafeAreaPaddingView;
const items6 = [styles.wrapper];
items6[1] = {height: height};
const WATCH_VIDEO = env0_10.WATCH_VIDEO;
const items7 = [property === WATCH_VIDEO && ((Component) => <Component isFullscreen={property2} onNavigateToPostWatchVideo={value12} onClose={onClose} onEnd={value12} setIsFullscreen={value10} sourceQuestContent={sourceQuestContent} />)(importDefault(13601) /* metro dependency 13601: VideoQuestModalContentInProgress */)];
POST_WATCH_VIDEO = env0_10.POST_WATCH_VIDEO;
const value21 = property === POST_WATCH_VIDEO;
if (value21) {
value = importDefault(13629) /* metro dependency 13629: VideoQuestModalContentCompleted */;
value = ((Component) => <Component onClose={onClose} onRestartVideo={value11} sourceQuestContent={sourceQuestContent} />)(value);
r12 = value;
} else {
r12 = value21;
}
items7[1] = r12;
return (
<View>
<ReanimatedNativeView style={styles.modalContentWrapper}>
{view}
<SafeAreaPaddingView top style={items6}>
<View style={styles.contentWrapper}>
{items7}
</View>
</SafeAreaPaddingView>
</ReanimatedNativeView>
</View>
);
}
function VideoQuestModal({questId, questContentPosition, onClose, videoSessionId, initialStep, sourceQuestContent}) { // fn#103338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:4201, offset: 0x0226309a, size: 278 bytes, params: 2, frame: 22
const binding = sourceQuestContent;
const useCallback = binding.useCallback;
const value3 = (require(9483) /* metro dependency 9483: QuestHooks */).useNonNullableQuest(questId,
Reflect.apply(useCallback, binding, [_fun103339, [onClose]]));
const value4 = binding.useMemo(_fun103340, [onClose, value3, videoSessionId, questContentPosition, initialStep,
sourceQuestContent]);
binding.useLayoutEffect(_fun103344, []);
if (value3 == null || value4 == null) {
return null;
} else {
const Modal = (require(10121) /* metro dependency 10121: ModalNative */).Modal;
return (
<Modal
hideTitle
initialRouteName="watch_mobile_video_quest"
screens={value4}
/>
);
}
}
function _fun103331(a0) { // fn#103331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:2018, offset: 0x02262dd2, size: 175 bytes, params: 2, frame: 17
const deviceOrientationModule = require(7717) /* metro dependency 7717: DeviceOrientation */;
const lockOrientation = deviceOrientationModule.lockOrientation;
if (a0) {
Reflect.apply(lockOrientation, deviceOrientationModule, ['LANDSCAPE', true]);
} else {
Reflect.apply(lockOrientation, deviceOrientationModule, ['PORTRAIT', true]);
}
env0_7(a0);
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestEvent({questId: quest.id,
event: a0 ? AnalyticEvents.QUEST_VIDEO_FULLSCREEN_ENTERED : AnalyticEvents.QUEST_VIDEO_FULLSCREEN_EXITED,
properties: {video_session_id: videoSessionId}, sourceQuestContent: sourceQuestContent});
}
function _fun103332() { // fn#103332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:2400, offset: 0x02262e81, size: 51 bytes, params: 1, frame: 12
var binding;
if (result && initialStep == null) {
binding = env0_6;
value = environment.__proto__;
binding(env1_10.POST_WATCH_VIDEO);
}
}
function _fun103333() { // fn#103333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:2473, offset: 0x02262eb4, size: 29 bytes, params: 1, frame: 11
const binding = env0_6;
const WATCH_VIDEO = env1_10.WATCH_VIDEO;
binding(WATCH_VIDEO);
}
function _fun103334() { // fn#103334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:2518, offset: 0x02262ed1, size: 40 bytes, params: 1, frame: 12
env0_8(false);
const binding = env0_6;
const POST_WATCH_VIDEO = env1_10.POST_WATCH_VIDEO;
binding(POST_WATCH_VIDEO);
}
function M_103335() { // fn#103335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:2644, offset: 0x02262ef9, size: 196 bytes, params: 1, frame: 25
const object3 = {};
let value = environment.__proto__;
const springModule = require(4577) /* metro dependency 4577: spring */;
let withSpring = springModule.withSpring;
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const clamp = reanimatedRexportModule.clamp;
let binding = env0_9;
const value4 = Reflect.apply(clamp, reanimatedRexportModule, [binding.get(), 0, 1]);
binding = env1_9;
object3.opacity = Reflect.apply(withSpring, springModule, [value4, binding]);
const object4 = {};
value = springModule;
withSpring = value.withSpring;
const moduleValue3 = reanimatedRexportModule;
object4.translateY = Reflect.apply(withSpring, value, [moduleValue3.interpolate(env0_9.get(), [0, 1], [-100, 0]),
binding]);
object3.transform = [object4];
return object3;
}
function U_103336() { // fn#103336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:3110, offset: 0x02262fbd, size: 174 bytes, params: 1, frame: 25
const object2 = {};
let value = environment.__proto__;
const springModule = require(4577) /* metro dependency 4577: spring */;
let withSpring = springModule.withSpring;
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const interpolate = reanimatedRexportModule.interpolate;
let binding = env0_9;
let get = binding.get;
const value4 = Reflect.apply(interpolate, reanimatedRexportModule, [Reflect.apply(get, binding, []), [0, 1],
[env0_10.top, 0]]);
binding = env1_9;
object2.transform = [{translateY: Reflect.apply(withSpring, springModule, [value4, binding])}];
value = springModule;
withSpring = value.withSpring;
const binding2 = env0_9;
get = binding2.get;
object2.opacity = Reflect.apply(withSpring, value, [Reflect.apply(get, binding2, []), binding]);
return object2;
}
function _fun103337() { // fn#103337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:3486, offset: 0x0226306b, size: 47 bytes, params: 1, frame: 13
const binding = env0_9;
const set = binding.set;
const binding2 = env0_5;
const value = environment.__proto__;
const POST_WATCH_VIDEO = env1_10.POST_WATCH_VIDEO;
Reflect.apply(set, binding, [binding2 !== POST_WATCH_VIDEO ? 0 : 1]);
}
function _fun103339() { // fn#103339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:4357, offset: 0x022631b0, size: 48 bytes, params: 1, frame: 11
const value = environment.__proto__;
(require(9480) /* metro dependency 9480: QuestUtilsNative */).showQuestUnavailableAlert();
onClose();
}
function _fun103340() { // fn#103340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:4459, offset: 0x022631e0, size: 69 bytes, params: 1, frame: 5
const value = null;
return value == env0_5 ? value : {['watch_mobile_video_quest']: {fullscreen: true, headerLeft: function() {
return null;
}, render: render_103342}};
}
function _fun103344() { // fn#103344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:4956, offset: 0x0226332a, size: 60 bytes, params: 1, frame: 17
const value = environment.__proto__;
(require(7717) /* metro dependency 7717: DeviceOrientation */).lockOrientation('PORTRAIT', true);
return (require(7717) /* metro dependency 7717: DeviceOrientation */).restoreDefaultOrientation;
}
function render_103342() { // fn#103342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:4523, offset: 0x02263225, size: 208 bytes, params: 1, frame: 22
const Provider = (importDefault(13597) /* metro dependency 13597: VideoQuestModalContext */).Provider;
const object = {};
const binding = env1_5;
object.quest = binding;
object.videoSessionId = videoSessionId;
const QuestDockGestureContextProvider = (require(13573) /* metro dependency 13573: QuestDockGestureContext */).QuestDockGestureContextProvider;
const QuestContentImpressionTrackerNative = (require(10183) /* metro dependency 10183: QuestContentImpressionTrackerNative */).QuestContentImpressionTrackerNative;
const QuestContent = (require(6531) /* metro dependency 6531: QuestTypes */).QuestContent;
const VIDEO_MODAL_MOBILE = QuestContent.VIDEO_MODAL_MOBILE;
return (
<Provider value={object}>
<QuestDockGestureContextProvider>
<QuestContentImpressionTrackerNative
overrideVisibility
questContent={VIDEO_MODAL_MOBILE}
questOrQuests={binding}
questContentPosition={questContentPosition}
sourceQuestContent={sourceQuestContent}
>
{children_103343}
</QuestContentImpressionTrackerNative>
</QuestDockGestureContextProvider>
</Provider>
);
}
function render_103342Children() { // fn#103343, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13786:4835, owner: render_103342.children, offset: 0x022632f5, size: 53 bytes, params: 1, frame: 14
return ((Component) => <Component initialStep={initialStep} onClose={onClose} sourceQuestContent={sourceQuestContent} />)(env3_14);
}