284 lines
13 KiB
TypeScript
284 lines
13 KiB
TypeScript
/* Metro module 4483; source: modules/roblox_subgame_detection/RobloxSubgameUtils.tsx; dependencies: [5, 4266, 661, 4484, 22, 4485, 3847, 2] */
|
|
function _fun38208(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:6, offset: 0x010b9d58, size: 322 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const closure = hasSubgameInfoChanged;
|
|
const closure2 = isRobloxSubgame;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_4 = (require(4266) /* metro dependency 4266: RunningGameStoreNative */).isDetectionEnabled;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_5 = constantsModule.DistributorNames;
|
|
const env0_6 = constantsModule.Distributors;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/roblox_subgame_detection/RobloxSubgameUtils.tsx');
|
|
exports.keyForRobloxGame = keyForRobloxGame;
|
|
exports.hasRunningGameChanged = hasRunningGameChanged;
|
|
exports.hasSubgameInfoChanged = closure;
|
|
exports.updateRunningGameWithRobloxSubgameInfo = updateRunningGameWithRobloxSubgameInfo;
|
|
exports.convertMapToRobloxSubgameInfo = convertMapToRobloxSubgameInfo;
|
|
exports.getSubgameMetadata = getSubgameMetadata;
|
|
exports.maybeAddAdditionalGameMetadata = maybeAddAdditionalGameMetadata;
|
|
exports.isRobloxSubgame = closure2;
|
|
exports.isRobloxSubgameApplication = function({thirdPartySkus}) {
|
|
return thirdPartySkus.some(_fun38221);
|
|
};
|
|
exports.isRobloxSubgameGame = isRobloxSubgameGame;
|
|
exports.openRobloxURLWithRootPlaceId = function() {
|
|
return _openRobloxURLWithRootPlaceId.apply(this, arguments);
|
|
};
|
|
exports.maybeTransformRobloxSubgameToRoblox = maybeTransformRobloxSubgameToRoblox;
|
|
}
|
|
|
|
function hasSubgameInfoChanged(a0, a1) { // fn#38209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:183, offset: 0x010b9e9a, size: 98 bytes, params: 3, frame: 17
|
|
var r1;
|
|
var r2;
|
|
let value = a0 == null;
|
|
let r0 = value && a1 != null;
|
|
if (!r0) {
|
|
value = a0 != null;
|
|
r1 = value && a1 == null;
|
|
if (!r1) {
|
|
value = a0 != null;
|
|
r2 = value && a1 != null;
|
|
if (r2) {
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
value = !value.isEqual(a0, a1);
|
|
r2 = value;
|
|
}
|
|
r1 = r2;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function isRobloxSubgame(a0) { // fn#38210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:304, offset: 0x010b9efc, size: 68 bytes, params: 2, frame: 13
|
|
const distributor = a0.distributor;
|
|
const ROBLOX = Distributors.ROBLOX;
|
|
return distributor === ROBLOX && a0.id !== (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).ROBLOX_APPLICATION_ID;
|
|
}
|
|
|
|
function _openRobloxURLWithRootPlaceId() { // fn#38211, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:402, offset: 0x010b9f40, size: 48 bytes, params: 1, frame: 14
|
|
return env0_3(_fun38213).apply(this, arguments);
|
|
}
|
|
|
|
function keyForRobloxGame(a0) { // fn#38214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:697, offset: 0x010b9fe0, size: 147 bytes, params: 2, frame: 19
|
|
var r1;
|
|
var r0;
|
|
var sku;
|
|
var gameMetadata;
|
|
const distributor = a0.distributor;
|
|
var value;
|
|
const ROBLOX = Distributors.ROBLOX;
|
|
const value2 = null;
|
|
if (distributor !== ROBLOX) {
|
|
r0 = value2;
|
|
} else {
|
|
sku = a0.sku;
|
|
if (value2 != sku) {
|
|
sku = a0.sku;
|
|
gameMetadata = a0.gameMetadata;
|
|
r1 = value2 == gameMetadata ? undefined : gameMetadata[(require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys.PLACE_ID];
|
|
value = '';
|
|
value = value + sku + ':' + (value2 != r1 ? r1 : value);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function hasRunningGameChanged(a0, a1, a2) { // fn#38215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:909, offset: 0x010ba073, size: 213 bytes, params: 4, frame: 20
|
|
var r1;
|
|
var r4;
|
|
var r0;
|
|
var value3;
|
|
var hasSubgameInfoChangedBinding;
|
|
var property;
|
|
const distributor = a0.distributor;
|
|
const ROBLOX = Distributors.ROBLOX;
|
|
const value2 = distributor === ROBLOX;
|
|
if (value2) {
|
|
value3 = null;
|
|
r1 = value3 != a2 && a0.id !== a2.id;
|
|
if (!r1) {
|
|
hasSubgameInfoChangedBinding = hasSubgameInfoChanged;
|
|
if (a0.distributor !== Distributors.ROBLOX) {
|
|
r4 = value3;
|
|
} else if (value3 == a0.gameMetadata) {
|
|
r4 = value3;
|
|
} else if (value3 == a0.sku) {
|
|
r4 = value3;
|
|
} else {
|
|
property = a0.gameMetadata[(require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys.PLACE_ID];
|
|
r4 = {placeId: value3 != property ? property : value3, universeId: a0.sku};
|
|
}
|
|
r1 = hasSubgameInfoChangedBinding(r4, a1);
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function updateRunningGameWithRobloxSubgameInfo(a0, {subgameInfo, application}) { // fn#38216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:1345, offset: 0x010ba148, size: 778 bytes, params: 3, frame: 24
|
|
const RobloxMetadataKeys = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys;
|
|
var Date;
|
|
var object5;
|
|
var isDetectionEnabledBinding;
|
|
var object6;
|
|
var name;
|
|
var ROBLOX;
|
|
var object7;
|
|
const ROBLOX_APPLICATION_ID = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).ROBLOX_APPLICATION_ID;
|
|
var Math;
|
|
var floor;
|
|
var Object;
|
|
const object8 = {};
|
|
copyDataProperties(object8, a0, undefined);
|
|
const Number = global.Number;
|
|
const value3 = Number(a0.gameMetadata?.[RobloxMetadataKeys.ROBLOX_TIME_STARTED]);
|
|
const r4 = global.isNaN(value3) || value3 === 0 ? a0.start ?? global.Date.now() : value3;
|
|
if (subgameInfo == null) {
|
|
if (isRobloxSubgame(a0)) {
|
|
object8.id = ROBLOX_APPLICATION_ID;
|
|
object8.name = DistributorNames[Distributors.ROBLOX];
|
|
}
|
|
object8.gameMetadata = undefined;
|
|
object8.sku = undefined;
|
|
object8.start = r4;
|
|
object8.lastFocused = global.Math.floor(r4 / 1000);
|
|
} else {
|
|
object5 = {};
|
|
if (application == null) {
|
|
object8.id = ROBLOX_APPLICATION_ID;
|
|
object8.name = DistributorNames[Distributors.ROBLOX];
|
|
object8.start = r4;
|
|
} else {
|
|
isDetectionEnabledBinding = isDetectionEnabled;
|
|
object6 = {};
|
|
object6.exePath = a0.exePath;
|
|
name = application.name;
|
|
object6.name = name;
|
|
object6.id = application.id;
|
|
ROBLOX = Distributors.ROBLOX;
|
|
object6.distributor = ROBLOX;
|
|
if (isDetectionEnabledBinding(object6)) {
|
|
isDetectionEnabledBinding = isDetectionEnabled;
|
|
object7 = {};
|
|
object7.exePath = a0.exePath;
|
|
ROBLOX = Distributors.ROBLOX;
|
|
object7.name = DistributorNames[ROBLOX];
|
|
object7.id = ROBLOX_APPLICATION_ID;
|
|
ROBLOX = Distributors.ROBLOX;
|
|
object7.distributor = ROBLOX;
|
|
if (isDetectionEnabledBinding(object7)) {
|
|
object8.id = application.id;
|
|
name = application.name;
|
|
object8.name = name;
|
|
name = application.name;
|
|
object8.gameName = name;
|
|
Date = global.Date;
|
|
object8.start = Date.now();
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
Date = global.Date;
|
|
object8.lastFocused = Reflect.apply(floor, Math, [Date.now() / 1000]);
|
|
} else {
|
|
object8.id = ROBLOX_APPLICATION_ID;
|
|
object8.name = DistributorNames[Distributors.ROBLOX];
|
|
object8.start = r4;
|
|
}
|
|
} else {
|
|
object8.id = ROBLOX_APPLICATION_ID;
|
|
object8.name = DistributorNames[Distributors.ROBLOX];
|
|
object8.start = r4;
|
|
}
|
|
}
|
|
object5[RobloxMetadataKeys.ROBLOX_TIME_STARTED] = r4.toString();
|
|
object8.sku = subgameInfo.universeId ?? undefined;
|
|
if (subgameInfo.placeId != null) {
|
|
object5[RobloxMetadataKeys.PLACE_ID] = subgameInfo.placeId;
|
|
}
|
|
Object = global.Object;
|
|
object8.gameMetadata = Object.keys(object5).length > 0 ? object5 : undefined;
|
|
}
|
|
return object8;
|
|
}
|
|
|
|
function convertMapToRobloxSubgameInfo(a0) { // fn#38217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:2370, offset: 0x010ba452, size: 172 bytes, params: 2, frame: 16
|
|
const NativeRobloxSubgameKeys = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).NativeRobloxSubgameKeys;
|
|
const UNIVERSE_ID = NativeRobloxSubgameKeys.UNIVERSE_ID;
|
|
const value2 = null;
|
|
return value2 == a0[UNIVERSE_ID] || value2 == a0[NativeRobloxSubgameKeys.PLACE_ID] ? value2 : {universeId: a0[NativeRobloxSubgameKeys.UNIVERSE_ID],
|
|
placeId: a0[NativeRobloxSubgameKeys.PLACE_ID]};
|
|
}
|
|
|
|
function getSubgameMetadata(a0) { // fn#38218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:2662, offset: 0x010ba4fe, size: 168 bytes, params: 2, frame: 17
|
|
const RobloxMetadataKeys = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys;
|
|
const distributor = a0.distributor;
|
|
const ROBLOX = Distributors.ROBLOX;
|
|
const value2 = null;
|
|
return distributor !== ROBLOX ? value2 : value2 != a0.gameMetadata && value2 != a0.gameMetadata[RobloxMetadataKeys.PLACE_ID] ? global.JSON.stringify({placeId: a0.gameMetadata[RobloxMetadataKeys.PLACE_ID]}) : value2;
|
|
}
|
|
|
|
function maybeAddAdditionalGameMetadata(a0) { // fn#38219, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:2923, offset: 0x010ba5a6, size: 196 bytes, params: 2, frame: 16
|
|
const RobloxMetadataKeys = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).RobloxMetadataKeys;
|
|
const distributor = a0.distributor;
|
|
const ROBLOX = Distributors.ROBLOX;
|
|
return distributor !== ROBLOX || a0.gameMetadata == null || (a0.gameMetadata[RobloxMetadataKeys.ROBLOX_TIME_STARTED] == null || a0.id === (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).ROBLOX_APPLICATION_ID) || a0.gameName == null ? {} : {name: a0.gameName,
|
|
sync_id: a0.gameMetadata[RobloxMetadataKeys.ROBLOX_TIME_STARTED]};
|
|
}
|
|
|
|
function isRobloxSubgameApplication({thirdPartySkus}) { // fn#38220, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:3302, offset: 0x010ba66a, size: 29 bytes, params: 2, frame: 11
|
|
return thirdPartySkus.some(function({distributor}) {
|
|
return distributor === Distributors.ROBLOX;
|
|
});
|
|
}
|
|
|
|
function isRobloxSubgameGame(a0) { // fn#38222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:3424, offset: 0x010ba6a3, size: 72 bytes, params: 2, frame: 13
|
|
const id = a0.id;
|
|
const ROBLOX_GAME_ID = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).ROBLOX_GAME_ID;
|
|
return id !== ROBLOX_GAME_ID && a0.thirdPartySkus.some(function({distributor}) {
|
|
return distributor === Distributors.ROBLOX;
|
|
});
|
|
}
|
|
|
|
function maybeTransformRobloxSubgameToRoblox(a0) { // fn#38225, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:3717, offset: 0x010ba6eb, size: 145 bytes, params: 2, frame: 17
|
|
var r0;
|
|
const ROBLOX_APPLICATION_ID = (require(4484) /* metro dependency 4484: RobloxSubgameTypes */).ROBLOX_APPLICATION_ID;
|
|
var object2;
|
|
const value = a0;
|
|
const distributor = value.distributor;
|
|
const ROBLOX = Distributors.ROBLOX;
|
|
if (distributor !== ROBLOX) {
|
|
r0 = value;
|
|
} else if (value.id === ROBLOX_APPLICATION_ID) {
|
|
r0 = value;
|
|
} else {
|
|
object2 = {};
|
|
copyDataProperties(object2, value, require);
|
|
object2['id'] = ROBLOX_APPLICATION_ID;
|
|
object2['name'] = DistributorNames[Distributors.ROBLOX];
|
|
r0 = object2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function* _fun38213(a0) { // fn#38213, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4661:483, offset: 0x010b9f79, size: 103 bytes, params: 2, frame: 14
|
|
if (true) {
|
|
value = environment.__proto__.__proto__;
|
|
var value3 = env2_1(env2_2[5]);
|
|
var getRobloxSubgameURL = value3.getRobloxSubgameURL;
|
|
yield Reflect.apply(getRobloxSubgameURL, value3, [a0]);
|
|
var value4 = undefined;
|
|
if (false) {
|
|
return value4;
|
|
}
|
|
yield env2_1(env2_2[6])(value4);
|
|
}
|
|
}
|
|
|