169 lines
9.3 KiB
TypeScript
169 lines
9.3 KiB
TypeScript
/* Metro module 13533; source: modules/quests/native/BountiesModal/useBountiesModalTiming.tsx; dependencies: [57, 31, 6528, 9530, 2] */
|
|
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
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 QuestConstantsModule from '../../QuestConstants.tsx'; /* Metro dependency 6528 */
|
|
import * as BountiesStage1ExperimentModule from '../../experiments/BountiesStage1Experiment.tsx'; /* Metro dependency 9530 */
|
|
|
|
function _fun102855(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#102855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:6, offset: 0x0224b836, size: 197 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/quests/native/BountiesModal/useBountiesModalTiming.tsx');
|
|
exports.BountyVideoEndMode = {END_CARD: 'END_CARD', END_CARD_WITH_CTA: 'END_CARD_WITH_CTA', LOOP: 'LOOP'};
|
|
exports.useBountiesModalTiming = useBountiesModalTiming;
|
|
function useBountiesModalTiming({endMode, rewardDurationMs, isCompleted, onRewardEarned, onVideoProgress, onVideoEnd, onVideoLooped, onVideoPaused, onVideoResumed, playerRef, initialProgressSec, initialMaxVideoProgressSec, initialVideoDurationSec}) { // fn#102856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:400, offset: 0x0224b8fb, size: 901 bytes, params: 2, frame: 35
|
|
var r7;
|
|
var value20;
|
|
const onRewardEarned2 = onRewardEarned;
|
|
const onVideoProgress2 = onVideoProgress;
|
|
const onVideoLooped2 = onVideoLooped;
|
|
initialProgressSec = initialProgressSec === undefined ? 0 : initialProgressSec;
|
|
initialMaxVideoProgressSec = initialMaxVideoProgressSec === undefined ? 0 : initialMaxVideoProgressSec;
|
|
initialVideoDurationSec = initialVideoDurationSec === undefined ? null : initialVideoDurationSec;
|
|
let binding = onVideoProgress2;
|
|
let useState = binding.useState;
|
|
const value5 = Reflect.apply(useState, binding,
|
|
[initialVideoDurationSec != null && initialProgressSec >= initialVideoDurationSec - 1 && endMode !== onVideoLooped2.LOOP]);
|
|
binding = onRewardEarned2;
|
|
const value6 = binding(value5, 2);
|
|
const property = value6[0];
|
|
const env0_11 = value6[1];
|
|
const binding2 = onVideoProgress2;
|
|
useState = binding2.useState;
|
|
const value8 = binding(Reflect.apply(useState, binding2, [_fun102857]), 2);
|
|
const property2 = value8[0];
|
|
const env0_12 = value8[1];
|
|
useState = binding2.useState;
|
|
const value9 = binding(Reflect.apply(useState, binding2, [null]), 2);
|
|
const property3 = value9[0];
|
|
const env0_13 = value9[1];
|
|
useState = binding2.useState;
|
|
const value10 = binding(Reflect.apply(useState, binding2, [initialMaxVideoProgressSec]), 2);
|
|
const property4 = value10[0];
|
|
const env0_14 = value10[1];
|
|
useState = binding2.useState;
|
|
const value11 = binding(Reflect.apply(useState, binding2, [initialVideoDurationSec]), 2);
|
|
const property5 = value11[0];
|
|
const env0_15 = value11[1];
|
|
const env0_16 = binding2.useRef(isCompleted);
|
|
const env0_17 = binding2.useRef(initialMaxVideoProgressSec);
|
|
const env0_18 = binding2.useRef(initialVideoDurationSec ?? 0);
|
|
binding = onVideoProgress2;
|
|
const env0_19 = binding.useRef(0);
|
|
const env0_20 = binding.useRef(0);
|
|
const value12 = binding.useCallback(_fun102858, [onVideoProgress, onRewardEarned, rewardDurationMs]);
|
|
const value13 = binding.useCallback(_fun102859, [endMode, onVideoEnd, onVideoLooped, onRewardEarned]);
|
|
const value14 = binding.useCallback(_fun102860, [playerRef]);
|
|
const value15 = binding.useCallback(_fun102861, [onVideoPaused]);
|
|
const value16 = binding.useCallback(_fun102862, [onVideoResumed]);
|
|
const value17 = 1000 * property4;
|
|
const value18 = rewardDurationMs / 1000;
|
|
let Math = global.Math;
|
|
const value19 = Math.max(0, value18 - property4);
|
|
if (value17 >= rewardDurationMs) {
|
|
r7 = 0;
|
|
} else if (property) {
|
|
r7 = 0;
|
|
} else if (isCompleted) {
|
|
r7 = 0;
|
|
} else if (property5 == null) {
|
|
r7 = value19;
|
|
} else if (property5 > 0) {
|
|
Math = global.Math;
|
|
value20 = Math.min(value18, property5);
|
|
Math = global.Math;
|
|
r7 = Math.max(0, value20 - property4);
|
|
} else {
|
|
r7 = value19;
|
|
}
|
|
const BountiesStage1Experiment = (BountiesStage1ExperimentModule).BountiesStage1Experiment;
|
|
const useConfig = BountiesStage1Experiment.useConfig;
|
|
const VIDEO_MODAL_MOBILE = QuestsExperimentLocations.VIDEO_MODAL_MOBILE;
|
|
return {isCtaVisible: (isCompleted || value17 > Reflect.apply(useConfig, BountiesStage1Experiment,
|
|
[{location: VIDEO_MODAL_MOBILE}]).ctaTimerMilliSeconds) && !(property && endMode !== onVideoLooped2.END_CARD_WITH_CTA),
|
|
isEndCardVisible: property, handleVideoEnd: value13, handleVideoProgress: value12, handleVideoPaused: value15,
|
|
handleVideoResumed: value16, handleReplay: value14, rewardRemainingSeconds: r7, rewardTotalSeconds: value18,
|
|
normalizedProgress: property3 ?? property2, maxVideoProgressSeconds: property4, videoDuration: property5};
|
|
function _fun102857() { // fn#102857, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:755, offset: 0x0224bc80, size: 32 bytes, params: 1, frame: 3
|
|
return initialVideoDurationSec != null ? initialProgressSec / initialVideoDurationSec : 0;
|
|
}
|
|
|
|
function _fun102858({progress, currentTime, seekableDuration}) { // fn#102858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:1015, offset: 0x0224bca0, size: 191 bytes, params: 2, frame: 18
|
|
env0_13(null);
|
|
const Math = global.Math;
|
|
const value2 = Math.max(currentTime, env0_17.current);
|
|
env0_17.current = value2;
|
|
env0_18.current = seekableDuration;
|
|
env0_20.current = currentTime;
|
|
env0_12(progress);
|
|
env0_14(value2);
|
|
env0_15(seekableDuration);
|
|
onVideoProgress(value2, seekableDuration, currentTime);
|
|
if (!env0_16.current && 1000 * value2 >= rewardDurationMs) {
|
|
env0_16.current = true;
|
|
onRewardEarned();
|
|
}
|
|
}
|
|
|
|
function _fun102859() { // fn#102859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:1230, offset: 0x0224bd5f, size: 141 bytes, params: 1, frame: 14
|
|
var binding;
|
|
var onVideoLoopedBinding;
|
|
const onVideoEndBinding = onVideoEnd;
|
|
let current = env0_17.current;
|
|
onVideoEndBinding(current, env0_18.current);
|
|
const endModeBinding = endMode;
|
|
const LOOP = env1_5.LOOP;
|
|
if (endModeBinding === LOOP) {
|
|
binding = env0_19;
|
|
current = binding.current;
|
|
binding.current = current + 1;
|
|
onVideoLoopedBinding = onVideoLooped;
|
|
current = env0_19.current;
|
|
onVideoLoopedBinding(current);
|
|
} else {
|
|
env0_11(true);
|
|
}
|
|
if (!env0_16.current) {
|
|
env0_16.current = true;
|
|
onRewardEarned();
|
|
}
|
|
}
|
|
|
|
function _fun102860() { // fn#102860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:1363, offset: 0x0224bdec, size: 73 bytes, params: 1, frame: 14
|
|
var r2;
|
|
var r3;
|
|
var current;
|
|
const value2 = playerRef == null;
|
|
const value3 = undefined;
|
|
if (value2) {
|
|
r2 = value2;
|
|
r3 = value3;
|
|
} else {
|
|
current = playerRef.current;
|
|
r2 = current == null;
|
|
r3 = current;
|
|
}
|
|
if (!r2) {
|
|
r3.seekToStart();
|
|
}
|
|
env0_13(0);
|
|
env0_11(false);
|
|
return value3;
|
|
}
|
|
|
|
function _fun102861(a0) { // fn#102861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:1455, offset: 0x0224be35, size: 29 bytes, params: 2, frame: 13
|
|
onVideoPaused(env0_20.current, a0);
|
|
}
|
|
|
|
function _fun102862(a0) { // fn#102862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13723:1498, offset: 0x0224be52, size: 29 bytes, params: 2, frame: 13
|
|
onVideoResumed(env0_20.current, a0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun102855, 13533, [57, 31, 6528, 9530,
|
|
2]) /* metro module 13533, dependencies: [57, 31, 6528, 9530, 2] */;
|