Files
discord-decomp/sources/modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx
T
2026-07-28 01:06:53 +03:00

99 lines
6.0 KiB
TypeScript

/* Metro module 9954; source: modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx; dependencies: [31, 5199, 661, 683, 1391, 9955, 9956, 9957, 44, 2] */
import GameStore from '../../games/GameStore.tsx'; /* Metro dependency 5199 */
import UseResolveGameForProfile from './useResolveGameForProfile.tsx'; /* Metro dependency 9957 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as FlagUtilsModule from '../../../external/discord_common/js/shared/utils/FlagUtils.tsx'; /* Metro dependency 1391 */
import * as GameFlagsModule from '../../../external/discord_common/js/shared/shared-constants/GameFlags.tsx'; /* Metro dependency 9955 */
import * as ThirdPartyGameApplicationThemesModule from '../../../external/discord_common/js/shared/shared-constants/ThirdPartyGameApplicationThemes.tsx'; /* Metro dependency 9956 */
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});
object = {NoMatch: 'no match', NSFW: 'nsfw', Disabled: 'profile disabled'};
const closure = function(a0) {
return getRejectionReasons(a0).length === 0;
};
(FileImportTrackerModule).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 hasFlag = FlagUtilsModule.hasFlag;
const gameFlags = a0.gameFlags;
const GameFlags = (GameFlagsModule).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 = (ThirdPartyGameApplicationThemesModule).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} = (UseResolveGameForProfile)({applicationId: applicationId,
gameId: gameIdBinding});
const value = gameIsAcceptable(gameRecord);
binding.useEffect(_fun77949, [gameRecord, value, isLoading, source, trackEntryPointImpression]);
return {shouldOpenGameProfile: value, gameId: gameIdBinding};
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;
}
}
}
}
}
}
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));
}
}
global.__d(_fun77945, 9954, [31, 5199, 661, 683, 1391, 9955, 9956, 9957, 44,
2]) /* metro module 9954, dependencies: [31, 5199, 661, 683, 1391, 9955, 9956, 9957, 44, 2] */;