244 lines
7.1 KiB
TypeScript
244 lines
7.1 KiB
TypeScript
// Metro module 7941 (f7942).
|
|
import GuildMemberStore from "../../stores/GuildMemberStore";
|
|
import UserStore from "../../stores/UserStore";
|
|
import UserProfileStore from "./UserProfileStore";
|
|
import isEqual from "../../_bundle/isEqual_4349";
|
|
import { getUserPrimaryGuild } from "../guild_tag/GuildTagUtils";
|
|
import Dispatcher from "../../Dispatcher";
|
|
export function setPendingChanges({ guildId, ...rest }) {
|
|
let r25, r139, r159;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null) {
|
|
let r10 = UserProfileStore.getUserProfile(currentUser.id);
|
|
if (guildId != null) {
|
|
r10 = UserProfileStore.getGuildMemberProfile(currentUser.id, guildId);
|
|
}
|
|
const r11 = guildId != null ? GuildMemberStore.getMember(guildId, currentUser.id) : null;
|
|
L11: {
|
|
r25 = {};
|
|
if ("globalName" in rest) {
|
|
L10: {
|
|
if (rest.globalName !== currentUser.globalName) {
|
|
if (rest.globalName === "" && currentUser.globalName === null) {
|
|
break L10;
|
|
}
|
|
r25.pendingGlobalName = rest.globalName;
|
|
break L11;
|
|
}
|
|
}
|
|
r25.pendingGlobalName = void 0;
|
|
}
|
|
}
|
|
L21: {
|
|
if ("nickname" in rest) {
|
|
const nickname = rest.nickname;
|
|
const nick = r11?.nick;
|
|
L20: {
|
|
if (nickname !== nick) {
|
|
if (rest.nickname === "" && r11?.nick === null) {
|
|
break L20;
|
|
}
|
|
r25.pendingNickname = rest.nickname;
|
|
break L21;
|
|
}
|
|
}
|
|
r25.pendingNickname = void 0;
|
|
}
|
|
}
|
|
if ("displayNameStyles" in rest) {
|
|
const displayNameStyles = rest.displayNameStyles;
|
|
let r13 = guildId != null ? r11?.displayNameStyles : currentUser.displayNameStyles;
|
|
let r54 = displayNameStyles;
|
|
if (r54 == null) {
|
|
r54 = null;
|
|
}
|
|
if (r13 == null) {
|
|
r13 = null;
|
|
}
|
|
if (isEqual(r54, r13)) {
|
|
r25.pendingDisplayNameStyles = void 0;
|
|
} else {
|
|
r25.pendingDisplayNameStyles = displayNameStyles;
|
|
}
|
|
}
|
|
if ("pronouns" in rest) {
|
|
if (rest.pronouns === r10?.pronouns) {
|
|
r25.pendingPronouns = void 0;
|
|
} else {
|
|
r25.pendingPronouns = rest.pronouns;
|
|
}
|
|
}
|
|
L53: {
|
|
if ("avatar" in rest) {
|
|
L52: {
|
|
if (guildId != null) {
|
|
if (rest.avatar?.imageUri === r11?.avatar) {
|
|
break L52;
|
|
}
|
|
}
|
|
if (guildId == null) {
|
|
if (rest.avatar?.imageUri === currentUser.avatar) {
|
|
break L52;
|
|
}
|
|
}
|
|
r25.pendingAvatar = rest.avatar;
|
|
break L53;
|
|
}
|
|
r25.pendingAvatar = void 0;
|
|
}
|
|
}
|
|
L69: {
|
|
if ("avatarDecoration" in rest) {
|
|
L68: {
|
|
if (guildId != null) {
|
|
if (rest.avatarDecoration?.skuId === (r11 == null ? void 0 : r11.avatarDecoration?.skuId)) {
|
|
break L68;
|
|
}
|
|
}
|
|
if (guildId == null) {
|
|
if (rest.avatarDecoration?.skuId === currentUser.avatarDecoration?.skuId) {
|
|
break L68;
|
|
}
|
|
}
|
|
r25.pendingAvatarDecoration = rest.avatarDecoration;
|
|
break L69;
|
|
}
|
|
r25.pendingAvatarDecoration = void 0;
|
|
}
|
|
}
|
|
L87: {
|
|
if ("nameplate" in rest) {
|
|
L86: {
|
|
if (guildId != null) {
|
|
const skuId = rest.nameplate?.skuId;
|
|
const r98 = r11 == null;
|
|
let r99 = void 0;
|
|
if (!r98) {
|
|
const collectibles = r11.collectibles;
|
|
r99 = collectibles == null ? void 0 : collectibles.nameplate?.skuId;
|
|
}
|
|
if (skuId === r99) {
|
|
break L86;
|
|
}
|
|
}
|
|
if (guildId == null) {
|
|
const skuId2 = rest.nameplate?.skuId;
|
|
const collectibles2 = currentUser.collectibles;
|
|
if (skuId2 === (collectibles2 == null ? void 0 : collectibles2.nameplate?.skuId)) {
|
|
break L86;
|
|
}
|
|
}
|
|
r25.pendingNameplate = rest.nameplate;
|
|
break L87;
|
|
}
|
|
r25.pendingNameplate = void 0;
|
|
}
|
|
}
|
|
if ("profileEffect" in rest) {
|
|
if (rest.profileEffect?.skuId === (r10 == null ? void 0 : r10.profileEffect?.skuId)) {
|
|
r25.pendingProfileEffect = void 0;
|
|
} else {
|
|
r25.pendingProfileEffect = rest.profileEffect;
|
|
}
|
|
}
|
|
if ("profileFrame" in rest) {
|
|
if (rest.profileFrame?.skuId === (r10 == null ? void 0 : r10.profileFrame?.skuId)) {
|
|
r25.pendingProfileFrame = void 0;
|
|
} else {
|
|
r25.pendingProfileFrame = rest.profileFrame;
|
|
}
|
|
}
|
|
if ("banner" in rest) {
|
|
let banner = rest.banner;
|
|
if (banner == null) {
|
|
banner = null;
|
|
}
|
|
if (guildId != null) {
|
|
let r141 = r10?.banner;
|
|
if (r141 == null) {
|
|
r141 = null;
|
|
}
|
|
r139 = r141;
|
|
} else {
|
|
r139 = currentUser.banner;
|
|
if (r139 == null) {
|
|
r139 = null;
|
|
}
|
|
}
|
|
if (banner === r139) {
|
|
r25.pendingBanner = void 0;
|
|
r25.pendingBannerOriginalMd5 = void 0;
|
|
} else {
|
|
r25.pendingBanner = rest.banner;
|
|
let bannerOriginalMd5 = rest.bannerOriginalMd5;
|
|
if (bannerOriginalMd5 == null) {
|
|
bannerOriginalMd5 = null;
|
|
}
|
|
r25.pendingBannerOriginalMd5 = bannerOriginalMd5;
|
|
}
|
|
}
|
|
if ("accentColor" in rest) {
|
|
let accentColor = rest.accentColor;
|
|
if (accentColor == null) {
|
|
accentColor = null;
|
|
}
|
|
let r149 = r10?.accentColor;
|
|
if (r149 == null) {
|
|
r149 = null;
|
|
}
|
|
r25.pendingAccentColor = accentColor !== r149 ? accentColor : void 0;
|
|
}
|
|
if ("themeColors" in rest) {
|
|
L140: {
|
|
if (guildId != null && rest.themeColors != null && rest.themeColors[0] == null) {
|
|
const r158 = rest.themeColors[1] == null;
|
|
r159 = null;
|
|
if (r158) {
|
|
break L140;
|
|
}
|
|
}
|
|
let themeColors = rest.themeColors;
|
|
if (themeColors == null) {
|
|
themeColors = null;
|
|
}
|
|
r159 = themeColors;
|
|
}
|
|
let r163 = r10?.themeColors;
|
|
if (r163 == null) {
|
|
r163 = null;
|
|
}
|
|
if (isEqual(r159, r163)) {
|
|
r25.pendingThemeColors = void 0;
|
|
} else {
|
|
r25.pendingThemeColors = rest.themeColors;
|
|
}
|
|
}
|
|
if ("bio" in rest) {
|
|
if (rest.bio === r10?.bio) {
|
|
r25.pendingBio = void 0;
|
|
} else {
|
|
r25.pendingBio = rest.bio;
|
|
}
|
|
}
|
|
if ("primaryGuildId" in rest) {
|
|
let guildId2 = getUserPrimaryGuild(currentUser.primaryGuild).guildId;
|
|
if (guildId2 == null) {
|
|
guildId2 = null;
|
|
}
|
|
if (rest.primaryGuildId === guildId2) {
|
|
r25.pendingPrimaryGuildId = void 0;
|
|
} else {
|
|
r25.pendingPrimaryGuildId = rest.primaryGuildId;
|
|
}
|
|
}
|
|
if ("legacyUsernameDisabled" in rest) {
|
|
r25.pendingLegacyUsernameDisabled = rest.legacyUsernameDisabled;
|
|
}
|
|
Dispatcher.dispatch({
|
|
type: "USER_PROFILE_SETTINGS_SET_PENDING_CHANGES",
|
|
guildId,
|
|
...r25
|
|
});
|
|
}
|
|
}
|