208 lines
10 KiB
TypeScript
208 lines
10 KiB
TypeScript
/* Metro module 7610; source: modules/user_profile/ProfileUpdateRequestUtils.tsx; dependencies: [7611, 7612, 1904, 2] */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as CollectiblesItemTypeModule from '../../external/discord_common/js/shared/shared-constants/CollectiblesItemType.tsx'; /* Metro dependency 1904 */
|
|
|
|
function _fun60973(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7788:6, offset: 0x01716d2a, size: 134 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/user_profile/ProfileUpdateRequestUtils.tsx');
|
|
exports.getProfileChangesForUpdateRequest = getProfileChangesForUpdateRequest;
|
|
exports.getAccountUpdateForUpdateRequest = getAccountUpdateForUpdateRequest;
|
|
exports.getGuildMemberChangesForUpdateRequest = getGuildMemberChangesForUpdateRequest;
|
|
exports.getPrimaryGuildChangesForUpdateRequest = function(a0) {
|
|
var object = {};
|
|
if (a0.pendingPrimaryGuildId !== undefined) {
|
|
object.primaryGuildId = a0.pendingPrimaryGuildId;
|
|
}
|
|
return object;
|
|
};
|
|
function getProfileChangesForUpdateRequest(a0, a1) { // fn#60974, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7788:212, offset: 0x01716db0, size: 195 bytes, params: 3, frame: 15
|
|
var value;
|
|
var pendingBannerOriginalMd5;
|
|
const object = {};
|
|
let pendingBanner = a0.pendingBanner;
|
|
if (pendingBanner !== undefined) {
|
|
pendingBanner = a0.pendingBanner;
|
|
object.banner = pendingBanner;
|
|
pendingBanner = a0.pendingBanner;
|
|
value = null;
|
|
if (value !== pendingBanner) {
|
|
pendingBannerOriginalMd5 = a0.pendingBannerOriginalMd5;
|
|
object.bannerOriginalMd5 = value != pendingBannerOriginalMd5 ? pendingBannerOriginalMd5 : value;
|
|
}
|
|
}
|
|
if (a0.pendingBio != null) {
|
|
object.bio = a0.pendingBio;
|
|
}
|
|
if (a0.pendingPronouns != null) {
|
|
object.pronouns = a0.pendingPronouns;
|
|
}
|
|
if (a0.pendingAccentColor !== undefined) {
|
|
object.accent_color = a0.pendingAccentColor;
|
|
}
|
|
if (a0.pendingThemeColors !== undefined) {
|
|
object.theme_colors = a0.pendingThemeColors;
|
|
}
|
|
value = getCollectiblesChangesForUpdateRequest(a0, a1);
|
|
if (value.collectibles_sku_ids !== undefined) {
|
|
object.collectibles_sku_ids = value.collectibles_sku_ids;
|
|
}
|
|
return object;
|
|
function getCollectiblesChangesForUpdateRequest({pendingProfileEffect, pendingProfileFrame}, a1) { // fn#60975, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7788:655, owner: getProfileChangesForUpdateRequest.getCollectiblesChangesForUpdateRequest, offset: 0x01716e73, size: 261 bytes, params: 3, frame: 21
|
|
var environment;
|
|
var r5;
|
|
var r6;
|
|
var r3;
|
|
var value2;
|
|
var value3;
|
|
var object;
|
|
var value4;
|
|
const CollectiblesItemType = (CollectiblesItemTypeModule).CollectiblesItemType;
|
|
let value = undefined;
|
|
if (value !== pendingProfileEffect) {
|
|
value2 = environment.__proto__;
|
|
value3 = (importDefault(7612) /* metro dependency 7612: getCurrentUserProfile */)(a1);
|
|
r5 = (value3 == null ? value : value3.collectibles) ?? [];
|
|
object = [];
|
|
arraySpread(object, r5, 0, undefined);
|
|
if (value === pendingProfileEffect) {
|
|
r6 = object;
|
|
} else {
|
|
value4 = object.filter(function({type}) {
|
|
return type !== require(dependencyMap[2]).CollectiblesItemType.PROFILE_EFFECT;
|
|
});
|
|
if (pendingProfileEffect === null) {
|
|
r6 = value4;
|
|
} else {
|
|
value4.push({skuId: pendingProfileEffect.skuId, type: CollectiblesItemType.PROFILE_EFFECT});
|
|
r6 = value4;
|
|
}
|
|
}
|
|
if (value === pendingProfileFrame) {
|
|
r3 = r6;
|
|
} else {
|
|
value = r6.filter(_fun60977);
|
|
if (pendingProfileFrame === null) {
|
|
r3 = value;
|
|
} else {
|
|
value.push(pendingProfileFrame);
|
|
r3 = value;
|
|
}
|
|
}
|
|
object = {};
|
|
object.collectibles_sku_ids = r3.map(_fun60978);
|
|
return object;
|
|
}
|
|
if (value === pendingProfileFrame) {
|
|
return {};
|
|
}
|
|
value3 = (importDefault(7612) /* metro dependency 7612: getCurrentUserProfile */)(a1);
|
|
arraySpread([], (value3 == null ? value : value3.collectibles) ?? [], 0, undefined);
|
|
if (value === pendingProfileEffect) {
|
|
r6 = object;
|
|
} else {
|
|
value4 = object.filter(function({type}) {
|
|
return type !== require(dependencyMap[2]).CollectiblesItemType.PROFILE_EFFECT;
|
|
});
|
|
if (pendingProfileEffect === null) {
|
|
r6 = value4;
|
|
} else {
|
|
value4.push({skuId: pendingProfileEffect.skuId, type: CollectiblesItemType.PROFILE_EFFECT});
|
|
r6 = value4;
|
|
}
|
|
}
|
|
if (value === pendingProfileFrame) {
|
|
r3 = r6;
|
|
} else {
|
|
value = r6.filter(function({type}) {
|
|
return type !== require(dependencyMap[2]).CollectiblesItemType.PROFILE_FRAME;
|
|
});
|
|
if (pendingProfileFrame === null) {
|
|
r3 = value;
|
|
} else {
|
|
value.push(pendingProfileFrame);
|
|
r3 = value;
|
|
}
|
|
}
|
|
return {collectibles_sku_ids: r3.map(function(a0) {
|
|
return a0.skuId;
|
|
})};
|
|
function _fun60977({type}) { // fn#60977, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7788:1059, offset: 0x01716fab, size: 51 bytes, params: 2, frame: 12
|
|
const CollectiblesItemType = (CollectiblesItemTypeModule).CollectiblesItemType;
|
|
const PROFILE_FRAME = CollectiblesItemType.PROFILE_FRAME;
|
|
return type !== PROFILE_FRAME;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function getAccountUpdateForUpdateRequest(a0) { // fn#60979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7788:1326, offset: 0x01716fde, size: 225 bytes, params: 2, frame: 17
|
|
const object = {};
|
|
if (a0.pendingGlobalName !== undefined) {
|
|
object.globalName = a0.pendingGlobalName;
|
|
}
|
|
if (a0.pendingNameplate !== undefined) {
|
|
object.nameplate = a0.pendingNameplate;
|
|
}
|
|
let pendingAvatar = a0.pendingAvatar;
|
|
if (pendingAvatar !== undefined) {
|
|
pendingAvatar = a0.pendingAvatar;
|
|
if (pendingAvatar === null) {
|
|
object.avatar = null;
|
|
} else if (pendingAvatar.assetOrigin === (require(7611) /* metro dependency 7611: RecentAvatarsTypes */).AssetOriginTypes.ARCHIVED_ASSET) {
|
|
object.avatarId = pendingAvatar.originalAsset.id;
|
|
} else {
|
|
object.avatar = pendingAvatar.imageUri;
|
|
object.avatarDescription = pendingAvatar.description;
|
|
object.avatarOriginalMd5 = pendingAvatar.originalMd5;
|
|
}
|
|
}
|
|
if (a0.pendingAvatarDecoration !== undefined) {
|
|
object.avatarDecoration = a0.pendingAvatarDecoration;
|
|
}
|
|
if (a0.pendingDisplayNameStyles !== undefined) {
|
|
object.displayNameStyles = a0.pendingDisplayNameStyles;
|
|
}
|
|
return object;
|
|
}
|
|
|
|
function getGuildMemberChangesForUpdateRequest(a0) { // fn#60980, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7788:1976, offset: 0x017170bf, size: 241 bytes, params: 2, frame: 17
|
|
const object = {};
|
|
let pendingAvatar = a0.pendingAvatar;
|
|
if (pendingAvatar !== undefined) {
|
|
pendingAvatar = a0.pendingAvatar;
|
|
if (pendingAvatar === null) {
|
|
object.avatar = null;
|
|
} else if (pendingAvatar.assetOrigin === (require(7611) /* metro dependency 7611: RecentAvatarsTypes */).AssetOriginTypes.ARCHIVED_ASSET) {
|
|
object.avatarId = pendingAvatar.originalAsset.id;
|
|
} else {
|
|
object.avatar = pendingAvatar.imageUri;
|
|
object.avatarDescription = pendingAvatar.description;
|
|
object.avatarOriginalMd5 = pendingAvatar.originalMd5;
|
|
}
|
|
}
|
|
if (a0.pendingNickname !== undefined) {
|
|
object.nick = a0.pendingNickname ?? '';
|
|
}
|
|
if (a0.pendingAvatarDecoration !== undefined) {
|
|
object.avatarDecoration = a0.pendingAvatarDecoration;
|
|
}
|
|
if (a0.pendingNameplate !== undefined) {
|
|
object.nameplate = a0.pendingNameplate;
|
|
}
|
|
if (a0.pendingDisplayNameStyles !== undefined) {
|
|
object.displayNameStyles = a0.pendingDisplayNameStyles;
|
|
}
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun60978(a0) { // fn#60978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7788:1176, offset: 0x00fba7b9, size: 10 bytes, params: 2, frame: 1
|
|
return a0.skuId;
|
|
}
|
|
|
|
global.__d(_fun60973, 7610, [7611, 7612, 1904, 2]) /* metro module 7610, dependencies: [7611, 7612, 1904, 2] */;
|