This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,163 @@
// Metro module 9803 (f9804).
import { Endpoints } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
import InlineUploader from "../../lib/uploader_inline/InlineUploader";
import { SafetyScannedUploadSurface } from "../../lib/uploader_inline/safetyScannedUploadSurfaces";
export async function saveGuildIdentityChanges(c26540_0, c26540_1) {
let r186, r221;
let skuId, c26540_5;
let c26540_6 = 0;
let c30146_1, c30146_2, c30146_3, c30146_4, c30146_5, c30146_6, c30146_7, c30146_8, c30146_0, c30146_9, c30146_10, c30146_11, c30146_12, c30146_13;
try {
c30146_1 = void 0;
c30146_2 = void 0;
c30146_3 = void 0;
c30146_4 = void 0;
c30146_5 = void 0;
c30146_6 = void 0;
c30146_7 = void 0;
c30146_8 = void 0;
c30146_0 = c26540_0;
c30146_1 = c26540_1.nick;
c30146_2 = c26540_1.avatar;
c30146_3 = c26540_1.avatarDescription;
c30146_4 = c26540_1.avatarId;
c30146_5 = c26540_1.avatarDecoration;
c30146_6 = c26540_1.nameplate;
c30146_7 = c26540_1.displayNameStyles;
c30146_8 = c26540_1.avatarOriginalMd5;
c30146_9 = void 0;
c30146_10 = void 0;
c30146_11 = void 0;
c30146_12 = void 0;
await void 0;
if (c30146_0 == null) {
throw new Error("Need guildId");
}
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_SUBMIT",
guildId: c30146_0
});
const r84 = c30146_5;
let avatar_decoration_sku_id = void 0;
if (r84 !== void 0) {
const skuId2 = c30146_5?.skuId;
skuId = skuId2;
if (skuId2 == null) {
skuId = null;
}
avatar_decoration_sku_id = skuId;
}
c30146_9 = {
nick: c30146_1,
avatar: c30146_2,
avatar_description: c30146_3,
avatar_id: c30146_4,
avatar_decoration_sku_id,
collectibles: c30146_6 !== void 0 ? {
nameplate: c30146_6 !== null ? {
sku_id: c30146_6.skuId
} : null
} : void 0,
display_name_font_id: c30146_7 !== void 0 ? c30146_7 !== null ? c30146_7.fontId : null : void 0,
display_name_effect_id: c30146_7 !== void 0 ? c30146_7 !== null ? c30146_7.effectId : null : void 0,
display_name_colors: c30146_7 !== void 0 ? c30146_7 !== null ? c30146_7.colors : null : void 0
};
c26540_6 = 1;
const r122 = {
url: Endpoints.SET_GUILD_MEMBER(c30146_0),
body: c30146_9,
headers: null,
oldFormErrors: true,
rejectWithError: false
};
const r129 = {};
r129[SafetyScannedUploadSurface.USER_GUILD_PROFILE_AVATAR] = c30146_8;
r122.headers = InlineUploader.buildHeadersForMd5(r129);
c30146_10 = await HTTP.patch(r122);
c30146_11 = c30146_10.body;
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_SUBMIT_SUCCESS",
guildId: c30146_0
});
Dispatcher.dispatch({
type: "GUILD_MEMBER_PROFILE_UPDATE",
guildMember: c30146_11,
guildId: c30146_0
});
if (!(c30146_2 == null && c30146_4 == null)) {
Dispatcher.dispatch({
type: "RECENT_AVATARS_UPDATE"
});
}
r186 = c30146_10;
c26540_6 = 0;
} catch ($e) {
const r35 = $e;
let r8 = r35;
c26540_5 = r35;
if (c26540_6 !== 0) {
while (true) {
try {
const r202 = c26540_5;
c26540_6 = 0;
c30146_13 = r202;
c30146_12 = c30146_13.body;
if (c30146_12?.username != null) {
c30146_12.nick = c30146_12.username;
delete c30146_12["username"];
}
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_SUBMIT_FAILURE",
guildId: c30146_0,
errors: c30146_13.body
});
r221 = c30146_13;
} catch (r199) {
r8 = r199;
c26540_5 = r199;
if (c26540_6 === 0) {
break;
}
continue;
}
return r221;
}
}
throw r8;
}
return r186;
}
export function setCurrentGuild(a0) {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_SET_GUILD",
guildId: a0
});
}
export function initGuildIdentitySettings(a0) {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_INIT",
guildId: a0
});
}
export function resetPendingMemberChanges() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_PENDING_ACCOUNT_CHANGES"
});
}
export function resetPendingProfileChanges() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_PENDING_PROFILE_CHANGES"
});
}
export function resetAllPending() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_PENDING_CHANGES"
});
}
export function clearErrors() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_CLEAR_ERRORS"
});
}
@@ -0,0 +1,4 @@
// Metro module 13747 (f13748).
export function canResetThemeColors(a0, a1) {
return a0 === void 0 ? a1 != null : (a0 == null ? void 0 : a0[0]) != null && (a0 == null ? void 0 : a0[1]) != null;
}
@@ -0,0 +1,128 @@
// Metro module 13748 (f13749).
import { useCallback } from "react";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import UserStore from "../../../stores/UserStore";
import { AnalyticsObjects, AnalyticsSections, UpsellTypes } from "../../../Constants";
import { PremiumUpsellTypes } from "../../premium/PremiumConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../_bundle/Module589";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import usePendingAvatarSettings from "../../user_profile/hooks/usePendingAvatarSettings";
import useUploadAvatar from "../../user_profile/hooks/native/useUploadAvatar";
import { getPendingAvatarSrc } from "../../recent_avatars/RecentAvatarUtils";
import PremiumUtils from "../../../utils/PremiumUtils";
import * as _ProfileCustomizationUtils from "../../profile_customization/ProfileCustomizationUtils";
import PremiumUpsellUtils from "../../../utils/native/PremiumUpsellUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { ProfileAssetType, GIFSelectionContext } from "../../user_profile/native/ProfileGIFSelectActionSheet";
import { openAvatarDecorationActionSheet } from "../../collectibles/avatar_decorations/native/AvatarDecorationUtils";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../intl/index.native";
import HeaderAvatar from "../../profile_customization/native/HeaderAvatar";
import EditIcon from "../../profile_customization/native/EditIcon";
const useStyles = createStyles({
editAvatarIcon: {
position: "absolute",
right: 0
}
});
export default function EditGuildIdentityAvatar(props) {
let stateFromStores2, analyticsLocations, setPendingAvatar, handleUploadAvatarSelect, canUsePremiumGuildMemberProfile, showAnimatedAvatarUpsell, showRemoveAvatar, avatarDecoration;
const { userId, guildId, disabled, disableStatus = true, style, statusStyle, avatarStyle } = props;
stateFromStores2 = void 0;
analyticsLocations = void 0;
setPendingAvatar = void 0;
handleUploadAvatarSelect = void 0;
canUsePremiumGuildMemberProfile = void 0;
showAnimatedAvatarUpsell = void 0;
showRemoveAvatar = void 0;
avatarDecoration = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
stateFromStores2 = useStateFromStores([GuildMemberStore], () => stateFromStores != null ? GuildMemberStore.getMember(guildId, stateFromStores?.id) : null);
analyticsLocations = useAnalyticsLocations(AnalyticsLocation.EDIT_AVATAR).analyticsLocations;
const pendingAvatarSettings = usePendingAvatarSettings({
guildId,
analyticsLocations
});
const { pendingAvatar, pendingAvatarDecoration } = pendingAvatarSettings;
setPendingAvatar = pendingAvatarSettings.setPendingAvatar;
handleUploadAvatarSelect = useUploadAvatar({
guildId,
analyticsLocations
});
const pendingAvatarSrc = getPendingAvatarSrc({
userId,
image: pendingAvatar
});
canUsePremiumGuildMemberProfile = PremiumUtils.canUsePremiumGuildMemberProfile(stateFromStores);
showAnimatedAvatarUpsell = !PremiumUtils.canUseAnimatedAvatar(stateFromStores);
showRemoveAvatar = _ProfileCustomizationUtils.showRemoveAvatar(pendingAvatar, stateFromStores2?.avatar);
let r26 = pendingAvatarDecoration;
if (r26 === void 0) {
r26 = stateFromStores2?.avatarDecoration;
}
avatarDecoration = r26;
const callback = useCallback(() => {
if (stateFromStores2 != null && stateFromStores != null) {
if (canUsePremiumGuildMemberProfile) {
ActionSheetActionCreators.openLazy(import("../../user_profile/native/ChangeAvatarActionSheet"), "Change Avatar", {
handleUploadAvatarSelect,
handleRemoveAvatarSelect: function handleRemoveAvatarSelect() {
ActionSheetActionCreators.hideActionSheet();
setPendingAvatar(null);
},
handleUploadGIFAvatarSelect: function handleUploadGIFAvatarSelect() {
ActionSheetActionCreators.hideActionSheet();
ActionSheetActionCreators.openLazy(import("../../user_profile/native/ProfileGIFSelectActionSheet"), "Select GIF Avatar", {
profileAssetType: ProfileAssetType.AVATAR,
selectionContext: GIFSelectionContext.PROFILE_EDIT,
guildId
});
},
handleEditAvatarDecorationSelect: function handleEditAvatarDecorationSelect() {
if (stateFromStores != null) {
openAvatarDecorationActionSheet({
user: stateFromStores,
guildId,
currentAvatarDecoration: avatarDecoration,
analyticsLocations
});
}
},
showAnimatedAvatarUpsell,
showRemoveAvatar
});
} else {
PremiumUpsellUtils.handleShowUpsellAlert({
initialUpsellKey: UpsellTypes.PREMIUM_GUILD_PROFILE,
analyticsLocation: {
section: AnalyticsSections.PREMIUM_GUILD_MEMBER_PROFILE,
object: AnalyticsObjects.EDIT_GUILD_PROFILE_AVATAR
},
analyticsLocations,
analyticsProperties: {
type: PremiumUpsellTypes.PREMIUM_GUILD_IDENTITY_MODAL
}
});
}
}
}, [guildId, stateFromStores2, stateFromStores, canUsePremiumGuildMemberProfile, showAnimatedAvatarUpsell, showRemoveAvatar, avatarDecoration, analyticsLocations, handleUploadAvatarSelect, setPendingAvatar]);
const r77 = stateFromStores == null;
let r78 = null;
if (!r77) {
const props2 = {
style,
disabled,
onPress: callback,
accessibilityRole: "button",
accessibilityLabel: intl.string(t["70lEQe"]),
children: null
};
const r97 = pendingAvatar === null;
props2.children = [<HeaderAvatar user={stateFromStores} guildId={r97 ? void 0 : guildId} pendingAvatarSrc={r97 ? void 0 : pendingAvatarSrc} pendingAvatarDecoration={pendingAvatarDecoration} statusStyle={statusStyle} disableStatus={disableStatus} style={avatarStyle} />, disabled ? !disabled : <EditIcon style={styles.editAvatarIcon} />];
r78 = <PressableOpacity {...props2} />;
}
return r78;
};