decord/source/modules/frames/panel/native/QuestActivityButton.tsx

258 lines
10 KiB
TypeScript
Raw Normal View History

// Module ID: 17142
// Function ID: 17143
// Name: QuestActivityButton
// Dependencies: [19, 17, 4628, 7805, 17143, 5525, 21, 4373, 8574, 4636, 576, 11617, 504, 4839, 17144, 1896, 4603, 17145, 4637, 5610, 15213, 17146, 15085, 1114, 11649, 2]
2026-07-20 16:05:17 +00:00
// Module 17142 (QuestActivityButton)
import nativeDefault from "native" /* 576 */;
import asyncRequireImpl from "asyncRequireImpl" /* 1896 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4603 */;
import timing from "timing" /* 4637 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4839 */;
import QuestMatchingUtils from "QuestMatchingUtils" /* 11649 */;
import noop from "module_19" /* 19 */;
import AccessibilityStore from "AccessibilityStore" /* 4628 */;
import QuestStore from "QuestStore" /* 7805 */;
import UnenrolledActivityQuestStore from "UnenrolledActivityQuestStore" /* 17143 */;
import ReanimatedRexport from "ReanimatedRexport" /* 4373 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function QuestActivityButtonInner(quest) {
quest = quest.quest;
2026-08-24 06:08:38 +00:00
dependencyMap = undefined;
2026-07-23 10:11:24 +00:00
let num;
2026-08-24 06:08:38 +00:00
closure_4 = undefined;
2026-07-23 10:11:24 +00:00
let sharedValue;
let sharedValue1;
let ref;
let confetti;
let obj = quest(11617);
2026-07-23 10:11:24 +00:00
let items = [sharedValue];
const stateFromStores = quest(504).useStateFromStores(items, () => sharedValue.useReducedMotion);
2026-07-20 16:05:17 +00:00
const items1 = [, ];
({ id: arr2[0], userStatus } = quest);
let enrolledAt;
2026-07-29 08:29:29 +00:00
if (userStatus != null) {
2026-07-20 16:05:17 +00:00
enrolledAt = userStatus.enrolledAt;
}
items1[1] = enrolledAt;
2026-07-23 10:11:24 +00:00
let result = 2 * Math.PI * 14.3;
2026-07-20 16:05:17 +00:00
dependencyMap = result;
let enrolledAt1;
2026-07-23 10:11:24 +00:00
const callback = num.useCallback(() => {
2026-07-20 16:05:17 +00:00
const userStatus = quest.userStatus;
let enrolledAt;
2026-07-29 08:29:29 +00:00
if (userStatus != null) {
2026-07-20 16:05:17 +00:00
enrolledAt = userStatus.enrolledAt;
}
if (null == enrolledAt) {
const obj2 = { questId: tmp.id };
ModalActionCreatorsDefault.pushLazy(asyncRequireImpl(17144, dependencyMap.paths), obj2, QUEST_ACTIVITY_UNENROLLED_MODAL_KEY);
2026-07-20 16:05:17 +00:00
} else {
const obj4 = { questId: tmp.id };
ActionSheetActionCreatorsDefault.openLazy(asyncRequireImpl(17145, dependencyMap.paths), "QuestProgressBottomSheet", obj4);
2026-07-20 16:05:17 +00:00
}
}, items1);
2026-07-29 08:29:29 +00:00
if (quest != null) {
2026-07-20 16:05:17 +00:00
const userStatus2 = quest.userStatus;
2026-07-29 08:29:29 +00:00
if (userStatus2 != null) {
2026-07-20 16:05:17 +00:00
enrolledAt1 = userStatus2.enrolledAt;
}
}
2026-07-23 10:11:24 +00:00
num = 0;
2026-07-20 16:05:17 +00:00
if (null != enrolledAt1) {
num = obj.useQuestCompletionDetails(quest).completedRatio;
}
let enrolledAt2;
2026-07-29 08:29:29 +00:00
if (quest != null) {
2026-07-20 16:05:17 +00:00
const userStatus3 = quest.userStatus;
2026-07-29 08:29:29 +00:00
if (userStatus3 != null) {
2026-07-20 16:05:17 +00:00
enrolledAt2 = userStatus3.enrolledAt;
}
}
2026-07-29 08:29:29 +00:00
let tmp9 = null != enrolledAt2;
if (tmp9) {
2026-07-20 16:05:17 +00:00
let completedAt;
2026-07-29 08:29:29 +00:00
if (quest != null) {
2026-07-20 16:05:17 +00:00
const userStatus4 = quest.userStatus;
2026-07-29 08:29:29 +00:00
if (userStatus4 != null) {
2026-07-20 16:05:17 +00:00
completedAt = userStatus4.completedAt;
}
}
2026-07-29 08:29:29 +00:00
tmp9 = null != completedAt;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
closure_4 = tmp9;
let obj2 = quest(504);
sharedValue = quest(4373).useSharedValue(num);
const tmpResult = quest(4373);
2026-07-20 16:05:17 +00:00
let num2 = 0;
2026-07-29 08:29:29 +00:00
if (tmp9) {
2026-07-20 16:05:17 +00:00
num2 = 1;
}
sharedValue1 = quest(4373).useSharedValue(num2);
ref = obj3.useRef(null);
const tmp14 = closure_13();
confetti = tmp14;
const tmpResult4 = quest(4373);
2026-07-29 08:29:29 +00:00
const fn = function u() {
return { shadowOpacity: sharedValue1.get() };
};
fn.__closure = { glowOpacity: sharedValue1 };
fn.__workletHash = 4459043613798;
fn.__initData = __initData;
2026-07-29 08:29:29 +00:00
const items2 = [tmp14.confetti];
const animatedStyle = quest(4373).useAnimatedStyle(fn);
const memo = obj3.useMemo(() => {
2026-07-20 16:05:17 +00:00
const obj = {};
2026-08-24 06:08:38 +00:00
const merged = Object.assign(confetti.confetti);
obj.width = height;
obj.height = height;
2026-07-20 16:05:17 +00:00
const items = [{ scale: 1.6 }];
2026-07-29 08:29:29 +00:00
obj.transform = items;
2026-07-20 16:05:17 +00:00
return obj;
}, items2);
const tmpResult5 = quest(4373);
2026-07-29 08:29:29 +00:00
const fn2 = function l() {
return { strokeDashoffset: c2 - c2 * sharedValue.get() };
};
fn2.__closure = { circumference: result, animatedProgress: sharedValue };
fn2.__workletHash = 3373122453897;
fn2.__initData = __initData2;
2026-07-20 16:05:17 +00:00
const items3 = [sharedValue, num, stateFromStores];
const animatedProps = quest(4373).useAnimatedProps(fn2);
const effect = obj3.useEffect(() => {
2026-08-24 06:08:38 +00:00
num = 500;
2026-07-20 16:05:17 +00:00
if (stateFromStores) {
num = 0;
}
const result = sharedValue.set(timing.withTiming(num, { duration: num }));
2026-07-20 16:05:17 +00:00
return () => {
quest(c2[7]).cancelAnimation(sharedValue);
2026-07-20 16:05:17 +00:00
};
}, items3);
2026-07-29 08:29:29 +00:00
const items4 = [sharedValue1, tmp9, stateFromStores];
const effect1 = obj3.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (!stateFromStores) {
2026-08-24 06:08:38 +00:00
if (closure_4) {
const result = sharedValue1.set(timing.withTiming(1, { duration: 500 }));
2026-07-20 16:05:17 +00:00
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.play();
}
}
}
const result1 = sharedValue1.set(0);
const current2 = ref.current;
2026-07-29 08:29:29 +00:00
if (current2 != null) {
2026-07-20 16:05:17 +00:00
current2.reset();
}
}, items4);
let obj4 = { style: null, pointerEvents: "box-none", children: null };
const items5 = [, , ];
2026-07-29 08:29:29 +00:00
({ container: arr6[0], completionGlow: arr6[1] } = tmp14);
2026-07-20 16:05:17 +00:00
items5[2] = animatedStyle;
obj4.style = items5;
const obj5 = { style: memo, pointerEvents: "none", children: null };
const obj6 = { ref, source: null, autoPlay: false, loop: false };
const tmpResult6 = quest(4373);
obj6.source = quest(15213);
obj5.children = closure_9(stateFromStores(5610), obj6);
const items6 = [closure_9(closure_4, obj5), , , ];
const obj7 = { style: tmp14.buttonWrapper, children: null };
const obj8 = { icon: null, onPress: null, accessibilityLabel: null };
const tmp20 = stateFromStores(5610);
obj8.icon = stateFromStores(15085);
obj8.onPress = callback;
const intl = tmp(1114).intl;
obj8.accessibilityLabel = intl.string(quest(1114).t.JALI2K);
obj7.children = closure_9(stateFromStores(17146), obj8);
items6[1] = closure_9(closure_4, obj7);
const obj9 = { pointerEvents: "none", style: tmp14.canvas, children: null };
const size = { height: v32, width: v32, children: null };
const tmp21 = stateFromStores(17146);
size.children = closure_9(quest(8574).Circle, { cx: 16, cy: 16, r: 14.3, fill: "none", stroke: stateFromStores(576).unsafe_rawColors.OPACITY_32, strokeWidth: 3.4, strokeDasharray: result });
obj9.children = closure_9(quest(8574).Svg, size);
items6[2] = closure_9(closure_4, obj9);
const obj11 = { pointerEvents: "none", style: tmp14.canvas, children: null };
const size1 = { height: v32, width: v32, children: closure_9(closure_12, { cx: 16, cy: 16, r: 14.3, fill: "none", stroke: tmp14.progressPath.color, strokeWidth: 3.4, strokeDasharray: result, animatedProps }) };
obj11.children = closure_9(quest(8574).Svg, size1);
items6[3] = closure_9(closure_4, obj11);
obj4.children = items6;
return closure_10(stateFromStores(4373).View, obj4);
2026-07-20 16:05:17 +00:00
}
const View = fn(17).View;
const QuestVariants = fn(5525).QuestVariants;
const jsxProd = fn(21);
({ jsx: closure_9, jsxs: c10 } = jsxProd);
2026-07-23 10:11:24 +00:00
let c11 = 32;
let closure_12 = ReanimatedRexport.createAnimatedComponent(fn(8574).Circle);
const createStyles = fn(4636);
let obj = { container: { position: "relative", width: 32, height: 32, justifyContent: "center", alignItems: "center" }, completionGlow: { shadowOffset: { width: 0, height: 0 }, shadowRadius: 12, shadowOpacity: 0, elevation: 4, shadowColor: "#30C77399" }, canvas: null, progressPath: { color: nativeDefault.colors.STATUS_POSITIVE }, buttonWrapper: { position: "absolute", borderRadius: 16, overflow: "hidden" }, confetti: { position: "absolute" } };
let obj2 = { position: "absolute", transform: null };
let items = [{ rotate: "-90deg" }];
obj2.transform = items;
obj.canvas = obj2;
let closure_13 = createStyles.createStyles(obj);
const __initData = { code: "function QuestActivityButtonTsx1(){const{glowOpacity}=this.__closure;return{shadowOpacity:glowOpacity.get()};}" };
const __initData2 = { code: "function QuestActivityButtonTsx2(){const{circumference,animatedProgress}=this.__closure;return{strokeDashoffset:circumference-circumference*animatedProgress.get()};}" };
2026-07-23 10:11:24 +00:00
const QUEST_ACTIVITY_UNENROLLED_MODAL_KEY = "QUEST_ACTIVITY_UNENROLLED_MODAL_KEY";
let obj4 = { color: nativeDefault.colors.STATUS_POSITIVE };
let size = fn(2);
let result = size.fileFinishedImporting("modules/frames/panel/native/QuestActivityButton.tsx");
export default noop.memo(function QuestActivityButton(applicationId) {
2026-07-20 16:05:17 +00:00
applicationId = applicationId.applicationId;
2026-07-29 08:29:29 +00:00
let stateFromStores1;
let memo;
const items = [QuestStore];
const stateFromStores = applicationId(stateFromStores1[12]).useStateFromStores(items, () => quests.quests);
2026-07-23 10:11:24 +00:00
let obj = applicationId(stateFromStores1[12]);
const items1 = [UnenrolledActivityQuestStore];
2026-07-29 08:29:29 +00:00
stateFromStores1 = applicationId(stateFromStores1[12]).useStateFromStores(items1, () => state.getState().autoEnroll);
2026-07-20 16:05:17 +00:00
const items2 = [stateFromStores, applicationId];
2026-07-23 10:11:24 +00:00
memo = memo.useMemo(() => {
const eligibleQuestsForApplicationId = QuestMatchingUtils.getEligibleQuestsForApplicationId(stateFromStores, applicationId, true);
2026-07-20 16:05:17 +00:00
return eligibleQuestsForApplicationId.find((config) => {
const features = config.config.features;
2026-07-29 08:29:29 +00:00
return features.includes(constants.MOBILE_ACTIVITY_QUEST);
2026-07-20 16:05:17 +00:00
});
}, items2);
let obj2 = applicationId(stateFromStores1[12]);
const items3 = [UnenrolledActivityQuestStore];
const stateFromStores2 = applicationId(stateFromStores1[12]).useStateFromStores(items3, () => {
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (memo != null) {
2026-07-20 16:05:17 +00:00
id = memo.id;
}
return UnenrolledActivityQuestStore.isDismissed(id);
2026-07-20 16:05:17 +00:00
});
const items4 = [memo, stateFromStores1, stateFromStores2];
2026-07-23 10:11:24 +00:00
const effect = memo.useEffect(() => {
2026-07-29 08:29:29 +00:00
let tmp2 = null == memo;
if (!tmp2) {
const userStatus = tmp.userStatus;
2026-07-20 16:05:17 +00:00
let enrolledAt;
2026-07-29 08:29:29 +00:00
if (userStatus != null) {
2026-07-20 16:05:17 +00:00
enrolledAt = userStatus.enrolledAt;
}
2026-07-29 08:29:29 +00:00
tmp2 = null != enrolledAt;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp2) {
tmp2 = stateFromStores1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp2) {
tmp2 = stateFromStores2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp2) {
const obj2 = { questId: tmp.id };
ModalActionCreatorsDefault.pushLazy(asyncRequireImpl(17144, dependencyMap.paths), obj2, QUEST_ACTIVITY_UNENROLLED_MODAL_KEY);
2026-07-20 16:05:17 +00:00
}
}, items4);
let tmp6 = null;
if (null != memo) {
const obj4 = { quest: memo };
tmp6 = closure_9(QuestActivityButtonInner, obj4);
2026-07-20 16:05:17 +00:00
}
return tmp6;
});