Files
discord-decomp/sources/actions/GamesActionCreators.native.tsx
2026-07-28 01:06:53 +03:00

182 lines
9.9 KiB
TypeScript

/* Metro module 10265; source: actions/GamesActionCreators.native.tsx; dependencies: [5, 661, 4237, 676, 6886, 3853, 694, 507, 8045, 8087, 8109, 2] */
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
import Dispatcher from '../Dispatcher.tsx'; /* Metro dependency 694 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as HTTPUtilsModule from '../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as ConstantsModule2 from '../modules/activities/Constants.tsx'; /* Metro dependency 4237 */
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
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});
object = {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};
(FileImportTrackerModule).fileFinishedImporting('actions/GamesActionCreators.native.tsx');
exports.default = object;
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
const env0_0 = a1;
const id = application.id;
const r4 = channelId != null && messageId != null ? {channel_id: channelId, message_id: messageId,
headless: true} : undefined;
(Dispatcher).dispatch({type: 'ACTIVITY_JOIN_LOADING',
applicationId: id, remotePartyId: remotePartyId});
const HTTP = (HTTPUtilsModule).HTTP;
const get = HTTP.get;
object = {'url': null, 'retries': 3, 'query': null, 'oldFormErrors': true, 'rejectWithError': true};
object.url = Endpoints.USER_ACTIVITY_JOIN(userId, sessionId, id);
object.query = r4;
return Reflect.apply(get, HTTP, [object]).then(function(a0) {
return require(a0);
}, _fun79678);
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__;
(Dispatcher).dispatch({type: 'ACTIVITY_JOIN_FAILED',
applicationId: id});
return false;
}
}
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 Module00005(_fun79691)();
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;
}
}
}
}
}
global.__d(_fun79675, 10265, [5, 661, 4237, 676, 6886, 3853, 694, 507, 8045, 8087, 8109,
2]) /* metro module 10265, dependencies: [5, 661, 4237, 676, 6886, 3853, 694, 507, 8045, 8087, 8109, 2] */;