This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,143 @@
// Metro module 9057 (f9058).
import { Endpoints, RelationshipTypes } from "../../Constants";
import { APIError } from "../../errors/index";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import { HTTP } from "../../_bundle/sendRequest";
import { AccessibilityAnnouncer } from "../../design/shared";
function $mk115400($env) {
return () => {
AccessibilityAnnouncer.announce(intl.string(t.zRf8cO));
};
}
function $mk115401($env) {
return () => {
AccessibilityAnnouncer.announce(intl.string(t.XMf21q));
};
}
let deleteGameRelationship;
let env5926 = {};
const showRequestFailedAlert = function showRequestFailedAlert(a0) {
let body = new APIError(a0).getAnyErrorMessage();
const r28 = {
title: intl.string(t["328j/I"]),
body: null
};
if (body == null) {
body = intl.string(t.fEptJP);
}
r28.body = body;
AlertActionCreators.show(r28);
};
deleteGameRelationship = async function deleteGameRelationship(c26354_0) {
let c26354_3;
let c26354_4 = 0;
let c30020_0, c30020_1, c30020_2;
L12: {
try {
c30020_0 = void 0;
c30020_1 = void 0;
c30020_2 = void 0;
c30020_0 = c26354_0.userId;
c30020_1 = c26354_0.applicationId;
c30020_2 = c26354_0.onSuccess;
await void 0;
c26354_4 = 1;
await HTTP.del({
url: Endpoints.USER_GAME_RELATIONSHIP(c30020_0, c30020_1),
oldFormErrors: true,
rejectWithError: false
});
(0, c30020_2)();
c26354_4 = 0;
} catch ($e) {
const r29 = $e;
let r8 = r29;
c26354_3 = r29;
if (c26354_4 !== 0) {
while (true) {
try {
const r85 = c26354_3;
c26354_4 = 0;
(0, showRequestFailedAlert)(r85);
break L12;
} catch (r82) {
r8 = r82;
c26354_3 = r82;
if (c26354_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
};
const r24 = {
removeGameFriend: async function removeGameFriend(c26355_0) {
let env30021;
const r24 = env5926;
let c26355_2 = r24;
const r10 = env30021 = {
$parent: r24
};
let c26355_1 = r10;
env30021[0] = void 0;
env30021[1] = void 0;
env30021[0] = c26355_0.userId;
env30021[1] = c26355_0.applicationId;
await void 0;
await deleteGameRelationship({
userId: env30021[0],
applicationId: env30021[1],
onSuccess: $mk115400(env5926)
});
},
acceptGameFriendRequest: function acceptGameFriendRequest({ userId, applicationId }) {
const FRIEND = RelationshipTypes.FRIEND;
const onSuccess2 = () => {};
return HTTP.put({
url: Endpoints.USER_GAME_RELATIONSHIP(userId, applicationId),
body: {
type: FRIEND
},
oldFormErrors: true,
rejectWithError: false
}).then(() => {
AccessibilityAnnouncer.announce(intl.string(t.taJiuc));
}).catch((error) => {
let body = new APIError(error).getAnyErrorMessage();
const r29 = {
title: intl.string(t["328j/I"]),
body: null
};
if (body == null) {
body = intl.string(t.fEptJP);
}
r29.body = body;
AlertActionCreators.show(r29);
return Promise.reject(error);
});
},
cancelGameFriendRequest: async function cancelGameFriendRequest(c26356_0) {
let env30022;
const r24 = env5926;
let c26356_2 = r24;
const r10 = env30022 = {
$parent: r24
};
let c26356_1 = r10;
env30022[0] = void 0;
env30022[1] = void 0;
env30022[0] = c26356_0.userId;
env30022[1] = c26356_0.applicationId;
await void 0;
await deleteGameRelationship({
userId: env30022[0],
applicationId: env30022[1],
onSuccess: $mk115401(env5926)
});
}
};
export default r24;
@@ -0,0 +1,30 @@
// Metro module 13599 (f13600).
import GameRelationshipStore from "./GameRelationshipStore";
import { RelationshipTypes } from "../../Constants";
import LifecycleManager from "../../lib/LifecycleManager";
import Dispatcher from "../../Dispatcher";
import ApplicationActionCreators from "../applications/ApplicationActionCreators";
class GameRelationshipManager extends LifecycleManager {
handlePostConnectionOpen = () => {
const gameRelationships = GameRelationshipStore.getGameRelationships();
const set = new Set();
let c27526_0 = set;
gameRelationships.values().forEach((item) => {
if (item.type === RelationshipTypes.PENDING_INCOMING) {
c27526_0.add(item.applicationId);
}
});
ApplicationActionCreators.fetchApplications(Array.from(set));
};
_initialize() {
Dispatcher.subscribe("POST_CONNECTION_OPEN", this.handlePostConnectionOpen);
}
_terminate() {
Dispatcher.unsubscribe("POST_CONNECTION_OPEN", this.handlePostConnectionOpen);
}
destroy() {
Dispatcher.unsubscribe("POST_CONNECTION_OPEN", this.handlePostConnectionOpen);
}
}
const gameRelationshipManager = new GameRelationshipManager();
export default gameRelationshipManager;
@@ -0,0 +1,171 @@
// Metro module 5944 (f5945).
import RelationshipStore from "../../stores/RelationshipStore";
import { RelationshipTypes } from "../../Constants";
import { SecondaryIndexMap } from "../../_bundle/Module3813";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
function $mk77503($env) {
return (a0) => {
L9: {
const r3 = $env;
const { type, id } = a0;
const r9 = $env.$parent;
const r5 = r9[1];
if (type === r5.FRIEND) {
r3[2] = r3[2] + 1;
} else if (type === r5.PENDING_OUTGOING) {
r3[1] = r3[1] + 1;
} else if (type === r5.PENDING_INCOMING) {
const r12 = r9[0];
if (!r12.isSpam(id) && !r12.isIgnored(id)) {
r3[0] = r3[0] + 1;
break L9;
}
return void 0;
}
}
};
}
let remove, GAME_RELATIONSHIP_KEY, GameRelationshipIndexes_BY_APPLICATION_ID, GameRelationshipIndexes_BY_USER_ID, GameRelationshipIndexes_BY_RELATIONSHIP_TYPE, c3738_6, c3738_12;
let env3738 = {};
const recountRelationshipTypes = function recountRelationshipTypes() {
let env15313;
const r3 = env15313 = {
$parent: env3738
};
env15313[0] = 0;
env15313[1] = 0;
env15313[2] = 0;
c3738_6.values().forEach($mk77503(r3));
env3738[7] = env15313[0];
env3738[8] = env15313[1];
env3738[9] = env15313[2];
};
remove = function remove(a0, a1) {
c3738_6.delete(`${a1}-${a0}`);
};
GAME_RELATIONSHIP_KEY = (a0, a1) => {};
GameRelationshipIndexes_BY_APPLICATION_ID = (a0) => `application-id-${a0}`;
GameRelationshipIndexes_BY_USER_ID = (a0) => {};
GameRelationshipIndexes_BY_RELATIONSHIP_TYPE = (a0) => {};
c3738_6 = new SecondaryIndexMap(function gameRelationshipsIndex(a0) {
const r0 = [];
r0.push(`application-id-${a0.applicationId}`);
r0.push(`user-id-${a0.id}`);
r0.push(`relationship-type-${a0.type}`);
return r0;
}, (a0) => `${a0.since}`);
env3738[7] = 0;
env3738[8] = 0;
env3738[9] = 0;
class GameRelationshipStore extends Module589.Store {
static displayName = "GameRelationshipStore";
constructor() {
super(...arguments);
}
initialize() {
this.waitFor(RelationshipStore);
}
getPendingIncomingCount() {
return env3738[7];
}
getPendingOutgoingCount() {
return env3738[8];
}
getGameFriendCount() {
return env3738[9];
}
getGameFriendsForApplication(a0) {
return c3738_6.values(`application-id-${a0}`, true).filter((item) => item.type === RelationshipTypes.FRIEND);
}
getGameRelationshipsForUser(a0) {
return c3738_6.values(`user-id-${a0}`, true);
}
getGameRelationshipsForUserByType(a0, c15314_0) {
return this.getGameRelationshipsForUser(a0).filter((item) => item.type === c15314_0);
}
getGameFriendsForUser(a0) {
return this.getGameRelationshipsForUserByType(a0, RelationshipTypes.FRIEND);
}
getGameRelationshipCount() {
return c3738_6.size();
}
getGameRelationships() {
return c3738_6;
}
getGameRelationshipsByType(a0) {
return c3738_6.values(`relationship-type-${a0}`, true);
}
getGameRelationshipsVersion() {
return c3738_6.version;
}
}
c3738_12 = GameRelationshipStore;
const r74 = new GameRelationshipStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen(a0) {
let env15315;
c3738_6.clear();
a0.gameRelationships.forEach((gameRelationship) => {
const r4 = {
id: gameRelationship.id,
applicationId: gameRelationship.application_id,
type: gameRelationship.type,
since: gameRelationship.since,
dmAccessType: gameRelationship.dm_access_type
};
c3738_6.set(`${r4.applicationId}-${r4.id}`, r4);
});
const r11 = env15315 = {
$parent: env3738
};
env15315[0] = 0;
env15315[1] = 0;
env15315[2] = 0;
c3738_6.values().forEach($mk77503(r11));
env3738[7] = env15315[0];
env3738[8] = env15315[1];
env3738[9] = env15315[2];
},
GAME_RELATIONSHIP_ADD: function handleGameRelationshipAdd({ gameRelationship }) {
const { id, applicationId } = gameRelationship;
let env15316;
c3738_6.set(`${applicationId}-${id}`, gameRelationship);
const r21 = env15316 = {
$parent: env3738
};
env15316[0] = 0;
env15316[1] = 0;
env15316[2] = 0;
c3738_6.values().forEach($mk77503(r21));
env3738[7] = env15316[0];
env3738[8] = env15316[1];
env3738[9] = env15316[2];
},
GAME_RELATIONSHIP_REMOVE: function handleGameRelationshipRemove({ userId, applicationId }) {
let env15317;
c3738_6.delete(`${applicationId}-${userId}`);
const r20 = env15317 = {
$parent: env3738
};
env15317[0] = 0;
env15317[1] = 0;
env15317[2] = 0;
c3738_6.values().forEach($mk77503(r20));
env3738[7] = env15317[0];
env3738[8] = env15317[1];
env3738[9] = env15317[2];
},
APPLICATIONS_FETCH_SUCCESS: function handleApplicationsFetchSuccess({ unknownApplicationIds }) {
if (unknownApplicationIds != null) {
for (const item of unknownApplicationIds) {
for (const item2 of c3738_6.values(GameRelationshipIndexes_BY_APPLICATION_ID(item))) {
if (!(item2.type !== RelationshipTypes.PENDING_INCOMING && item2.type !== RelationshipTypes.PENDING_OUTGOING)) {
remove(item2.id, item);
}
}
}
recountRelationshipTypes();
}
}
});
export default r74;
@@ -0,0 +1,43 @@
// Metro module 12056 (f12057).
import _slicedToArray from "../../_bundle/_slicedToArray";
import GameRelationshipStore from "./GameRelationshipStore";
import { RelationshipTypes } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
import { isVersionEqual } from "../../utils/SecondaryIndexMapUtils";
function $mk88726($env) {
return () => {
const r0 = $env;
const r2 = $env.$parent[3];
return [r2.getGameRelationshipsForUserByType(r0[0], r0[1]), r2.getGameRelationshipsVersion()];
};
}
let env8292 = {};
export function useGameRelationshipsByType(a0) {
return _slicedToArray(useStateFromStores([GameRelationshipStore], () => [GameRelationshipStore.getGameRelationshipsByType(a0), GameRelationshipStore.getGameRelationshipsVersion()], [a0], isVersionEqual), 1)[0];
}
export function useGameFriendsForUser(a0) {
let env19370;
const FRIEND = RelationshipTypes.FRIEND;
const r17 = env19370 = {
$parent: env8292
};
env19370[0] = a0;
env19370[1] = FRIEND;
return _slicedToArray(useStateFromStores([GameRelationshipStore], $mk88726(r17), [FRIEND, a0], isVersionEqual), 1)[0];
}
export function useIncomingGameRelationshipsForUser(a0) {
let env19371;
const PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
const r17 = env19371 = {
$parent: env8292
};
env19371[0] = a0;
env19371[1] = PENDING_INCOMING;
return _slicedToArray(useStateFromStores([GameRelationshipStore], $mk88726(r17), [PENDING_INCOMING, a0], isVersionEqual), 1)[0];
}
export function useHasGameRelationshipsForUser(a0) {
return _slicedToArray(useStateFromStores([GameRelationshipStore], () => [GameRelationshipStore.getGameRelationshipsForUser(a0).length > 0, GameRelationshipStore.getGameRelationshipsVersion()], [a0], isVersionEqual), 1)[0];
}
export function useHasGameRelationshipsForUserByType(a0, a1) {
return _slicedToArray(useStateFromStores([GameRelationshipStore], () => [GameRelationshipStore.getGameRelationshipsForUserByType(a0, a1).length > 0, GameRelationshipStore.getGameRelationshipsVersion()], [a1, a0], isVersionEqual), 1)[0];
}
@@ -0,0 +1,9 @@
// Metro module 12174 (f12175).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import GameRelationshipStore from "../GameRelationshipStore";
import { RelationshipTypes } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { isVersionEqual } from "../../../utils/SecondaryIndexMapUtils";
export function useIsGameFriends(a0) {
return _slicedToArray(useStateFromStores([GameRelationshipStore], () => [GameRelationshipStore.getGameRelationshipsForUserByType(a0, RelationshipTypes.FRIEND).length > 0, GameRelationshipStore.getGameRelationshipsVersion()], [a0], isVersionEqual), 1)[0];
}
@@ -0,0 +1,14 @@
// Metro module 12175 (f12176).
import { useMemo } from "react";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserStore from "../../../stores/UserStore";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useGameFriendsForUser } from "../GameRelationshipStoreHooks";
let c8405_5 = [];
export function useUserProfileGameFriendApplicationIds({ userId }) {
let gameFriendsForUser;
gameFriendsForUser = void 0;
const stateFromStores = useStateFromStores([RelationshipStore, UserStore], () => RelationshipStore.isFriend(userId) || UserStore.getUser(userId)?.isProvisional);
gameFriendsForUser = useGameFriendsForUser(userId);
return useMemo(() => stateFromStores ? c8405_5 : gameFriendsForUser.map((item) => item.applicationId), [gameFriendsForUser, stateFromStores]);
}
@@ -0,0 +1,6 @@
// Metro module 14678 (f14679).
import GameRelationshipStore from "../GameRelationshipStore";
import { useStateFromStores } from "../../../_bundle/Module589";
export function useIsAllowGameFriendDMsSettingVisible() {
return useStateFromStores([GameRelationshipStore], () => GameRelationshipStore.getGameRelationshipCount() > 0);
}