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

179 lines
11 KiB
TypeScript

/* Metro module 11328; source: actions/ActivitiesActionCreators.tsx; dependencies: [5, 1379, 661, 4503, 694, 507, 7076, 7067, 4863, 4603, 2] */
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
import Dispatcher from '../Dispatcher.tsx'; /* Metro dependency 694 */
import ChannelStore from '../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import ChannelActionCreators from './ChannelActionCreators.tsx'; /* Metro dependency 4603 */
import AppAnalyticsUtils from '../modules/app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
import MessageActionCreators from './MessageActionCreators.tsx'; /* Metro dependency 7067 */
import MessageParser from '../modules/messages/MessageParser.tsx'; /* Metro dependency 7076 */
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 MessageConstantsModule from '../modules/messages/MessageConstants.tsx'; /* Metro dependency 4503 */
function _fun86486(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86486, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:6, offset: 0x01f95e96, size: 265 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {updateActivity: updateActivity, sendActivityInvite: sendActivityInvite,
sendActivityInviteUser: sendActivityInviteUser, getJoinSecret: getJoinSecret,
subscribeActivities: subscribeActivities};
(FileImportTrackerModule).fileFinishedImporting('actions/ActivitiesActionCreators.tsx');
exports.default = object;
function updateActivity({applicationId, distributor, shareActivity, token, duration, closed, exePath, voiceChannelId, sessionId, mediaSessionId}) { // fn#86487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:233, offset: 0x01f95f9f, size: 318 bytes, params: 2, frame: 25
token = token === undefined ? null : token;
duration = duration === undefined ? 0 : duration;
closed = !(closed === undefined) && closed;
exePath = exePath === undefined ? null : exePath;
voiceChannelId = voiceChannelId === undefined ? null : voiceChannelId;
sessionId = sessionId === undefined ? null : sessionId;
mediaSessionId = mediaSessionId === undefined ? null : mediaSessionId;
(Dispatcher).wait(_fun86488);
const HTTP = (HTTPUtilsModule).HTTP;
const post = HTTP.post;
const ACTIVITIES = Endpoints.ACTIVITIES;
let value = Reflect.apply(post, HTTP, [{'url': null, 'body': null, 'retries': 1, 'oldFormErrors': true,
'rejectWithError': true, url: ACTIVITIES, body: {application_id: applicationId, token: token,
duration: duration, share_activity: shareActivity, distributor: distributor, closed: closed, exePath: exePath,
voice_channel_id: voiceChannelId, session_id: sessionId, media_session_id: mediaSessionId}}]);
value = value.then(_fun86489);
value.catch(_fun86490);
function _fun86488() { // fn#86488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:425, offset: 0x01f960dd, size: 77 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (Dispatcher).dispatch({type: 'ACTIVITY_UPDATE_START',
applicationId: applicationId, duration: duration, distributor: distributor});
}
function _fun86489({body}) { // fn#86489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:755, offset: 0x01f9612a, size: 96 bytes, params: 2, frame: 15
const token = body.token;
const value = environment.__proto__;
(Dispatcher).dispatch({type: 'ACTIVITY_UPDATE_SUCCESS',
applicationId: applicationId, token: token, duration: duration, distributor: distributor});
}
function _fun86490() { // fn#86490, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:886, offset: 0x01f9618a, size: 60 bytes, params: 1, frame: 13
const value = environment.__proto__;
(Dispatcher).dispatch({type: 'ACTIVITY_UPDATE_FAIL',
applicationId: applicationId});
}
}
function sendActivityInvite({channelId, type, activity, content, targetUserId, location}) { // fn#86491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:959, offset: 0x01f961c6, size: 250 bytes, params: 2, frame: 24
const channel = ChannelStore.getChannel(channelId);
if (channel == null) {
return global.Promise.resolve(null);
}
const defaultImport = MessageParser;
const value4 = defaultImport.parse(channel, content ?? '');
const defaultImport2 = MessageActionCreators;
const sendMessage = defaultImport2.sendMessage;
const id = channel.id;
const ACTIVITY_SHARE = MessageSendLocation.ACTIVITY_SHARE;
return Reflect.apply(sendMessage, defaultImport2, [id, value4, false, {activityAction: {type: type,
activity: activity, targetUserId: targetUserId}, location: ACTIVITY_SHARE}]).then(_fun86492, function(a0) {
var Promise = global.Promise;
return Promise.reject(a0);
});
function _fun86492(a0) { // fn#86492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:1267, offset: 0x01f962c0, size: 203 bytes, params: 2, frame: 18
let value = environment.__proto__;
const defaultImport = AppAnalyticsUtils;
const trackWithMetadata = defaultImport.trackWithMetadata;
const INVITE_SENT = AnalyticEvents.INVITE_SENT;
const object = {};
object.location = location;
const type = activity.type;
const LISTENING = ActivityTypes.LISTENING;
object.invite_type = type === LISTENING ? LoggingInviteTypes.SPOTIFY : LoggingInviteTypes.APPLICATION;
object.application_id = activity.application_id;
const binding = env0_2;
object.guild_id = binding.getGuildId();
object.channel_id = binding.id;
value = null;
object.message_id = value != a0 ? a0.body.id : value;
Reflect.apply(trackWithMetadata, defaultImport, [INVITE_SENT, object]);
const Promise = global.Promise;
return Promise.resolve(env0_2);
}
}
function sendActivityInviteUser({userId, type, activity, content, location}) { // fn#86494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:1534, offset: 0x01f9638b, size: 109 bytes, params: 2, frame: 13
let value = ChannelActionCreators;
value = value.ensurePrivateChannel(userId);
return value.then(_fun86495);
function _fun86495(a0) { // fn#86495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:1653, offset: 0x01f963f8, size: 62 bytes, params: 2, frame: 13
return env0_0.sendActivityInvite({channelId: a0, type: type, activity: activity, content: content,
location: location});
}
}
function getJoinSecret(a0, a1, a2, a3, a4) { // fn#86496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:1751, offset: 0x01f96436, size: 64 bytes, params: 6, frame: 11
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const env0_3 = a3;
const env0_4 = a4;
return env0_3(_fun86498)();
function* _fun86498() { // fn#86498, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:1767, offset: 0x01f96481, size: 202 bytes, params: 1, frame: 20
if (false) {
return undefined;
}
const object = {};
value = environment.__proto__;
if (env1_3 != null) {
object.channel_id = env1_3;
}
if (ChannelStore != null) {
object.message_id = ChannelStore;
}
const HTTP = env2_0(env2_2[5]).HTTP;
const get = HTTP.get;
const object2 = {};
object2.url = env2_5.USER_ACTIVITY_JOIN(require, importDefault, dependencyMap);
object2.retries = 3;
object2.query = object;
object2.rejectWithError = false;
yield Reflect.apply(get, HTTP, [object2]);
value = undefined;
if (false) {
return value;
}
return {secret: value.body.secret, joinUrl: value.body.join_url};
}
}
function subscribeActivities(a0) { // fn#86499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:2019, offset: 0x01f9654b, size: 36 bytes, params: 2, frame: 11
const env0_0 = a0;
return Module00005(_fun86501)();
function* _fun86501() { // fn#86501, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11514:2025, offset: 0x01f9657a, size: 142 bytes, params: 1, frame: 14
var environment;
if (false) {
return undefined;
}
value = environment.__proto__;
value = require.map(function({userId, applicationId, partyId, messageId, channelId}) {
return {user_id: userId, application_id: applicationId, party_id: partyId, message_id: messageId,
channel_id: channelId};
});
const HTTP = env2_0(env2_2[5]).HTTP;
const post = HTTP.post;
const USER_ACTIVITY_SUBSCRIBE = env2_5.USER_ACTIVITY_SUBSCRIBE;
yield Reflect.apply(post, HTTP, [{url: USER_ACTIVITY_SUBSCRIBE, body: {subscriptions: value}, retries: 1,
rejectWithError: false}]);
value = undefined;
if (false) {
return value;
}
return value.body;
}
}
}
global.__d(_fun86486, 11328, [5, 1379, 661, 4503, 694, 507, 7076, 7067, 4863, 4603,
2]) /* metro module 11328, dependencies: [5, 1379, 661, 4503, 694, 507, 7076, 7067, 4863, 4603, 2] */;