decord/source/modules/quests/native/BountiesModal/useBountyVideoProgressPersistence.tsx

84 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 14142
// Function ID: 14143
2026-07-20 16:05:17 +00:00
// Name: useBountyVideoProgressPersistence
2026-08-05 07:35:12 +00:00
// Dependencies: [32, 19, 7053, 5113, 10867, 14139, 10871, 2]
2026-07-20 16:05:17 +00:00
// Exports: useBountyVideoProgressPersistence
2026-08-05 07:35:12 +00:00
// Module 14142 (useBountyVideoProgressPersistence)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
import set from "set";
2026-07-23 10:11:24 +00:00
import { QuestsExperimentLocations } from "QuestsExperimentLocations";
const require = arg1;
let closure_6 = { timestampSec: 0, maxTimestampSec: 0, duration: 0 };
2026-07-29 08:29:29 +00:00
let result = require("set").fileFinishedImporting("modules/quests/native/BountiesModal/useBountyVideoProgressPersistence.tsx");
2026-07-20 16:05:17 +00:00
export const useBountyVideoProgressPersistence = function useBountyVideoProgressPersistence(bountyId) {
bountyId = bountyId.bountyId;
2026-07-23 10:11:24 +00:00
const endMode = bountyId.endMode;
2026-07-20 16:05:17 +00:00
let callback;
let React;
2026-07-29 08:29:29 +00:00
let set;
2026-07-23 10:11:24 +00:00
let QuestsExperimentLocations;
2026-07-20 16:05:17 +00:00
let closure_6;
2026-07-23 10:11:24 +00:00
let obj = bountyId(endMode[4]);
const bountiesExperience = obj.useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
2026-07-20 16:05:17 +00:00
callback = tmp2;
const first = callback(React.useState(() => {
2026-07-23 10:11:24 +00:00
if (c2) {
2026-07-20 16:05:17 +00:00
let bountyVideoProgress = ref2.getBountyVideoProgress(bountyId);
if (null == bountyVideoProgress) {
bountyVideoProgress = closure_6;
} else if (endMode === bountyId(endMode[5]).BountyVideoEndMode.LOOP) {
const duration = bountyVideoProgress.duration;
let tmp10 = duration > 0;
if (tmp10) {
tmp10 = tmp9 >= duration - 1;
}
}
return bountyVideoProgress;
} else {
return closure_6;
}
}), 1)[0];
React = React.useRef(0);
2026-07-29 08:29:29 +00:00
set = React.useRef(first.timestampSec);
2026-07-23 10:11:24 +00:00
QuestsExperimentLocations = React.useRef(first.maxTimestampSec);
2026-07-20 16:05:17 +00:00
closure_6 = React.useRef(first.duration);
obj = {
initialProgress: first,
handleProgress: React.useCallback((current, current2, current3) => {
2026-07-29 08:29:29 +00:00
set.current = current3;
2026-07-20 16:05:17 +00:00
closure_5.current = current;
closure_6.current = current2;
2026-07-23 10:11:24 +00:00
let tmp = c2;
if (c2) {
2026-07-20 16:05:17 +00:00
tmp = current3 >= ref.current;
}
if (tmp) {
ref.current = current3 + 1;
let obj = bountyId(endMode[6]);
2026-07-29 08:29:29 +00:00
obj = { timestampSec: null, maxTimestampSec: null, duration: null };
obj[0] = current3;
obj[1] = current;
obj[2] = current2;
2026-07-20 16:05:17 +00:00
const result = obj.setBountyVideoProgress(bountyId, obj);
}
}, items),
flushProgress: React.useCallback(() => {
2026-07-23 10:11:24 +00:00
if (c2) {
2026-07-20 16:05:17 +00:00
let obj = bountyId(endMode[6]);
2026-07-29 08:29:29 +00:00
obj = { timestampSec: null, maxTimestampSec: null, duration: null };
obj[0] = ref2.current;
obj[1] = ref3.current;
obj[2] = ref4.current;
2026-07-20 16:05:17 +00:00
const result = obj.setBountyVideoProgress(bountyId, obj);
}
}, items1)
};
2026-07-23 10:11:24 +00:00
items = [bountiesExperience.ownedByVerticalScrollExperiment || bountiesExperience.stage1Enabled, bountyId];
items1 = [bountiesExperience.ownedByVerticalScrollExperiment || bountiesExperience.stage1Enabled, bountyId];
2026-07-20 16:05:17 +00:00
return obj;
};