Files
discord-decomp/sources/actions/GamesActionCreators.native.tsx
T
2026-07-27 16:20:00 +03:00

182 lines
8.3 KiB
TypeScript

/* Metro module 10265; source: actions/GamesActionCreators.native.tsx; dependencies: [5, 661, 4237, 676, 6886, 3853, 694, 507, 8045, 8087, 8109, 2] */
function _fun79675(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10451:6, offset: 0x01e5dd05, size: 349 bytes, params: 8, frame: 20
var object2;
const env0_0 = require;
const closure = function(a0, a1) {
var value = a0.replace(RegExp('\\/+$', ''), '');
var GAME_INVITE_FRAGMENT = DiscordConnectDeeplinks.GAME_INVITE_FRAGMENT;
value = '' + value + GAME_INVITE_FRAGMENT + a1;
importDefault(dependencyMap[5]).openURL(value, WebBrowserType.SAFARI);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_4 = constantsModule.Endpoints;
const env0_5 = constantsModule.DiscordConnectDeeplinks;
const env0_6 = constantsModule.WebBrowserType;
const env0_7 = constantsModule.ActivityFlags;
const env0_8 = (require(4237) /* metro dependency 4237: Constants */).ActivityIntent;
object2 = {addGame: function() {
}, toggleOverlay: function() {
}, editName: function() {
}, identifyGame: function() {
var Promise = global.Promise;
var Error = global.Error;
return Promise.reject(new Error('not supported'));
}, getDetectableGames: function() {
}, reportUnverifiedGame: function() {
}, uploadIcon: function() {
}, deleteEntry: function() {
}, launch: function() {
var Promise = global.Promise;
return Promise.resolve();
}, join: join_79689, joinWithSecret: closure};
(require(2) /* metro dependency 2 */).fileFinishedImporting('actions/GamesActionCreators.native.tsx');
exports.default = object2;
}
function fetchJoinSecret({userId, sessionId, application, channelId, messageId, remotePartyId}, a1) { // fn#79676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10451:220, offset: 0x01e5de62, size: 249 bytes, params: 3, frame: 23
var object2;
const env0_0 = a1;
const id = application.id;
const r4 = channelId != null && messageId != null ? {channel_id: channelId, message_id: messageId,
headless: true} : undefined;
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'ACTIVITY_JOIN_LOADING',
applicationId: id, remotePartyId: remotePartyId});
const HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
const get = HTTP.get;
object2 = {'url': null, 'retries': 3, 'query': null, 'oldFormErrors': true, 'rejectWithError': true};
object2.url = Endpoints.USER_ACTIVITY_JOIN(userId, sessionId, id);
object2.query = r4;
return Reflect.apply(get, HTTP, [object2]).then(function(a0) {
return require(a0);
}, _fun79678);
}
function join_79689(a0) { // fn#79689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10451:1038, offset: 0x01e5e00b, size: 36 bytes, params: 2, frame: 11
const env0_0 = a0;
return env0_3(_fun79691)();
}
function _fun79678() { // fn#79678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10451:622, offset: 0x01e5df5b, size: 62 bytes, params: 1, frame: 12
const value = environment.__proto__;
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'ACTIVITY_JOIN_FAILED',
applicationId: id});
return false;
}
function* _fun79691() { // fn#79691, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10451:1044, offset: 0x01e5e03a, size: 323 bytes, params: 1, frame: 23
var environment;
var binding;
var canLaunchFrame2;
var binding2;
if (false) {
return undefined;
}
value = environment.__proto__;
const application = require.application;
const channelId = require.channelId;
const embedded = require.embedded;
const source = require.source;
const locationObject = require.locationObject;
const value3 = undefined;
const r9 = value3 !== locationObject ? locationObject : {};
const analyticsLocations = require.analyticsLocations;
const r8 = value3 !== analyticsLocations ? analyticsLocations : [];
const remotePartyId = require.remotePartyId;
if (embedded) {
value = environment.__proto__.__proto__;
binding = env2_0;
canLaunchFrame2 = binding(env2_2[8]).canLaunchFrame(application);
binding = env2_1;
binding2 = env2_2;
if (canLaunchFrame2) {
value = binding(binding2[9]);
yield value.launchFrame({applicationId: application.id});
value = undefined;
if (false) {
return value;
}
return true;
}
value = binding(binding2[10]);
yield value({applicationId: application.id, activityChannelId: channelId ?? value3, source: source,
locationObject: r9, analyticsLocations: r8});
value = undefined;
if (false) {
return value;
}
return value != null && value;
}
return remotePartyId != null ? env2_9(require, function() {
return true;
}) : joinViaDeeplink(require);
}
function joinViaDeeplink(a0) { // fn#79693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10451:1489, offset: 0x01e5e17d, size: 185 bytes, params: 2, frame: 18
var environment;
const env0_0 = a0;
const application = a0.application;
const id = application.id;
const value = environment.__proto__.__proto__.__proto__;
const DISCORD_CONNECT_EXAMPLE_APP_APPLICATION_ID = env3_0(env3_2[3]).DISCORD_CONNECT_EXAMPLE_APP_APPLICATION_ID;
return (id === DISCORD_CONNECT_EXAMPLE_APP_APPLICATION_ID ? env3_0(env3_2[3]).DISCORD_CONNECT_EXAMPLE_APP_DEEPLINK_URI : application.deeplink_uri) != null || env3_1(env3_2[4])(a0.applicationActivity,
env3_7.SUPPORTS_JOIN_URL) ? env3_9(a0, _fun79694) : global.Promise.resolve(false);
}
function _fun79694(a0) { // fn#79694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10451:1749, offset: 0x01e5e236, size: 402 bytes, params: 2, frame: 20
var r0;
var value;
var value2;
var binding;
var value3;
var dispatch;
var applicationBinding;
var embedded;
var value4;
var binding2;
var value6;
var value7;
const join_url = a0.body.join_url;
const secret = a0.body.secret;
if (join_url != null) {
value = environment.__proto__.__proto__.__proto__.__proto__;
binding = env4_1;
binding2 = env4_2;
value6 = binding(binding2[5]);
value6.openURL(join_url, env4_6.SAFARI);
value7 = binding(binding2[6]);
dispatch = value7.dispatch;
applicationBinding = application;
embedded = env0_0.embedded;
value = embedded != null;
Reflect.apply(dispatch, value7, [{type: 'ACTIVITY_JOIN', applicationId: applicationBinding.id,
parentApplicationId: applicationBinding.parent_id, secret: secret, intent: env4_8.PLAY,
embedded: value && embedded}]);
value = true;
r0 = value;
} else if (env0_1 == null) {
value4 = environment.__proto__.__proto__.__proto__.__proto__;
env4_1(env4_2[6]).dispatch({type: 'ACTIVITY_JOIN_FAILED', applicationId: application.id});
r0 = false;
} else {
value2 = environment.__proto__.__proto__.__proto__.__proto__;
binding = env4_10;
binding(env0_1, secret);
binding = env4_1;
value3 = binding(env4_2[6]);
dispatch = value3.dispatch;
applicationBinding = application;
embedded = env0_0.embedded;
value = embedded != null;
Reflect.apply(dispatch, value3, [{type: 'ACTIVITY_JOIN', applicationId: applicationBinding.id,
parentApplicationId: applicationBinding.parent_id, secret: secret, intent: env4_8.PLAY,
embedded: value && embedded}]);
value = true;
r0 = value;
}
return r0;
}