Files
discord-decomp/sources/modules/user_profile/maybeFetchUserProfile.tsx
T
2026-07-27 16:20:00 +03:00

338 lines
19 KiB
TypeScript

/* Metro module 8491; source: modules/user_profile/maybeFetchUserProfile.tsx; dependencies: [1379, 1945, 5189, 5120, 8372, 5043, 694, 8061, 8492, 2] */
function _fun67361(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#67361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8676:6, offset: 0x01c1fda5, size: 150 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
const userProfileStore = importDefault(5189) /* metro dependency 5189: UserProfileStore */;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/maybeFetchUserProfile.tsx');
exports.default = maybeFetchUserProfile;
}
function maybeFetchUserProfile(a0, a1) { // fn#67362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8676:216, offset: 0x01c1fe3b, size: 984 bytes, params: 3, frame: 36
var r21;
var id;
var object3;
var mutualGuilds;
var mutualFriends;
var mutualFriendsCount;
var moduleValue;
var moduleValue2;
var moduleValue4;
var getVisibleConnectionsRole;
var object4;
var value17;
let value = a2;
const env0_0 = a0;
const value2 = undefined;
const r0 = value !== value2 ? value : {};
const type = r0.type;
let withMutualGuilds = r0.withMutualGuilds;
withMutualGuilds = !(withMutualGuilds === value2) && withMutualGuilds;
let withMutualFriendsCount = r0.withMutualFriendsCount;
withMutualFriendsCount = !(withMutualFriendsCount === value2) && withMutualFriendsCount;
let withMutualFriends = r0.withMutualFriends;
withMutualFriends = !(withMutualFriends === value2) && withMutualFriends;
let dispatchWait = r0.dispatchWait;
dispatchWait = !(dispatchWait === value2) && dispatchWait;
let waitForRefetch = r0.waitForRefetch;
waitForRefetch = waitForRefetch === value2 || waitForRefetch;
const guildId = r0.guildId;
const channelId = r0.channelId;
const joinRequestId = r0.joinRequestId;
const abortSignal = r0.abortSignal;
if (a0 === '') {
return global.Promise.resolve();
}
if (UserProfileStore.isFetchingProfile(a0, guildId)) {
return global.Promise.resolve();
}
const userProfile = UserProfileStore.getUserProfile(a0);
const guildMemberProfile = UserProfileStore.getGuildMemberProfile(a0, guildId);
let r7 = guildId == null ? userProfile : guildMemberProfile;
const Date = global.Date;
const value5 = Date.now();
let r9 = (r7 == null ? value2 : r7.fetchEndedAt) ?? 0;
const value7 = value5 - r9 >= 60000;
if ((r7 == null || r7.fetchError == null ? value2 : r7.fetchError.status) === 404) {
if (value7) {
mutualGuilds = UserProfileStore.getMutualGuilds(a0);
mutualFriends = UserProfileStore.getMutualFriends(a0);
mutualFriendsCount = UserProfileStore.getMutualFriendsCount(a0);
r9 = guildId == null ? userProfile == null : guildMemberProfile == null;
if (r9) {
r7 = !r9;
} else {
r21 = value7 || mutualGuilds == null && withMutualGuilds;
r21 = !r21 ? mutualFriends == null && withMutualFriends : r21;
r21 = !r21 ? mutualFriendsCount == null && withMutualFriendsCount : r21;
r7 = r21;
}
if (r9) {
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileEffect : userProfile == null ? value2 : userProfile.profileEffect;
if (r9 != null) {
moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue.maybeFetchCollectiblesProduct(r9.skuId);
}
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileFrame : userProfile == null ? value2 : userProfile.profileFrame;
if (r9 != null) {
moduleValue2 = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue2.maybeFetchCollectiblesProduct(r9.skuId);
}
if (a1 != null) {
(require(8372) /* metro dependency 8372: useAvatarColor */).maybeFetchColors(a1);
}
object3 = {type: type, withMutualGuilds: withMutualGuilds, withMutualFriends: withMutualFriends,
withMutualFriendsCount: withMutualFriendsCount, guildId: guildId, joinRequestId: joinRequestId,
abortSignal: abortSignal};
if (guildId == null) {
id = value2;
} else {
moduleValue4 = require(5043) /* metro dependency 5043: ConnectionsUtils */;
getVisibleConnectionsRole = moduleValue4.getVisibleConnectionsRole;
object4 = {};
object4.guildMember = GuildMemberStore.getMember(guildId, a0);
object4.channel = ChannelStore.getChannel(channelId);
value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object4]);
id = value17 == null ? value2 : value17.id;
}
object3.connectionsRoleId = id;
if (dispatchWait) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun67363);
return global.Promise.resolve();
}
value = (require(8061) /* metro dependency 8061: UserActionCreators */).fetchProfile(a0, object3,
importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */);
return r7 ? waitForRefetch ? value : global.Promise.resolve() : value;
}
if (r7) {
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileEffect : userProfile == null ? value2 : userProfile.profileEffect;
if (r9 != null) {
moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue.maybeFetchCollectiblesProduct(r9.skuId);
}
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileFrame : userProfile == null ? value2 : userProfile.profileFrame;
if (r9 != null) {
moduleValue2 = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue2.maybeFetchCollectiblesProduct(r9.skuId);
}
if (a1 != null) {
(require(8372) /* metro dependency 8372: useAvatarColor */).maybeFetchColors(a1);
}
object3 = {type: type, withMutualGuilds: withMutualGuilds, withMutualFriends: withMutualFriends,
withMutualFriendsCount: withMutualFriendsCount, guildId: guildId, joinRequestId: joinRequestId,
abortSignal: abortSignal};
if (guildId == null) {
id = value2;
} else {
moduleValue4 = require(5043) /* metro dependency 5043: ConnectionsUtils */;
getVisibleConnectionsRole = moduleValue4.getVisibleConnectionsRole;
object4 = {};
object4.guildMember = GuildMemberStore.getMember(guildId, a0);
object4.channel = ChannelStore.getChannel(channelId);
value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object4]);
id = value17 == null ? value2 : value17.id;
}
object3.connectionsRoleId = id;
if (dispatchWait) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun67363);
return global.Promise.resolve();
}
value = (require(8061) /* metro dependency 8061: UserActionCreators */).fetchProfile(a0, object3,
importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */);
return r7 ? waitForRefetch ? value : global.Promise.resolve() : value;
}
return global.Promise.resolve();
}
return global.Promise.resolve();
}
if ((r7 == null || r7.fetchError == null ? value2 : r7.fetchError.status) !== 429) {
mutualGuilds = UserProfileStore.getMutualGuilds(a0);
mutualFriends = UserProfileStore.getMutualFriends(a0);
mutualFriendsCount = UserProfileStore.getMutualFriendsCount(a0);
r9 = guildId == null ? userProfile == null : guildMemberProfile == null;
if (r9) {
r7 = !r9;
} else {
r21 = value7 || mutualGuilds == null && withMutualGuilds;
r21 = !r21 ? mutualFriends == null && withMutualFriends : r21;
r21 = !r21 ? mutualFriendsCount == null && withMutualFriendsCount : r21;
r7 = r21;
}
if (r9) {
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileEffect : userProfile == null ? value2 : userProfile.profileEffect;
if (r9 != null) {
moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue.maybeFetchCollectiblesProduct(r9.skuId);
}
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileFrame : userProfile == null ? value2 : userProfile.profileFrame;
if (r9 != null) {
moduleValue2 = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue2.maybeFetchCollectiblesProduct(r9.skuId);
}
if (a1 != null) {
(require(8372) /* metro dependency 8372: useAvatarColor */).maybeFetchColors(a1);
}
object3 = {type: type, withMutualGuilds: withMutualGuilds, withMutualFriends: withMutualFriends,
withMutualFriendsCount: withMutualFriendsCount, guildId: guildId, joinRequestId: joinRequestId,
abortSignal: abortSignal};
if (guildId == null) {
id = value2;
} else {
moduleValue4 = require(5043) /* metro dependency 5043: ConnectionsUtils */;
getVisibleConnectionsRole = moduleValue4.getVisibleConnectionsRole;
object4 = {};
object4.guildMember = GuildMemberStore.getMember(guildId, a0);
object4.channel = ChannelStore.getChannel(channelId);
value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object4]);
id = value17 == null ? value2 : value17.id;
}
object3.connectionsRoleId = id;
if (dispatchWait) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun67363);
return global.Promise.resolve();
}
value = (require(8061) /* metro dependency 8061: UserActionCreators */).fetchProfile(a0, object3,
importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */);
return r7 ? waitForRefetch ? value : global.Promise.resolve() : value;
}
if (r7) {
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileEffect : userProfile == null ? value2 : userProfile.profileEffect;
if (r9 != null) {
moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue.maybeFetchCollectiblesProduct(r9.skuId);
}
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileFrame : userProfile == null ? value2 : userProfile.profileFrame;
if (r9 != null) {
moduleValue2 = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue2.maybeFetchCollectiblesProduct(r9.skuId);
}
if (a1 != null) {
(require(8372) /* metro dependency 8372: useAvatarColor */).maybeFetchColors(a1);
}
object3 = {type: type, withMutualGuilds: withMutualGuilds, withMutualFriends: withMutualFriends,
withMutualFriendsCount: withMutualFriendsCount, guildId: guildId, joinRequestId: joinRequestId,
abortSignal: abortSignal};
if (guildId == null) {
id = value2;
} else {
moduleValue4 = require(5043) /* metro dependency 5043: ConnectionsUtils */;
getVisibleConnectionsRole = moduleValue4.getVisibleConnectionsRole;
object4 = {};
object4.guildMember = GuildMemberStore.getMember(guildId, a0);
object4.channel = ChannelStore.getChannel(channelId);
value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object4]);
id = value17 == null ? value2 : value17.id;
}
object3.connectionsRoleId = id;
if (dispatchWait) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun67363);
return global.Promise.resolve();
}
value = (require(8061) /* metro dependency 8061: UserActionCreators */).fetchProfile(a0, object3,
importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */);
return r7 ? waitForRefetch ? value : global.Promise.resolve() : value;
}
return global.Promise.resolve();
}
if (value7) {
mutualGuilds = UserProfileStore.getMutualGuilds(a0);
mutualFriends = UserProfileStore.getMutualFriends(a0);
mutualFriendsCount = UserProfileStore.getMutualFriendsCount(a0);
r9 = guildId == null ? userProfile == null : guildMemberProfile == null;
if (r9) {
r7 = !r9;
} else {
r21 = value7 || mutualGuilds == null && withMutualGuilds;
r21 = !r21 ? mutualFriends == null && withMutualFriends : r21;
r21 = !r21 ? mutualFriendsCount == null && withMutualFriendsCount : r21;
r7 = r21;
}
if (r9) {
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileEffect : userProfile == null ? value2 : userProfile.profileEffect;
if (r9 != null) {
moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue.maybeFetchCollectiblesProduct(r9.skuId);
}
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileFrame : userProfile == null ? value2 : userProfile.profileFrame;
if (r9 != null) {
moduleValue2 = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue2.maybeFetchCollectiblesProduct(r9.skuId);
}
if (a1 != null) {
(require(8372) /* metro dependency 8372: useAvatarColor */).maybeFetchColors(a1);
}
object3 = {type: type, withMutualGuilds: withMutualGuilds, withMutualFriends: withMutualFriends,
withMutualFriendsCount: withMutualFriendsCount, guildId: guildId, joinRequestId: joinRequestId,
abortSignal: abortSignal};
if (guildId == null) {
id = value2;
} else {
moduleValue4 = require(5043) /* metro dependency 5043: ConnectionsUtils */;
getVisibleConnectionsRole = moduleValue4.getVisibleConnectionsRole;
object4 = {};
object4.guildMember = GuildMemberStore.getMember(guildId, a0);
object4.channel = ChannelStore.getChannel(channelId);
value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object4]);
id = value17 == null ? value2 : value17.id;
}
object3.connectionsRoleId = id;
if (dispatchWait) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun67363);
return global.Promise.resolve();
}
value = (require(8061) /* metro dependency 8061: UserActionCreators */).fetchProfile(a0, object3,
importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */);
return r7 ? waitForRefetch ? value : global.Promise.resolve() : value;
}
if (r7) {
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileEffect : userProfile == null ? value2 : userProfile.profileEffect;
if (r9 != null) {
moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue.maybeFetchCollectiblesProduct(r9.skuId);
}
r9 = guildId != null ? guildMemberProfile == null ? value2 : guildMemberProfile.profileFrame : userProfile == null ? value2 : userProfile.profileFrame;
if (r9 != null) {
moduleValue2 = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue2.maybeFetchCollectiblesProduct(r9.skuId);
}
if (a1 != null) {
(require(8372) /* metro dependency 8372: useAvatarColor */).maybeFetchColors(a1);
}
object3 = {type: type, withMutualGuilds: withMutualGuilds, withMutualFriends: withMutualFriends,
withMutualFriendsCount: withMutualFriendsCount, guildId: guildId, joinRequestId: joinRequestId,
abortSignal: abortSignal};
if (guildId == null) {
id = value2;
} else {
moduleValue4 = require(5043) /* metro dependency 5043: ConnectionsUtils */;
getVisibleConnectionsRole = moduleValue4.getVisibleConnectionsRole;
object4 = {};
object4.guildMember = GuildMemberStore.getMember(guildId, a0);
object4.channel = ChannelStore.getChannel(channelId);
value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object4]);
id = value17 == null ? value2 : value17.id;
}
object3.connectionsRoleId = id;
if (dispatchWait) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun67363);
return global.Promise.resolve();
}
value = (require(8061) /* metro dependency 8061: UserActionCreators */).fetchProfile(a0, object3,
importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */);
return r7 ? waitForRefetch ? value : global.Promise.resolve() : value;
}
return global.Promise.resolve();
}
const Promise = global.Promise;
return Promise.resolve();
}
function _fun67363() { // fn#67363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8676:1579, offset: 0x01c20213, size: 67 bytes, params: 1, frame: 18
const userActionCreatorsModule = require(8061) /* metro dependency 8061: UserActionCreators */;
return userActionCreatorsModule.fetchProfile(env0_0, env0_1,
importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */);
}