284 lines
17 KiB
TypeScript
284 lines
17 KiB
TypeScript
/* Metro module 15384; source: modules/frames/panel/native/QuestActivityButton.tsx; dependencies: [31, 27, 4502, 7093, 15385, 6528, 33, 4017, 7744, 4501, 9483, 566, 5080, 15386, 1962, 4080, 15387, 4504, 6760, 13621, 15388, 13508, 1244, 697, 9524, 2] */
|
|
import Native from '../../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
|
|
import ReanimatedRexport from '../../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import AccessibilityStore from '../../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
|
|
import LottieAnimationView from '../../../../components_native/common/LottieAnimationView.tsx'; /* Metro dependency 6760 */
|
|
import QuestStore from '../../../quests/QuestStore.tsx'; /* Metro dependency 7093 */
|
|
import Module13508 from '../../../../by-id/module-13508.js'; /* Metro dependency 13508 */
|
|
import UnenrolledActivityQuestStore from '../../../quests/UnenrolledActivityQuestStore.tsx'; /* Metro dependency 15385 */
|
|
import VoicePanelIconButton from '../../../voice_panel/native/shared/VoicePanelIconButton.tsx'; /* Metro dependency 15388 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as ReanimatedRexportModule from '../../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import * as CreateStylesModule from '../../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TimingModule from '../../../../design/animation/reanimated/timing/timing.tsx'; /* Metro dependency 4504 */
|
|
import * as QuestConstantsModule from '../../../quests/QuestConstants.tsx'; /* Metro dependency 6528 */
|
|
import * as Module07744Module from '../../../../by-id/module-07744.js'; /* Metro dependency 7744 */
|
|
import * as QuestHooksModule from '../../../quests/hooks/QuestHooks.tsx'; /* Metro dependency 9483 */
|
|
import * as QuestMatchingUtilsModule from '../../../quests/utils/QuestMatchingUtils.tsx'; /* Metro dependency 9524 */
|
|
import * as Module13621Module from '../../../../by-id/module-13621.js'; /* Metro dependency 13621 */
|
|
|
|
function _fun117599(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:6, offset: 0x024ba1ec, size: 508 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactModule;
|
|
const createAnimatedComponent = ReanimatedRexport.createAnimatedComponent;
|
|
const Circle = (Module07744Module).Circle;
|
|
const env0_12 = Reflect.apply(createAnimatedComponent, ReanimatedRexport, [Circle]);
|
|
const env0_13 = (CreateStylesModule).createStyles({container: {'position': 'relative',
|
|
'width': 32, 'height': 32, 'justifyContent': 'center', 'alignItems': 'center'},
|
|
completionGlow: {'shadowOffset': null, 'shadowRadius': 12, 'shadowOpacity': 0, 'elevation': 4,
|
|
'shadowColor': '#30C77399', shadowOffset: {'width': 0, 'height': 0}}, canvas: {position: 'absolute',
|
|
transform: [{rotate: '-90deg'}]}, buttonWrapper: {'position': 'absolute', 'borderRadius': 16,
|
|
'overflow': 'hidden'}, confetti: {position: 'absolute'}});
|
|
object = {code: 'function QuestActivityButtonTsx1(){const{glowOpacity}=this.__closure;return{shadowOpacity:glowOpacity.get()};}'};
|
|
object = {code: 'function QuestActivityButtonTsx2(){const{circumference,animatedProgress}=this.__closure;return{strokeDashoffset:circumference-circumference*animatedProgress.get()};}'};
|
|
value = value.memo(QuestActivityButton);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/frames/panel/native/QuestActivityButton.tsx');
|
|
exports.default = value;
|
|
function QuestActivityButtonInner({quest}) { // fn#117600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:952, offset: 0x024ba3e8, size: 1323 bytes, params: 2, frame: 34
|
|
let env0_3 = undefined;
|
|
const useQuestCompletionDetails = QuestHooksModule.useQuestCompletionDetails;
|
|
const completedRatio = Reflect.apply(useQuestCompletionDetails, QuestHooksModule, [quest]).completedRatio;
|
|
const useReducedMotion = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore],
|
|
function() {
|
|
return AccessibilityStore.useReducedMotion;
|
|
});
|
|
let binding = env0_3;
|
|
const useCallback = binding.useCallback;
|
|
const userStatus = quest.userStatus;
|
|
const value3 = Reflect.apply(useCallback, binding, [_fun117602, [quest.id, userStatus?.enrolledAt]]);
|
|
const Math = global.Math;
|
|
const PI = Math.PI;
|
|
const value4 = 2 * PI * 14.3;
|
|
const r2 = (quest == null || quest.userStatus == null ? undefined : quest.userStatus.enrolledAt) != null ? completedRatio : 0;
|
|
env0_3 = r2;
|
|
const r12 = (quest == null || quest.userStatus == null ? undefined : quest.userStatus.enrolledAt) != null && (quest == null || quest.userStatus == null ? undefined : quest.userStatus.completedAt) != null;
|
|
const value8 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(r2);
|
|
const value10 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(r12 ? 1 : 0);
|
|
const value11 = env0_3.useRef(null);
|
|
const styles = useStyles();
|
|
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
|
|
let closure = QuestActivityButtonInnerE;
|
|
closure.__closure = {glowOpacity: value10};
|
|
closure.__workletHash = 4459043613798;
|
|
closure.__initData = env0_14;
|
|
const value12 = Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure]);
|
|
const value13 = env0_3.useMemo(_fun117604, [styles.confetti]);
|
|
const moduleValue6 = reanimatedRexportModule;
|
|
const useAnimatedProps = moduleValue6.useAnimatedProps;
|
|
closure = QuestActivityButtonInnerI;
|
|
closure.__closure = {circumference: value4, animatedProgress: value8};
|
|
closure.__workletHash = 3373122453897;
|
|
closure.__initData = env0_15;
|
|
const value14 = Reflect.apply(useAnimatedProps, moduleValue6, [closure]);
|
|
env0_3.useEffect(_fun117606, [value8, r2, useReducedMotion]);
|
|
env0_3.useEffect(_fun117608, [value10, r12, useReducedMotion]);
|
|
const View2 = (ReanimatedRexport).View;
|
|
const items3 = [styles.container];
|
|
items3[1] = styles.completionGlow;
|
|
items3[2] = value12;
|
|
const items2 = [
|
|
<View style={value13} pointerEvents="none">
|
|
{((Component) => <Component ref={value11} source={Module13621Module} autoPlay={false} loop={false} />)(LottieAnimationView)}
|
|
</View>,
|
|
];
|
|
const object4 = {icon: Module13508, onPress: value3};
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const JALI2K = (IndexNativeModule).t.JALI2K;
|
|
object4.accessibilityLabel = Reflect.apply(string, intl, [JALI2K]);
|
|
items2[1] = (
|
|
<View style={styles.buttonWrapper}>
|
|
<VoicePanelIconButton {...object4} />
|
|
</View>
|
|
);
|
|
let canvas = styles.canvas;
|
|
const Svg = (Module07744Module).Svg;
|
|
const object5 = {height: env0_11, width: env0_11};
|
|
const Circle = (Module07744Module).Circle;
|
|
const OPACITY_32 = (Native).unsafe_rawColors.OPACITY_32;
|
|
items2[2] = (
|
|
<View pointerEvents="none" style={canvas}>
|
|
<Svg {...object5}>
|
|
<Circle
|
|
cx={16}
|
|
cy={16}
|
|
r={14.3}
|
|
fill="none"
|
|
stroke={OPACITY_32}
|
|
strokeWidth={3.4}
|
|
strokeDasharray={value4}
|
|
/>
|
|
</Svg>
|
|
</View>
|
|
);
|
|
canvas = styles.canvas;
|
|
const object6 = {height: env0_11, width: env0_11};
|
|
binding = env0_12;
|
|
const GREEN_300 = (Native).unsafe_rawColors.GREEN_300;
|
|
items2[3] = (
|
|
<View pointerEvents="none" style={canvas}>
|
|
<Svg {...object6}>
|
|
{((Component) => <Component cx={16} cy={16} r={14.3} fill="none" stroke={GREEN_300} strokeWidth={3.4} strokeDasharray={value4} animatedProps={value14} />)(binding)}
|
|
</Svg>
|
|
</View>
|
|
);
|
|
return (
|
|
<View2 style={items3} pointerEvents="box-none">
|
|
{items2}
|
|
</View2>
|
|
);
|
|
function _fun117602() { // fn#117602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:1145, offset: 0x024ba913, size: 222 bytes, params: 1, frame: 18
|
|
var value3;
|
|
var defaultImport;
|
|
var value5;
|
|
var defaultImport2;
|
|
const userStatus = quest.userStatus;
|
|
const value2 = undefined;
|
|
if ((userStatus == null ? value2 : userStatus.enrolledAt) == null) {
|
|
value5 = environment.__proto__;
|
|
defaultImport2 = importDefault(dependencyMap[12]);
|
|
defaultImport2.pushLazy(require(dependencyMap[14])(dependencyMap[13], dependencyMap.paths), {questId: quest.id},
|
|
env1_16);
|
|
} else {
|
|
value3 = environment.__proto__;
|
|
defaultImport = importDefault(dependencyMap[15]);
|
|
defaultImport.openLazy(require(dependencyMap[14])(dependencyMap[16], dependencyMap.paths),
|
|
'QuestProgressBottomSheet', {questId: quest.id});
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function QuestActivityButtonInnerE() { // fn#117603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:1730, owner: QuestActivityButtonInner.E, offset: 0x024ba9f1, size: 25 bytes, params: 1, frame: 10
|
|
const object = {};
|
|
object.shadowOpacity = env0_6.get();
|
|
return object;
|
|
}
|
|
|
|
function _fun117604() { // fn#117604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:1849, offset: 0x024baa0a, size: 87 bytes, params: 1, frame: 13
|
|
const object = {};
|
|
copyDataProperties(object, styles.confetti, undefined);
|
|
object['width'] = env1_11;
|
|
object['height'] = env1_11;
|
|
object['transform'] = [{scale: 1.6}];
|
|
return object;
|
|
}
|
|
|
|
function QuestActivityButtonInnerI() { // fn#117605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:1958, owner: QuestActivityButtonInner.I, offset: 0x024baa61, size: 37 bytes, params: 1, frame: 11
|
|
const binding = env0_2;
|
|
const binding2 = env0_5;
|
|
const get = binding2.get;
|
|
return {strokeDashoffset: binding - binding * Reflect.apply(get, binding2, [])};
|
|
}
|
|
|
|
function _fun117606() { // fn#117606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:2112, offset: 0x024baa86, size: 89 bytes, params: 1, frame: 17
|
|
const binding = env0_5;
|
|
const set = binding.set;
|
|
Reflect.apply(set, binding, [TimingModule.withTiming(env0_3, {duration: useReducedMotion ? 0 : 500})]);
|
|
return _fun117607;
|
|
function _fun117607() { // fn#117607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:2166, offset: 0x024baadf, size: 45 bytes, params: 1, frame: 12
|
|
const value = environment.__proto__.__proto__;
|
|
(ReanimatedRexportModule).cancelAnimation(env1_5);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun117608() { // fn#117608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:2223, offset: 0x024bab0c, size: 154 bytes, params: 1, frame: 16
|
|
var binding;
|
|
var set;
|
|
var value2;
|
|
var moduleValue;
|
|
var current;
|
|
if (useReducedMotion) {
|
|
env0_6.set(0);
|
|
current = env0_7.current;
|
|
if (current != null) {
|
|
current.reset();
|
|
}
|
|
} else if (ReactNativeModule.View) {
|
|
binding = env0_6;
|
|
set = binding.set;
|
|
value2 = environment.__proto__;
|
|
moduleValue = require(4504) /* metro dependency 4504: timing */;
|
|
Reflect.apply(set, binding, [moduleValue.withTiming(1, {duration: 500})]);
|
|
current = env0_7.current;
|
|
if (current != null) {
|
|
current.play();
|
|
}
|
|
} else {
|
|
env0_6.set(0);
|
|
current = env0_7.current;
|
|
if (current != null) {
|
|
current.reset();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function QuestActivityButton({applicationId}) { // fn#117609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:3203, offset: 0x024baba6, size: 263 bytes, params: 2, frame: 22
|
|
let useStateFromStores = FluxModule.useStateFromStores;
|
|
const quests = Reflect.apply(useStateFromStores, FluxModule, [[QuestStore], function() {
|
|
return QuestStore.quests;
|
|
}]);
|
|
useStateFromStores = FluxModule.useStateFromStores;
|
|
const unenrolledActivityQuestStoreBinding = UnenrolledActivityQuestStore;
|
|
const autoEnroll = Reflect.apply(useStateFromStores, FluxModule, [[unenrolledActivityQuestStoreBinding],
|
|
function() {
|
|
return UnenrolledActivityQuestStore.getState().autoEnroll;
|
|
}]);
|
|
const value2 = env0_3.useMemo(_fun117612, [quests, applicationId]);
|
|
var env0_3 = value2;
|
|
env0_3.useEffect(_fun117615, [value2, autoEnroll,
|
|
FluxModule.useStateFromStores([unenrolledActivityQuestStoreBinding], _fun117614)]);
|
|
return (
|
|
value2 == null
|
|
? null
|
|
: (
|
|
<QuestActivityButtonInner quest={value2} />
|
|
)
|
|
);
|
|
function _fun117612() { // fn#117612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:3383, offset: 0x024bacd5, size: 73 bytes, params: 1, frame: 15
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const getEligibleQuestsForApplicationId = (QuestMatchingUtilsModule).getEligibleQuestsForApplicationId;
|
|
value = Reflect.apply(getEligibleQuestsForApplicationId, value, [quests, applicationId, true]);
|
|
return value.find(function(a0) {
|
|
return a0.config.features.includes(QuestVariants.MOBILE_ACTIVITY_QUEST);
|
|
});
|
|
}
|
|
|
|
function _fun117614() { // fn#117614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:3544, offset: 0x024bad46, size: 47 bytes, params: 1, frame: 13
|
|
const unenrolledActivityQuestStoreBinding = UnenrolledActivityQuestStore;
|
|
return unenrolledActivityQuestStoreBinding.isDismissed(env0_3?.id);
|
|
}
|
|
|
|
function _fun117615() { // fn#117615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15581:3605, offset: 0x024bad75, size: 158 bytes, params: 1, frame: 18
|
|
var value5;
|
|
var defaultImport;
|
|
let r0 = env0_3 == null || env0_3.userStatus?.enrolledAt != null;
|
|
r0 = !r0 ? autoEnroll : r0;
|
|
r0 = !r0 ? ReactNativeModule.View : r0;
|
|
if (!r0) {
|
|
value5 = environment.__proto__;
|
|
defaultImport = importDefault(dependencyMap[12]);
|
|
defaultImport.pushLazy(require(dependencyMap[14])(dependencyMap[13], dependencyMap.paths), {questId: env0_3.id},
|
|
env1_16);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun117599, 15384, [31, 27, 4502, 7093, 15385, 6528, 33, 4017, 7744, 4501, 9483, 566, 5080, 15386, 1962,
|
|
4080, 15387, 4504, 6760, 13621, 15388, 13508, 1244, 697, 9524,
|
|
2]) /* metro module 15384, dependencies: [31, 27, 4502, 7093, 15385, 6528, 33, 4017, 7744, 4501, 9483, 566, 5080, 15386, 1962, 4080, 15387, 4504, 6760, 13621, 15388, 13508, 1244, 697, 9524, 2] */;
|