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

79 lines
3.6 KiB
TypeScript

/* Metro module 4482; source: modules/game_detection/GameAnalyticsUtils.tsx; dependencies: [4267, 4483, 477, 2] */
function _fun38202(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4660:6, offset: 0x010b9a40, size: 149 bytes, params: 8, frame: 19
const env0_0 = require;
const normalizePath_38203 = function(a0) {
var r0;
var value = a0.toLowerCase();
if (value.endsWith('/')) {
value = value.slice(0, -1);
r0 = value;
} else {
r0 = value;
}
return r0;
};
const closure = removeExecutablePathPrefix;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const detectableGameStore = importDefault(4267) /* metro dependency 4267: DetectableGameStore */;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/game_detection/GameAnalyticsUtils.tsx');
exports.removeExecutablePathPrefix = closure;
exports.getRunningGameAnalytics = getRunningGameAnalytics;
exports.isVerifiedGameExecutable = isVerifiedGameExecutable;
}
function removeExecutablePathPrefix(a0) { // fn#38204, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4660:193, offset: 0x010b9b0c, size: 59 bytes, params: 2, frame: 12
let value = normalizePath_38203(a0);
value = value.split('/');
value = value.slice(-2);
return value.join('/');
}
function getRunningGameAnalytics(a0) { // fn#38205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4660:448, offset: 0x010b9b47, size: 374 bytes, params: 2, frame: 18
var r2;
if (a0 == null) {
return {gameName: undefined, gameId: undefined, exe: undefined, distributor: undefined, sku: undefined,
gameMetadata: undefined, rawExePath: undefined};
}
const r1 = 'exePath' in a0 ? a0.exePath : a0.exe;
const id = a0.id;
let value = undefined;
const name = a0.name;
const value2 = '';
const game = DetectableGameStore.findGame({id: id ?? value, name: name ?? value, exePath: r1 ?? value2,
cmdLine: r1 ?? value2, lastFocused: 0});
const object2 = {};
object2.gameName = a0.name ?? value;
object2.gameId = a0.id ?? (game == null ? value : game.id) ?? value;
object2.exe = r1 != null ? removeExecutablePathPrefix(r1) : value;
object2.distributor = a0.distributor ?? value;
object2.sku = a0.sku ?? value;
if (a0 != null) {
value = require(4483) /* metro dependency 4483: RobloxSubgameUtils */;
value = value.getSubgameMetadata(a0);
r2 = value;
} else {
r2 = value;
}
object2.gameMetadata = r2;
object2.rawExePath = r1;
return object2;
}
function isVerifiedGameExecutable(a0, a1) { // fn#38206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4660:1128, offset: 0x010b9cbd, size: 92 bytes, params: 3, frame: 14
if (a0 == null) {
return false;
}
if (a1 == null) {
return false;
}
const env0_0 = normalizePath_38203(a0);
const env0_1 = (require(477) /* metro dependency 477: PlatformUtils */).getPlatformName();
return a1.some(_fun38207);
}
function _fun38207(a0) { // fn#38207, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4660:1262, offset: 0x010b9d19, size: 63 bytes, params: 2, frame: 13
return a0.os === env0_1 && env0_0?.endsWith(a0.name);
}