221 lines
12 KiB
TypeScript
221 lines
12 KiB
TypeScript
/* Metro module 10581; source: stores/views/ActivityLauncherStore.tsx; dependencies: [6, 7, 15, 17, 18, 6877, 6876, 661, 4041, 694, 566, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
|
|
import SelfPresenceStore from '../SelfPresenceStore.tsx'; /* Metro dependency 6876 */
|
|
import LocalActivityStore from '../LocalActivityStore.tsx'; /* Metro dependency 6877 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */
|
|
|
|
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 ACTIVITY_JOIN2 = ACTIVITY_JOIN;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ConstantsModule;
|
|
const env0_10 = value.ActivityActionStates;
|
|
const env0_11 = value.ActivityActionTypes;
|
|
let env0_12 = {};
|
|
const env0_13 = {};
|
|
const Store = (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: ACTIVITY_JOIN2, EMBEDDED_ACTIVITY_CLOSE: ACTIVITY_JOIN2,
|
|
ACTIVITY_LAUNCH_FAIL: ACTIVITY_LAUNCH_FAIL});
|
|
(FileImportTrackerModule).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 = (TimersModule).Timeout;
|
|
const timeout = new Timeout();
|
|
timeout.start(a2, _fun81646);
|
|
env0_13[a0] = timeout;
|
|
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 (Dispatcher).dispatch({type: 'ACTIVITY_LAUNCH_FAIL',
|
|
applicationId: env0_0, activityType: require});
|
|
}
|
|
|
|
}
|
|
|
|
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 _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 _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 ActivityLauncherStore2 = ActivityLauncherStore;
|
|
Inherits(ActivityLauncherStore2, a0);
|
|
return CreateClass(ActivityLauncherStore2, [{key: 'initialize', value: function() {
|
|
this.syncWith([LocalActivityStore, SelfPresenceStore], handleActivityUpdate);
|
|
}}, {key: 'getState', value: value_81656}, {key: 'getStates', value: value_81657}]);
|
|
function ActivityLauncherStore() { // fn#81654, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10767:1668, offset: 0x010e918b, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_3(this, ActivityLauncherStore);
|
|
const value3 = env1_6(ActivityLauncherStore);
|
|
return env1_5(this, _isNativeReflectConstruct_81642() ? global.Reflect.construct(value3, arguments,
|
|
env1_6(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
function value_81657() { // fn#81657, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1
|
|
return env1_12;
|
|
}
|
|
|
|
}
|
|
|
|
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];
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun81641, 10581, [6, 7, 15, 17, 18, 6877, 6876, 661, 4041, 694, 566,
|
|
2]) /* metro module 10581, dependencies: [6, 7, 15, 17, 18, 6877, 6876, 661, 4041, 694, 566, 2] */;
|