/* Metro module 8491; source: modules/user_profile/maybeFetchUserProfile.tsx; dependencies: [1379, 1945, 5189, 5120, 8372, 5043, 694, 8061, 8492, 2] */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */ import UserProfileStore from './UserProfileStore.tsx'; /* Metro dependency 5189 */ import PreloadUserBannerImage from './preloadUserBannerImage.tsx'; /* Metro dependency 8492 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as UserActionCreatorsModule from '../../actions/UserActionCreators.tsx'; /* Metro dependency 8061 */ 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}); (FileImportTrackerModule).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 object; var mutualGuilds; var mutualFriends; var mutualFriendsCount; var moduleValue; var moduleValue2; var moduleValue4; var getVisibleConnectionsRole; var object2; 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(); } let userProfileStoreBinding = UserProfileStore; if (userProfileStoreBinding.isFetchingProfile(a0, guildId)) { return global.Promise.resolve(); } userProfileStoreBinding = UserProfileStore; const userProfile = userProfileStoreBinding.getUserProfile(a0); const guildMemberProfile = userProfileStoreBinding.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) { userProfileStoreBinding = UserProfileStore; mutualGuilds = userProfileStoreBinding.getMutualGuilds(a0); mutualFriends = userProfileStoreBinding.getMutualFriends(a0); mutualFriendsCount = userProfileStoreBinding.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); } object = {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; object2 = {}; object2.guildMember = GuildMemberStore.getMember(guildId, a0); object2.channel = ChannelStore.getChannel(channelId); value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object2]); id = value17 == null ? value2 : value17.id; } object.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, object, 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); } object = {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; object2 = {}; object2.guildMember = GuildMemberStore.getMember(guildId, a0); object2.channel = ChannelStore.getChannel(channelId); value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object2]); id = value17 == null ? value2 : value17.id; } object.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, object, 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) { userProfileStoreBinding = UserProfileStore; mutualGuilds = userProfileStoreBinding.getMutualGuilds(a0); mutualFriends = userProfileStoreBinding.getMutualFriends(a0); mutualFriendsCount = userProfileStoreBinding.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); } object = {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; object2 = {}; object2.guildMember = GuildMemberStore.getMember(guildId, a0); object2.channel = ChannelStore.getChannel(channelId); value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object2]); id = value17 == null ? value2 : value17.id; } object.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, object, 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); } object = {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; object2 = {}; object2.guildMember = GuildMemberStore.getMember(guildId, a0); object2.channel = ChannelStore.getChannel(channelId); value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object2]); id = value17 == null ? value2 : value17.id; } object.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, object, importDefault(8492) /* metro dependency 8492: preloadUserBannerImage */); return r7 ? waitForRefetch ? value : global.Promise.resolve() : value; } return global.Promise.resolve(); } if (value7) { userProfileStoreBinding = UserProfileStore; mutualGuilds = userProfileStoreBinding.getMutualGuilds(a0); mutualFriends = userProfileStoreBinding.getMutualFriends(a0); mutualFriendsCount = userProfileStoreBinding.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); } object = {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; object2 = {}; object2.guildMember = GuildMemberStore.getMember(guildId, a0); object2.channel = ChannelStore.getChannel(channelId); value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object2]); id = value17 == null ? value2 : value17.id; } object.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, object, 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); } object = {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; object2 = {}; object2.guildMember = GuildMemberStore.getMember(guildId, a0); object2.channel = ChannelStore.getChannel(channelId); value17 = Reflect.apply(getVisibleConnectionsRole, moduleValue4, [object2]); id = value17 == null ? value2 : value17.id; } object.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, object, 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 return UserActionCreatorsModule.fetchProfile(env0_0, env0_1, PreloadUserBannerImage); } } } global.__d(_fun67361, 8491, [1379, 1945, 5189, 5120, 8372, 5043, 694, 8061, 8492, 2]) /* metro module 8491, dependencies: [1379, 1945, 5189, 5120, 8372, 5043, 694, 8061, 8492, 2] */;