Files
discord-decomp/sources/stores/views/ActivityLauncherStore.tsx
T
2026-07-27 16:20:00 +03:00

200 lines
9.5 KiB
TypeScript

/* Metro module 10581; source: stores/views/ActivityLauncherStore.tsx; dependencies: [6, 7, 15, 17, 18, 6877, 6876, 661, 4041, 694, 566, 2] */
function _fun81641(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81641, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:6, offset: 0x01ed8782, size: 455 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = ACTIVITY_JOIN;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const localActivityStore = importDefault(6877) /* metro dependency 6877: LocalActivityStore */;
const selfPresenceStore = importDefault(6876) /* metro dependency 6876: SelfPresenceStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_10 = value.ActivityActionStates;
const env0_11 = value.ActivityActionTypes;
let env0_12 = {};
const env0_13 = {};
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun81653(Store).displayName = 'ActivityLauncherStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{OVERLAY_INITIALIZE: function({activityLauncherStates}) {
var object = {};
copyDataProperties(object, activityLauncherStates, object);
env0_12 = object;
}, ACTIVITY_JOIN_LOADING: function(a0) {
var handleActivityStateChangedBinding = handleActivityStateChanged;
var LOADING = ActivityActionStates.LOADING;
return handleActivityStateChangedBinding(LOADING, ActivityActionTypes.JOIN, a0);
}, ACTIVITY_JOIN_FAILED: function(a0) {
var handleActivityStateChangedBinding = handleActivityStateChanged;
var FAILED = ActivityActionStates.FAILED;
return handleActivityStateChangedBinding(FAILED, ActivityActionTypes.JOIN, a0);
}, ACTIVITY_JOIN: closure, EMBEDDED_ACTIVITY_CLOSE: closure, ACTIVITY_LAUNCH_FAIL: ACTIVITY_LAUNCH_FAIL});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/views/ActivityLauncherStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_81642() { // fn#81642, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:227, offset: 0x01ed8949, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_81642_isNativeReflectConstruct = function() {
return !!result;
})();
}
function startActivityLaunchTimeout(a0, a1, a2) { // fn#81645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:441, offset: 0x01ed89ab, size: 130 bytes, params: 4, frame: 16
const env0_0 = a0;
const env0_1 = a1;
if (env0_13[a0] != null) {
env0_13[a0].stop();
}
const Timeout = (require(4041) /* metro dependency 4041: Timers */).Timeout;
const timeout = new Timeout();
timeout.start(a2, _fun81646);
env0_13[a0] = timeout;
}
function handleActivityStateChanged(a0, a1, {applicationId, remotePartyId}) { // fn#81647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:638, offset: 0x01ed8a72, size: 220 bytes, params: 4, frame: 19
var r7;
var property;
const COMPLETE = ActivityActionStates.COMPLETE;
if (a0 === COMPLETE) {
property = env0_12[applicationId];
if (property != null) {
delete property[a1];
}
if (env0_13[applicationId] != null) {
env0_13[applicationId].stop();
delete env0_13[applicationId];
}
} else {
r7 = env0_12[applicationId] ?? ({});
r7[a1] = {state: a0, remotePartyId: remotePartyId};
env0_12[applicationId] = r7;
var FAILED = ActivityActionStates.FAILED;
if (a0 === FAILED) {
startActivityLaunchTimeout(applicationId, a1, env0_14);
} else if (a0 === ActivityActionStates.LOADING) {
startActivityLaunchTimeout(applicationId, a1, remotePartyId != null ? 15000 : env0_14);
}
}
}
function ACTIVITY_JOIN(a0) { // fn#81648, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:991, offset: 0x01ed8b4e, size: 72 bytes, params: 2, frame: 16
return (a0.type !== 'ACTIVITY_JOIN' || a0.parentApplicationId == null) && handleActivityStateChanged(ActivityActionStates.COMPLETE,
ActivityActionTypes.JOIN, a0);
}
function handleActivityUpdate() { // fn#81649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:1137, offset: 0x01ed8b96, size: 91 bytes, params: 1, frame: 12
const Object = global.Object;
let value = Object.entries(env0_12);
value = value.map(function(a0) {
var r0;
var r3;
var r4;
var item3;
var value3;
var iterator = a0[Symbol.iterator]();
var iterator2 = iterator.next;
var item2 = Reflect.apply(iterator2, iterator, []);
var item = item2.value;
item2 = item2.done ? undefined : iterator;
var value = undefined;
var value2 = item2 === value;
var r2 = value2 ? value : item;
if (value2) {
r0 = item2;
r3 = value;
r4 = value2;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r0 = item3;
r3 = value;
r4 = value3;
} else {
r0 = item3;
r3 = item;
r4 = value3;
}
}
if (!r4) {
r0.return();
}
var property = r3[ActivityActionTypes.JOIN];
return {applicationId: r2, remotePartyId: property == null ? value : property.remotePartyId};
});
value = value.filter(function(a0) {
return a0.remotePartyId != null;
});
const env0_0 = false;
value.forEach(_fun81652);
return env0_0;
}
function _fun81653(a0) { // fn#81653, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:1656, offset: 0x01ed8d20, size: 124 bytes, params: 2, frame: 16
const closure = ActivityLauncherStore;
env0_7(closure, a0);
return env0_4(closure, [{key: 'initialize', value: function() {
this.syncWith([LocalActivityStore, SelfPresenceStore], handleActivityUpdate);
}}, {key: 'getState', value: value_81656}, {key: 'getStates', value: value_81657}]);
}
function ACTIVITY_LAUNCH_FAIL({applicationId, activityType}) { // fn#81661, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:2603, offset: 0x01ed8e6b, size: 43 bytes, params: 2, frame: 3
const property = env0_12[applicationId];
if (property == null) {
return false;
}
delete property[activityType];
}
function _fun81646() { // fn#81646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:546, offset: 0x01ed8a2d, size: 69 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'ACTIVITY_LAUNCH_FAIL',
applicationId: env0_0, activityType: require});
}
function _fun81652({applicationId, remotePartyId}) { // fn#81652, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:1360, offset: 0x01ed8c70, size: 176 bytes, params: 2, frame: 19
const applicationActivity = LocalActivityStore.getApplicationActivity(applicationId);
const applicationActivity2 = SelfPresenceStore.getApplicationActivity(applicationId);
if (!((applicationActivity == null || applicationActivity.party == null ? undefined : applicationActivity.party.id) !== remotePartyId && (applicationActivity2 == null || applicationActivity2.party == null ? undefined : applicationActivity2.party.id) !== remotePartyId)) {
handleActivityStateChanged(ActivityActionStates.COMPLETE, ActivityActionTypes.JOIN,
{applicationId: applicationId,
remotePartyId: remotePartyId});
}
}
function value_81656(a0, a1) { // fn#81656, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:2068, offset: 0x01ed8dca, size: 48 bytes, params: 3, frame: 5
const value = environment.__proto__;
const property = env1_12[a0];
return property == null || property[a1] == null ? undefined : property[a1].state;
}