Files
discord-decomp/sources/modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx
T
2026-07-27 16:20:00 +03:00

92 lines
5.0 KiB
TypeScript

/* Metro module 9954; source: modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx; dependencies: [31, 5199, 661, 683, 1391, 9955, 9956, 9957, 44, 2] */
function _fun77945(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77945, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10140:6, offset: 0x01e135e2, size: 248 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importAll(31) /* metro dependency 31 */;
const gameStore = importDefault(5199) /* metro dependency 5199: GameStore */;
const env0_6 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
object = {NoMatch: 'no match', NSFW: 'nsfw', Disabled: 'profile disabled'};
const closure = function(a0) {
return getRejectionReasons(a0).length === 0;
};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx');
exports.default = _default_77948;
exports.gameIsAcceptable = closure;
exports.gameIdIsAcceptable = gameIdIsAcceptable;
}
function getRejectionReasons(a0) { // fn#77946, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10140:257, offset: 0x01e136da, size: 206 bytes, params: 2, frame: 19
if (a0 == null) {
return [env0_7.NoMatch];
}
const items2 = [];
const flagUtilsModule = importAll(1391) /* metro dependency 1391: FlagUtils */;
const hasFlag = flagUtilsModule.hasFlag;
const gameFlags = a0.gameFlags;
const GameFlags = (require(9955) /* metro dependency 9955: GameFlags */).GameFlags;
const GAME_PROFILE_DISABLED = GameFlags.GAME_PROFILE_DISABLED;
if (Reflect.apply(hasFlag, flagUtilsModule, [gameFlags, GAME_PROFILE_DISABLED])) {
items2.push(env0_7.Disabled);
}
const themes = a0.themes;
const includes = themes.includes;
const ThirdPartyGameApplicationThemes = (require(9956) /* metro dependency 9956: ThirdPartyGameApplicationThemes */).ThirdPartyGameApplicationThemes;
const EROTIC = ThirdPartyGameApplicationThemes.EROTIC;
if (Reflect.apply(includes, themes, [EROTIC])) {
items2.push(env0_7.NSFW);
}
return items2;
}
function _default_77948({applicationId, gameId, source, trackEntryPointImpression}) { // fn#77948, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10140:543, offset: 0x01e137c6, size: 221 bytes, params: 2, frame: 20
applicationId = applicationId === undefined ? '' : applicationId;
trackEntryPointImpression = trackEntryPointImpression === undefined || trackEntryPointImpression;
const binding = undefined;
const env0_2 = binding.useRef(false);
const {gameId, gameRecord,
isLoading} = (importDefault(9957) /* metro dependency 9957: useResolveGameForProfile */)({applicationId: applicationId,
gameId: gameIdBinding});
const value = gameIsAcceptable(gameRecord);
binding.useEffect(_fun77949, [gameRecord, value, isLoading, source, trackEntryPointImpression]);
return {shouldOpenGameProfile: value, gameId: gameIdBinding};
}
function gameIdIsAcceptable(a0) { // fn#77950, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10140:1299, offset: 0x01e13975, size: 34 bytes, params: 2, frame: 12
return gameIsAcceptable(GameStore.getGame(a0));
}
function _fun77949() { // fn#77949, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10140:756, offset: 0x01e138a3, size: 210 bytes, params: 1, frame: 19
var r6;
var value2;
var defaultImport;
var sourceBinding;
var rejectionReasons;
var binding;
var id;
var defaultImport2;
if (!env0_2.current) {
if (trackEntryPointImpression) {
if (!isLoading) {
if (gameRecord != null) {
value2 = environment.__proto__;
defaultImport = importDefault(44) /* metro dependency 44 */;
sourceBinding = source;
defaultImport(sourceBinding != null,
'Cannot track a Game Profile Entry Point Impressions without a source.');
rejectionReasons = getRejectionReasons(gameRecord);
binding = env0_5;
id = gameRecord.id;
r6 = rejectionReasons !== undefined ? rejectionReasons : [];
defaultImport2 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
defaultImport2.track(AnalyticEvents.GAME_PROFILE_ENTRY_POINT_AVAILABLE,
{game_profile_available: binding,
application_id: id, rejection_reason: r6, source: sourceBinding});
env0_2.current = true;
}
}
}
}
}