decord/source/modules/user_profile/native/EditUserProfileAvatar.tsx

165 lines
6.4 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 14126
// Function ID: 14127
2026-07-20 16:05:17 +00:00
// Name: EditUserProfileAvatar
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 4372, 21, 4380, 5834, 5854, 4043, 8416, 8429, 14127, 4347, 14128, 2009, 14129, 14129, 8414, 8423, 589, 4120, 4381, 8454, 4949, 1236, 14130, 1297, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 14126 (EditUserProfileAvatar)
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "maybeApplyNoTextColorForLightCustomTheme" /* 4372 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ jsx: c5, jsxs: closure_6 } = jsxProd);
let closure_7 = createCacheKey.createStyles({ editIcon: { position: "absolute", right: -3 } });
2026-07-20 16:05:17 +00:00
let closure_8 = { code: "function EditUserProfileAvatarTsx1(){const{rotation}=this.__closure;return{transform:[{rotateZ:rotation.get()+\"deg\"}]};}" };
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/user_profile/native/EditUserProfileAvatar.tsx");
2026-07-20 16:05:17 +00:00
export default function EditUserProfileAvatar(user) {
user = user.user;
let flag = user.disableStatus;
({ disabled, statusStyle, style, avatarStyle, editIconStyle } = user);
if (flag === undefined) {
flag = true;
}
let flag2 = user.isTryItOut;
if (flag2 === undefined) {
flag2 = false;
}
let flag3 = user.autoStartEditFlow;
if (flag3 === undefined) {
flag3 = false;
}
const size = user.size;
2026-07-23 10:11:24 +00:00
let analyticsLocations;
2026-08-24 06:08:38 +00:00
closure_4 = undefined;
2026-07-20 16:05:17 +00:00
let pendingAvatar;
setPendingAvatar = undefined;
2026-07-23 10:11:24 +00:00
let avatarDecoration;
2026-08-24 06:08:38 +00:00
closure_8 = undefined;
2026-07-20 16:05:17 +00:00
let callback;
2026-08-24 06:08:38 +00:00
closure_10 = undefined;
2026-07-20 16:05:17 +00:00
let sharedValue;
2026-07-23 10:11:24 +00:00
let tmp = avatarDecoration();
analyticsLocations = flag2(flag3[4])(flag2(flag3[5]).EDIT_AVATAR).analyticsLocations;
let obj = flag2(flag3[6]);
2026-07-29 08:29:29 +00:00
const canUseAnimatedAvatarResult = obj.canUseAnimatedAvatar(user);
let tmp6 = !canUseAnimatedAvatarResult;
if (!canUseAnimatedAvatarResult) {
tmp6 = !flag2;
}
2026-08-24 06:08:38 +00:00
closure_4 = tmp6;
2026-07-29 08:29:29 +00:00
const tmp7 = flag2(flag3[7])({ isTryItOut: flag2, analyticsLocations });
pendingAvatar = tmp7.pendingAvatar;
({ pendingAvatarDecoration, setPendingAvatar } = tmp7);
2026-08-24 06:08:38 +00:00
obj1 = user(tmp3[8]);
2026-07-20 16:05:17 +00:00
obj = { userId: user.id, image: pendingAvatar };
2026-07-23 10:11:24 +00:00
avatarDecoration = pendingAvatarDecoration;
2026-07-29 08:29:29 +00:00
const pendingAvatarSrc = obj1.getPendingAvatarSrc(obj);
2026-07-20 16:05:17 +00:00
if (undefined === pendingAvatarDecoration) {
avatarDecoration = user.avatarDecoration;
}
2026-07-29 08:29:29 +00:00
const tmp10 = flag2(flag3[9])({ isTryItOut: flag2, analyticsLocations });
2026-08-24 06:08:38 +00:00
closure_8 = tmp10;
2026-07-29 08:29:29 +00:00
let items = [user, analyticsLocations, pendingAvatar, setPendingAvatar, tmp10, tmp6, avatarDecoration, flag2];
2026-07-23 10:11:24 +00:00
callback = analyticsLocations.useCallback(() => {
2026-07-20 16:05:17 +00:00
let obj = flag2(flag3[10]);
obj = {
2026-08-24 06:08:38 +00:00
showAnimatedAvatarUpsell: closure_4,
2026-07-20 16:05:17 +00:00
handleRemoveAvatarSelect() {
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[10]).hideActionSheet();
2026-07-29 08:29:29 +00:00
callback(null);
2026-07-20 16:05:17 +00:00
},
2026-08-24 06:08:38 +00:00
handleUploadAvatarSelect: closure_8,
2026-07-20 16:05:17 +00:00
handleUploadGIFAvatarSelect() {
2026-08-24 06:08:38 +00:00
let obj = closure_1_1(closure_1_2[10]);
2026-07-20 16:05:17 +00:00
obj.hideActionSheet();
2026-07-29 08:29:29 +00:00
obj = { profileAssetType: null, selectionContext: null };
2026-08-24 06:08:38 +00:00
const obj2 = closure_1_1(closure_1_2[10]);
obj[0] = closure_1_0(closure_1_2[14]).ProfileAssetType.AVATAR;
const GIFSelectionContext = closure_1_0(closure_1_2[14]).GIFSelectionContext;
2026-07-29 08:29:29 +00:00
obj[1] = closure_1 ? GIFSelectionContext.PROFILE_TRY_IT_OUT : GIFSelectionContext.PROFILE_EDIT;
2026-08-24 06:08:38 +00:00
obj2.openLazy(closure_1_0(closure_1_2[12])(closure_1_2[13], closure_1_2.paths), "Select GIF Avatar", obj);
2026-07-20 16:05:17 +00:00
},
handleEditAvatarDecorationSelect() {
2026-08-24 06:08:38 +00:00
let obj = closure_1_0(closure_1_2[15]);
obj = { user: closure_0, currentAvatarDecoration: closure_7, analyticsLocations: closure_3 };
2026-07-20 16:05:17 +00:00
const result = obj.openAvatarDecorationActionSheet(obj);
2026-07-29 08:29:29 +00:00
},
showRemoveAvatar: null
2026-07-20 16:05:17 +00:00
};
const tmp = user(flag3[12])(flag3[11], flag3.paths);
2026-07-29 08:29:29 +00:00
obj[5] = user(flag3[16]).showRemoveAvatar(pendingAvatar, user.avatar);
2026-07-20 16:05:17 +00:00
obj.openLazy(tmp, "Change Avatar", obj);
}, items);
2026-07-23 10:11:24 +00:00
closure_10 = analyticsLocations.useRef(false);
2026-07-20 16:05:17 +00:00
const items1 = [user, flag3, callback];
2026-07-23 10:11:24 +00:00
const effect = analyticsLocations.useEffect(() => {
2026-07-20 16:05:17 +00:00
let tmp = flag3;
if (flag3) {
tmp = !ref.current;
}
if (tmp) {
ref.current = true;
callback();
}
}, items1);
2026-07-29 08:29:29 +00:00
let tmp8Result = tmp8(tmp3[17]);
2026-08-24 06:08:38 +00:00
const items2 = [closure_4];
const stateFromStores = tmp8Result.useStateFromStores(items2, () => useReducedMotion.useReducedMotion);
2026-07-29 08:29:29 +00:00
tmp8Result = tmp8(tmp3[18]);
sharedValue = tmp8Result.useSharedValue(0);
const tmp4 = flag2(flag3[4]);
2026-07-20 16:05:17 +00:00
const fn = function z() {
2026-07-29 08:29:29 +00:00
let obj = { transform: null };
2026-07-20 16:05:17 +00:00
obj = { rotateZ: "" + sharedValue.get() + "deg" };
const items = [obj];
2026-07-29 08:29:29 +00:00
obj[0] = items;
2026-07-20 16:05:17 +00:00
return obj;
};
fn.__closure = { rotation: sharedValue };
fn.__workletHash = 13368223692459;
2026-08-24 06:08:38 +00:00
fn.__initData = closure_8;
2026-07-20 16:05:17 +00:00
const items3 = [sharedValue];
2026-07-23 10:11:24 +00:00
const animatedStyle = user(flag3[18]).useAnimatedStyle(fn);
const effect1 = analyticsLocations.useEffect(() => {
2026-07-20 16:05:17 +00:00
let obj = user(flag3[18]);
2026-07-29 08:29:29 +00:00
obj = { duration: 3000, easing: null };
2026-07-20 16:05:17 +00:00
const Easing = user(flag3[18]).Easing;
2026-07-29 08:29:29 +00:00
obj[1] = Easing.inOut(user(flag3[18]).Easing.quad);
2026-07-20 16:05:17 +00:00
const result = sharedValue.set(obj.withRepeat(user(flag3[19]).withTiming(360, obj), -1));
2026-08-24 06:08:38 +00:00
return () => closure_1_0(closure_1_2[18]).cancelAnimation(closure_11);
2026-07-20 16:05:17 +00:00
}, items3);
2026-07-29 08:29:29 +00:00
const tmp18 = pendingAvatar(flag2(flag3[20]), { style: avatarStyle, user, pendingAvatarSrc, pendingAvatarDecoration, statusStyle, disableStatus: flag, size });
obj = { style, disabled, onPress: callback, accessibilityRole: "button", accessibilityLabel: null, children: null };
const intl = tmp8(tmp3[22]).intl;
obj[4] = intl.string(user(flag3[22]).t.MUgHIN);
let tmp17Result = tmp18;
2026-07-20 16:05:17 +00:00
if (flag2) {
2026-07-29 08:29:29 +00:00
tmp17Result = tmp18;
2026-07-20 16:05:17 +00:00
if (null == pendingAvatarDecoration) {
2026-07-29 08:29:29 +00:00
tmp17Result = tmp18;
2026-07-20 16:05:17 +00:00
if (!stateFromStores) {
2026-07-29 08:29:29 +00:00
obj1 = { style: null, children: null };
obj1[0] = animatedStyle;
obj1[1] = tmp18;
tmp17Result = tmp17(tmp2(tmp3[18]).View, obj1);
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
const items4 = [tmp17Result, ];
let obj2 = { style: items5, size: null };
2026-07-23 10:11:24 +00:00
items5 = [tmp.editIcon, editIconStyle];
2026-07-29 08:29:29 +00:00
const tmp19 = setPendingAvatar;
const tmp8Result1 = user(flag3[18]);
2026-07-20 16:05:17 +00:00
let str = "xs";
2026-07-23 10:11:24 +00:00
if (size === user(flag3[24]).AvatarSizes.EDIT_AVATAR_DECORATION) {
2026-07-20 16:05:17 +00:00
str = "sm";
}
2026-07-29 08:29:29 +00:00
obj2[1] = str;
items4[1] = pendingAvatar(flag2(flag3[23]), obj2);
obj[5] = items4;
return tmp19(user(flag3[21]).PressableOpacity, obj);
2026-07-20 16:05:17 +00:00
};