226 lines
10 KiB
TypeScript
226 lines
10 KiB
TypeScript
/* Metro module 12594; source: stores/NowPlayingStore.tsx; dependencies: [6, 7, 15, 17, 18, 5221, 4396, 1878, 661, 12595, 566, 694, 2] */
|
|
function _fun96527(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:6, offset: 0x0215ffa2, size: 453 bytes, params: 8, frame: 19
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_4 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_5 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_6 = importDefault(18) /* metro dependency 18 */;
|
|
const userAffinitiesV2Store = importDefault(5221) /* metro dependency 5221: UserAffinitiesV2Store */;
|
|
const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const env0_10 = (require(661) /* metro dependency 661: Constants */).ActivityTypes;
|
|
let env0_12 = {};
|
|
let env0_13 = {};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
let value = _fun96541(Store);
|
|
value.displayName = 'NowPlayingStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
|
|
env0_12 = {};
|
|
env0_13 = {};
|
|
}, CONNECTION_OPEN_SUPPLEMENTAL: CONNECTION_OPEN_SUPPLEMENTAL_96550, LOGOUT: function() {
|
|
env0_12 = {};
|
|
env0_13 = {};
|
|
}, PRESENCE_UPDATES: function({updates}) {
|
|
return updates.map(_fun96554).some(_fun96555);
|
|
}, PRESENCES_REPLACE: function({presences}) {
|
|
return handleMultipleUpdates(presences);
|
|
}});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/NowPlayingStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_96528() { // fn#96528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:202, offset: 0x02160167, 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_96528_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function handleMultipleUpdates(a0) { // fn#96531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:414, offset: 0x021601c9, size: 34 bytes, params: 2, frame: 12
|
|
const env0_0 = false;
|
|
a0.forEach(_fun96532);
|
|
return env0_0;
|
|
}
|
|
|
|
function removeUserIfNeeded(a0) { // fn#96533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:519, offset: 0x02160215, size: 137 bytes, params: 2, frame: 15
|
|
var r5;
|
|
var object2;
|
|
var Object;
|
|
const property = env0_13[a0];
|
|
if (property == null) {
|
|
return false;
|
|
}
|
|
const gameId = property.gameId;
|
|
if (env0_12[gameId] != null) {
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_12, r5);
|
|
env0_12 = object2;
|
|
delete object2[gameId][a0];
|
|
Object = global.Object;
|
|
if (Object.values(object2[gameId]).length !== 0) {
|
|
r5 = Object;
|
|
} else {
|
|
delete env0_12[gameId];
|
|
r5 = Object;
|
|
}
|
|
}
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_13, r5);
|
|
delete object2[a0];
|
|
return true;
|
|
}
|
|
|
|
function _handlePresenceUpdate({user, activities}) { // fn#96534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:707, offset: 0x0216029e, size: 112 bytes, params: 2, frame: 14
|
|
var environment;
|
|
if (user != null) {
|
|
var value = activities.filter(function({type}) {
|
|
return type !== ActivityTypes.CUSTOM_STATUS;
|
|
});
|
|
if (value.length === 0) {
|
|
value = environment;
|
|
return removeUserIfNeeded(user.id);
|
|
}
|
|
value.forEach(function(a0) {
|
|
if (_fun96537(a0, user)) {
|
|
env0_1 = true;
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function handleUserAffinitiesV2StoreUpdate() { // fn#96538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:1343, offset: 0x0216045b, size: 67 bytes, params: 1, frame: 11
|
|
const r0 = !(UserAffinitiesV2Store.shouldFetch() || result) && refreshStateFromPresence();
|
|
result = !UserAffinitiesV2Store.shouldFetch();
|
|
return r0;
|
|
}
|
|
|
|
function _fun96541(a0) { // fn#96541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:1650, offset: 0x0216052f, size: 203 bytes, params: 2, frame: 16
|
|
const closure = NowPlayingStore;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(PresenceStore, UserAffinitiesV2Store, UserStore);
|
|
this.syncWith([UserAffinitiesV2Store], handleUserAffinitiesV2StoreUpdate);
|
|
}}, {key: 'games', get: get_96544}, {key: 'usersPlaying', get: get_96545}, {key: 'gameIds', get: get_96546},
|
|
{key: 'getNowPlaying', value: value_96547}, {key: 'getUserGame', value: value_96548}]);
|
|
}
|
|
|
|
function CONNECTION_OPEN_SUPPLEMENTAL_96550({guilds, presences}) { // fn#96550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:2445, offset: 0x02160654, size: 69 bytes, params: 2, frame: 13
|
|
let env0_0 = false;
|
|
guilds.forEach(_fun96551);
|
|
env0_0 = handleMultipleUpdates(presences) || env0_0;
|
|
return env0_0;
|
|
}
|
|
|
|
function PRESENCE_UPDATES_96553({updates}) { // fn#96553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:2683, offset: 0x021606be, size: 48 bytes, params: 2, frame: 12
|
|
return updates.map(function(a0) {
|
|
return _handlePresenceUpdate(a0);
|
|
}).some(function(a0) {
|
|
return a0;
|
|
});
|
|
}
|
|
|
|
function _fun96532(a0) { // fn#96532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:475, offset: 0x021601eb, size: 42 bytes, params: 2, frame: 11
|
|
let value = environment.__proto__;
|
|
value = _handlePresenceUpdate(a0);
|
|
value = value !== false;
|
|
const r2 = value || env0_0;
|
|
}
|
|
|
|
function _fun96536(a0) { // fn#96536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:902, offset: 0x02160329, size: 38 bytes, params: 2, frame: 14
|
|
if (_handleActivityUpdate(a0, user)) {
|
|
}
|
|
}
|
|
|
|
function refreshStateFromPresence() { // fn#96539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:1427, owner: handleUserAffinitiesV2StoreUpdate.refreshStateFromPresence, offset: 0x0216049e, size: 60 bytes, params: 1, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
env1_12 = {};
|
|
env1_13 = {};
|
|
const env0_0 = false;
|
|
PresenceStore.getUserIds().forEach(_fun96540);
|
|
return env0_0;
|
|
}
|
|
|
|
function get_96546() { // fn#96546, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:2145, offset: 0x02160639, size: 27 bytes, params: 1, frame: 11
|
|
const Object = global.Object;
|
|
return Object.keys(env1_12);
|
|
}
|
|
|
|
function _fun96551({presences}) { // fn#96551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:2538, offset: 0x02160699, size: 37 bytes, params: 2, frame: 11
|
|
if (handleMultipleUpdates(presences)) {
|
|
}
|
|
}
|
|
|
|
function _handleActivityUpdate(a0, a1) { // fn#96537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:907, offset: 0x0216034f, size: 268 bytes, params: 3, frame: 18
|
|
const value2 = undefined;
|
|
const value3 = (importDefault(12595) /* metro dependency 12595: getApplicationIdForActivity */)(a0);
|
|
if (value3 == null) {
|
|
return removeUserIfNeeded(a1.id);
|
|
}
|
|
const property = env2_13[a1.id];
|
|
let r3 = property != null && property.gameId !== value3;
|
|
if (r3) {
|
|
removeUserIfNeeded(a1.id);
|
|
}
|
|
const timestamps = a0.timestamps;
|
|
const value6 = timestamps == null;
|
|
r3 = (value6 ? value2 : timestamps.start) ?? global.Date.now();
|
|
const object5 = {};
|
|
object5.userId = a1.id;
|
|
object5.activity = a0;
|
|
object5.startedPlaying = r3;
|
|
const object6 = {};
|
|
copyDataProperties(object6, env2_12, value6);
|
|
const object7 = {};
|
|
copyDataProperties(object7, env2_12[value3], value6);
|
|
let userId = object5.userId;
|
|
object7[userId] = object5;
|
|
object6[value3] = object7;
|
|
const object8 = {};
|
|
copyDataProperties(object8, env2_13, value6);
|
|
userId = object5.userId;
|
|
object8[userId] = {gameId: value3, startedPlaying: object5.startedPlaying};
|
|
return true;
|
|
}
|
|
|
|
function _fun96540(a0) { // fn#96540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12784:1513, offset: 0x021604da, size: 85 bytes, params: 2, frame: 13
|
|
var r1;
|
|
var _handlePresenceUpdateBinding;
|
|
var object2;
|
|
const value = environment.__proto__.__proto__;
|
|
const user = UserStore.getUser(a0);
|
|
if (user != null) {
|
|
_handlePresenceUpdateBinding = _handlePresenceUpdate;
|
|
object2 = {user: user};
|
|
object2.activities = PresenceStore.getActivities(a0);
|
|
r1 = _handlePresenceUpdateBinding(object2) || env0_0;
|
|
}
|
|
}
|
|
|