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

80 lines
4.5 KiB
TypeScript

/* Metro module 13537; source: modules/quests/native/BountiesModal/useBountyVideoProgressPersistence.tsx; dependencies: [57, 31, 7092, 6528, 9530, 13533, 9532, 2] */
function _fun102883(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#102883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13727:6, offset: 0x0224ca4f, size: 189 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
const env0_3 = importAll(31) /* metro dependency 31 */;
const bountyStore = importDefault(7092) /* metro dependency 7092: BountyStore */;
const env0_5 = (require(6528) /* metro dependency 6528: QuestConstants */).QuestsExperimentLocations;
const env0_6 = {'timestampSec': 0, 'maxTimestampSec': 0, 'duration': 0};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/native/BountiesModal/useBountyVideoProgressPersistence.tsx');
exports.useBountyVideoProgressPersistence = useBountyVideoProgressPersistence;
}
function useBountyVideoProgressPersistence({bountyId, endMode}) { // fn#102884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13727:353, offset: 0x0224cb0c, size: 284 bytes, params: 2, frame: 17
var object2;
const BountiesStage1Experiment = (require(9530) /* metro dependency 9530: BountiesStage1Experiment */).BountiesStage1Experiment;
const useConfig = BountiesStage1Experiment.useConfig;
const VIDEO_MODAL_MOBILE = QuestsExperimentLocations.VIDEO_MODAL_MOBILE;
const enabled = Reflect.apply(useConfig, BountiesStage1Experiment, [{location: VIDEO_MODAL_MOBILE}]).enabled;
const env0_2 = enabled;
const binding = env0_3;
const property = env0_2(binding.useState(_fun102885), 1)[0];
var env0_3 = binding.useRef(0);
const env0_4 = binding.useRef(property.timestampSec);
const env0_5 = binding.useRef(property.maxTimestampSec);
const env0_6 = binding.useRef(property.duration);
object2 = {initialProgress: property};
object2.handleProgress = binding.useCallback(_fun102886, [enabled, bountyId]);
object2.flushProgress = binding.useCallback(_fun102887, [enabled, bountyId]);
return object2;
}
function _fun102885() { // fn#102885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13727:524, offset: 0x0224cc28, size: 136 bytes, params: 1, frame: 15
var value3;
if (enabled) {
value3 = BountyStore.getBountyVideoProgress(bountyId);
return value3 == null ? env1_6 : endMode !== (require(13533) /* metro dependency 13533: useBountiesModalTiming */).BountyVideoEndMode.LOOP ? value3.timestampSec <= 5 ? env1_6 : value3 : value3.duration > 0 && value3.maxTimestampSec >= value3.duration - 1 || value3.timestampSec <= 5 ? env1_6 : value3;
}
return env1_6;
}
function _fun102886(a0, a1, a2) { // fn#102886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13727:902, offset: 0x0224ccb0, size: 143 bytes, params: 4, frame: 16
var value3;
var moduleValue;
env0_4.current = a2;
env0_5.current = a0;
env0_6.current = a1;
if (enabled && a2 >= env0_3.current) {
env0_3.current = a2 + 1;
value3 = environment.__proto__;
moduleValue = require(9532) /* metro dependency 9532: BountyActionCreators */;
moduleValue.setBountyVideoProgress(bountyId, {timestampSec: a2, maxTimestampSec: a0, duration: a1});
}
}
function _fun102887() { // fn#102887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13727:1099, offset: 0x0224cd3f, size: 98 bytes, params: 1, frame: 15
var value2;
var moduleValue;
var setBountyVideoProgress;
var bountyIdBinding;
var object2;
var current;
if (enabled) {
value2 = environment.__proto__;
moduleValue = require(9532) /* metro dependency 9532: BountyActionCreators */;
setBountyVideoProgress = moduleValue.setBountyVideoProgress;
bountyIdBinding = bountyId;
object2 = {};
current = env0_4.current;
object2.timestampSec = current;
current = env0_5.current;
object2.maxTimestampSec = current;
current = env0_6.current;
object2.duration = current;
Reflect.apply(setBountyVideoProgress, moduleValue, [bountyIdBinding, object2]);
}
}