Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
284 lines
9.3 KiB
TypeScript
284 lines
9.3 KiB
TypeScript
// Module ID: 5365
|
|
// Function ID: 5366
|
|
// Name: SelfPresenceStore
|
|
// Dependencies: [5366, 1220, 1932, 5496, 7507, 11603, 4678, 4656, 1074, 7509, 1936, 1385, 11037, 1331, 12, 504, 573, 2]
|
|
|
|
// Module 5365 (SelfPresenceStore)
|
|
import _modDef12 from "module_12" /* 12 */;
|
|
import initializeDefault from "initialize" /* 504 */;
|
|
import DispatcherDefault from "Dispatcher" /* 573 */;
|
|
import _modDef1331 from "module_1331" /* 1331 */;
|
|
import FlagUtils from "FlagUtils" /* 1385 */;
|
|
import UserSettings from "UserSettings" /* 1936 */;
|
|
import isListeningOnSpotifyDefault from "isListeningOnSpotify" /* 11037 */;
|
|
import SpotifyStore from "SpotifyStore" /* 5366 */;
|
|
import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1220 */;
|
|
import DetectableGameStore from "DetectableGameStore" /* 1932 */;
|
|
import IdleStore from "IdleStore" /* 5496 */;
|
|
import LibraryApplicationStore from "LibraryApplicationStore" /* 7507 */;
|
|
import LocalActivityStore from "LocalActivityStore" /* 11603 */;
|
|
import PresenceStore from "PresenceStore" /* 4678 */;
|
|
import SessionsStore from "SessionsStore" /* 4656 */;
|
|
|
|
require = fn;
|
|
function filterPlayingActivities(arg0) {
|
|
if (0 === arg0.length) {
|
|
return arg0;
|
|
} else {
|
|
const items = [];
|
|
const items1 = [];
|
|
const iter = arg0[Symbol.iterator]();
|
|
const nextResult = iter.next();
|
|
while (iter !== undefined) {
|
|
let tmp4 = nextResult;
|
|
if (nextResult.type === constants2.PLAYING) {
|
|
let arr = items1.push(tmp4);
|
|
} else {
|
|
let arr2 = items.push(tmp4);
|
|
}
|
|
continue;
|
|
}
|
|
if (0 === items1.length) {
|
|
return arg0;
|
|
} else if (1 === items1.length) {
|
|
return arg0;
|
|
} else {
|
|
const items2 = [];
|
|
HermesBuiltin.arraySpread(items1, 0);
|
|
const items3 = [];
|
|
items3[HermesBuiltin.arraySpread(items, 0)] = items2.sort(sortActivity)[0];
|
|
return items3.sort(sortActivity);
|
|
}
|
|
}
|
|
}
|
|
function shouldShowActivity(flags) {
|
|
num = flags.flags;
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
if (obj.hasFlag(num, constants.CONTEXTLESS)) {
|
|
return true;
|
|
} else {
|
|
const type = flags.type;
|
|
if (constants2.LISTENING === type) {
|
|
if (isListeningOnSpotifyDefault(flags)) {
|
|
let shouldShowActivityResult = SpotifyStore.shouldShowActivity();
|
|
} else {
|
|
shouldShowActivityResult = null != flags.application_id;
|
|
if (shouldShowActivityResult) {
|
|
shouldShowActivityResult = tmp(7509).shouldShareApplicationActivity(flags.application_id, LibraryApplicationStore);
|
|
const tmpResult = tmp(7509);
|
|
}
|
|
}
|
|
return shouldShowActivityResult;
|
|
} else if (tmp3.PLAYING === type) {
|
|
if (null != flags.application_id) {
|
|
let result = tmp(7509).shouldShareApplicationActivity(flags.application_id, LibraryApplicationStore);
|
|
const tmpResult4 = tmp(7509);
|
|
} else {
|
|
const searchGamesByNameResult = DetectableGameStore.searchGamesByName(flags.name);
|
|
if (1 === searchGamesByNameResult.length) {
|
|
result = tmp(7509).shouldShareApplicationActivity(searchGamesByNameResult[0], LibraryApplicationStore);
|
|
const tmpResult5 = tmp(7509);
|
|
} else {
|
|
const ShowCurrentGame = tmp(1936).ShowCurrentGame;
|
|
result = ShowCurrentGame.getSetting();
|
|
}
|
|
}
|
|
return result;
|
|
} else {
|
|
if (tmp3.STREAMING !== type) {
|
|
const WATCHING = tmp3.WATCHING;
|
|
}
|
|
let result1 = null == flags.application_id;
|
|
if (!result1) {
|
|
result1 = tmp(7509).shouldShareApplicationActivity(flags.application_id, LibraryApplicationStore);
|
|
const tmpResult6 = tmp(7509);
|
|
}
|
|
return result1;
|
|
}
|
|
}
|
|
obj = FlagUtils;
|
|
}
|
|
function handleUpdate() {
|
|
num = IdleStore.getIdleSince();
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
closure_22 = IdleStore.isAFK();
|
|
if (c23) {
|
|
IDLE = closure_18;
|
|
let ONLINE = closure_18;
|
|
} else if (c16) {
|
|
const INVISIBLE = StatusTypes.INVISIBLE;
|
|
IDLE = INVISIBLE;
|
|
ONLINE = INVISIBLE;
|
|
} else {
|
|
const StatusSetting = UserSettings.StatusSetting;
|
|
ONLINE = StatusSetting.getSetting();
|
|
if (ONLINE === StatusTypes.UNKNOWN) {
|
|
ONLINE = StatusTypes.ONLINE;
|
|
}
|
|
IDLE = ONLINE;
|
|
}
|
|
let tmp7 = ONLINE === StatusTypes.ONLINE;
|
|
if (tmp7) {
|
|
tmp7 = num > 0;
|
|
}
|
|
if (tmp7) {
|
|
IDLE = tmp6.IDLE;
|
|
}
|
|
if (!c23) {
|
|
if (IDLE !== tmp6.INVISIBLE) {
|
|
activities = LocalActivityStore.getActivities();
|
|
found = activities.filter(shouldShowActivity);
|
|
}
|
|
let flag = false;
|
|
if (!_modDef1331(found, found)) {
|
|
closure_21 = filterPlayingActivities(found);
|
|
flag = true;
|
|
}
|
|
remoteActivities = SessionsStore.getRemoteActivities();
|
|
if (remoteActivities !== remoteActivities) {
|
|
flag = true;
|
|
}
|
|
hiddenActivities = SessionsStore.getHiddenActivities();
|
|
if (flag) {
|
|
const items = [];
|
|
const tmp12Result = _modDef12;
|
|
HermesBuiltin.arraySpread(remoteActivities.filter((type) => type.type !== constants.CUSTOM_STATUS), HermesBuiltin.arraySpread(found, 0));
|
|
const arraySpreadResult = HermesBuiltin.arraySpread(found, 0);
|
|
const tmp12ResultResult = tmp12Result(items.sort(sortActivity));
|
|
valueResult = tmp12Result(items.sort(sortActivity)).uniqBy((type) => "" + type.type + ":" + type.application_id + ":" + type.name).value();
|
|
closure_27 = filterPlayingActivities(valueResult);
|
|
const iter = tmp12Result(items.sort(sortActivity)).uniqBy((type) => "" + type.type + ":" + type.application_id + ":" + type.name);
|
|
}
|
|
}
|
|
found = [];
|
|
}
|
|
function handleConnectionOpen() {
|
|
c23 = false;
|
|
const UNKNOWN = StatusTypes.UNKNOWN;
|
|
handleUpdate();
|
|
const result = PresenceStore.setCurrentUserOnConnectionOpen(IDLE, valueResult);
|
|
}
|
|
const sortActivity = fn(4678).sortActivity;
|
|
const Constants = fn(1074);
|
|
const StatusTypes = Constants.StatusTypes;
|
|
({ ActivityFlags: map1, ActivityTypes: closure_14, AppStates: closure_15 } = Constants);
|
|
let c16 = false;
|
|
({ ONLINE: IDLE, UNKNOWN: closure_18 } = StatusTypes);
|
|
let found = [];
|
|
let activities = [];
|
|
const afk = false;
|
|
let c23 = true;
|
|
let remoteActivities = Object.freeze([]);
|
|
let hiddenActivities = Object.freeze([]);
|
|
let closure_27 = [];
|
|
const Store = initializeDefault.Store;
|
|
class SelfPresenceStore extends Store {
|
|
}
|
|
const prototype = SelfPresenceStore.prototype;
|
|
prototype["initialize"] = function initialize() {
|
|
this.waitFor(DetectableGameStore, IdleStore, LibraryApplicationStore, LocalActivityStore, PresenceStore, SessionsStore, SpotifyStore, UserSettingsProtoStore);
|
|
const items = [LocalActivityStore];
|
|
this.syncWith(items, handleUpdate);
|
|
};
|
|
prototype["getLocalPresence"] = function getLocalPresence() {
|
|
return { status: IDLE, since: num, activities, afk };
|
|
};
|
|
prototype["getStatus"] = function getStatus() {
|
|
return IDLE;
|
|
};
|
|
prototype["getActivities"] = function getActivities() {
|
|
let flag = arg0;
|
|
if (arg0 === undefined) {
|
|
flag = true;
|
|
}
|
|
return flag ? closure_27 : closure_21;
|
|
};
|
|
prototype["getUnfilteredActivities"] = function getUnfilteredActivities() {
|
|
let flag = arg0;
|
|
if (arg0 === undefined) {
|
|
flag = true;
|
|
}
|
|
return flag ? valueResult : found;
|
|
};
|
|
prototype["getHiddenActivities"] = function getHiddenActivities() {
|
|
return hiddenActivities;
|
|
};
|
|
prototype["getPrimaryActivity"] = function getPrimaryActivity() {
|
|
let flag = arg0;
|
|
if (arg0 === undefined) {
|
|
flag = true;
|
|
}
|
|
return this.getActivities(flag)[0];
|
|
};
|
|
prototype["getApplicationActivity"] = function getApplicationActivity(arg0) {
|
|
closure_0 = arg0;
|
|
let flag = arg1;
|
|
if (arg1 === undefined) {
|
|
flag = true;
|
|
}
|
|
return this.findActivity((application_id) => application_id.application_id === closure_0, flag);
|
|
};
|
|
prototype["findActivity"] = function findActivity(_messages) {
|
|
let flag = arg1;
|
|
if (arg1 === undefined) {
|
|
flag = true;
|
|
}
|
|
activities = this.getActivities(flag);
|
|
return activities.find(_messages);
|
|
};
|
|
SelfPresenceStore.displayName = "SelfPresenceStore";
|
|
const selfPresenceStore = new SelfPresenceStore(DispatcherDefault, {
|
|
START_SESSION: handleUpdate,
|
|
CONNECTION_OPEN: function handleConnectionOpenTracked() {
|
|
c23 = false;
|
|
const UNKNOWN = StatusTypes.UNKNOWN;
|
|
handleUpdate();
|
|
const result = PresenceStore.setCurrentUserOnConnectionOpen(IDLE, valueResult);
|
|
},
|
|
CONNECTION_OPEN_SUPPLEMENTAL: handleConnectionOpen,
|
|
OVERLAY_INITIALIZE: handleConnectionOpen,
|
|
CONNECTION_CLOSED: handleUpdate,
|
|
IDLE: handleUpdate,
|
|
AFK: handleUpdate,
|
|
RUNNING_GAMES_CHANGE: handleUpdate,
|
|
STREAMING_UPDATE: handleUpdate,
|
|
USER_SETTINGS_PROTO_UPDATE: handleUpdate,
|
|
LOCAL_ACTIVITY_UPDATE: handleUpdate,
|
|
SPOTIFY_PLAYER_STATE: handleUpdate,
|
|
SPOTIFY_PLAYER_PLAY: handleUpdate,
|
|
USER_CONNECTIONS_UPDATE: handleUpdate,
|
|
SESSIONS_REPLACE: handleUpdate,
|
|
RPC_APP_DISCONNECTED: handleUpdate,
|
|
LIBRARY_FETCH_SUCCESS: handleUpdate,
|
|
LIBRARY_APPLICATION_FLAGS_UPDATE_SUCCESS: handleUpdate,
|
|
LOGOUT: function handleLogout() {
|
|
c23 = true;
|
|
closure_18 = IDLE;
|
|
handleUpdate();
|
|
},
|
|
FORCE_INVISIBLE: function handleForceInvisible(invisible) {
|
|
invisible = invisible.invisible;
|
|
handleUpdate();
|
|
},
|
|
WINDOW_FOCUS: function handleWindowFocus() {
|
|
c16 = false;
|
|
handleUpdate();
|
|
},
|
|
APP_STATE_UPDATE: function handleAppStateUpdate(state) {
|
|
if (state.state === constants3.ACTIVE) {
|
|
if (c16) {
|
|
c16 = false;
|
|
handleUpdate();
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("stores/SelfPresenceStore.tsx");
|
|
|
|
export default selfPresenceStore;
|