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,23 @@
// Metro module 15945 (f15946).
import { create } from "../../_bundle/Module644";
import { batchUpdates } from "../../_bundle/Module705";
let c11424_2 = Object.freeze({
voiceUpsellDismissed: false,
showSparkles: false
});
let c11424_3 = create(() => c11424_2);
export { c11424_3 as useConsoleVoiceUpsellStore };
export function setShowConsoleVoiceSparkles(showSparkles) {
batchUpdates(() => {
c11424_3.setState({
showSparkles
});
});
}
export function setVoiceUpsellDismissed(voiceUpsellDismissed) {
batchUpdates(() => {
c11424_3.setState({
voiceUpsellDismissed
});
});
}
@@ -0,0 +1,401 @@
// Metro module 9039 (f9040).
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SessionsStore from "../../stores/SessionsStore";
import GameConsoleStore from "./GameConsoleStore";
import { PlatformTypes, Endpoints, AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import Dispatcher from "../../Dispatcher";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import { coerceAudioContextForProto } from "../user_settings/voice/AudioSettingsUtils";
import { ConsoleHandoffType } from "../../_bundle/Module9040";
import { HTTP } from "../../_bundle/sendRequest";
import SentryUtils_native from "../../utils/SentryUtils.native";
import { ConsoleCommands } from "../../_bundle/Module9041";
import GameConsoleAlertUtils from "./GameConsoleAlertUtils";
import trackVoiceCallTransfer from "./trackVoiceCallTransfer";
function $mk115397($env) {
return function sendConnectVoiceCommand() {
return $env[16].apply(this, arguments);
};
}
let getConnectNonce, cancelConnectRequest, cancelCommand;
let env5914 = {};
export async function disconnectRemote() {
let c26343_3 = 0;
L30: {
try {
const awaitingRemoteSessionInfo = GameConsoleStore.getAwaitingRemoteSessionInfo();
const nonce2 = awaitingRemoteSessionInfo?.nonce;
Dispatcher.dispatch({
type: "REMOTE_SESSION_DISCONNECT"
});
const r45 = awaitingRemoteSessionInfo?.type !== PlatformTypes.PLAYSTATION && awaitingRemoteSessionInfo?.type !== PlatformTypes.PLAYSTATION_STAGING || awaitingRemoteSessionInfo?.commandId == null || awaitingRemoteSessionInfo?.deviceId == null;
const r50 = [];
if (!r45) {
r50.push(cancelCommand(awaitingRemoteSessionInfo.type, awaitingRemoteSessionInfo.deviceId, awaitingRemoteSessionInfo.commandId));
}
if (nonce2 != null) {
r50.push(cancelConnectRequest(nonce2));
}
c26343_3 = 1;
await Promise.all(r50);
c26343_3 = 0;
} catch ($e) {
let r8 = $e;
if (c26343_3 !== 0) {
while (true) {
try {
c26343_3 = 0;
AlertActionCreators.show({
title: intl.string(t.LNhXcL),
body: intl.string(t.QnKxtP)
});
break L30;
} catch ($e) {
r8 = $e;
if (c26343_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
getConnectNonce = async function getConnectNonce() {
let r70;
let c26344_2;
let c26344_3 = 0;
let c30012_0, c30012_1;
L13: {
try {
c30012_0 = void 0;
c26344_3 = 1;
c30012_0 = (await HTTP.post({
url: Endpoints.CONNECT_REQUEST_CREATE,
body: {
analytics_properties: {
handoff_type: RTCConnectionStore.getRTCConnectionId() != null ? ConsoleHandoffType.TRANSFER_EXISTING_CALL : ConsoleHandoffType.CREATE_NEW_CALL
}
},
rejectWithError: false
})).body.nonce;
c26344_3 = 0;
r70 = c30012_0;
} catch ($e) {
const r26 = $e;
let r8 = r26;
c26344_2 = r26;
if (c26344_3 !== 0) {
while (true) {
try {
const r79 = c26344_2;
c26344_3 = 0;
c30012_1 = r79;
SentryUtils_native.captureException(c30012_1);
r70 = c30012_0;
break L13;
} catch (r75) {
r8 = r75;
c26344_2 = r75;
if (c26344_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
return r70;
};
cancelConnectRequest = function cancelConnectRequest(a0) {
return HTTP.del({
url: Endpoints.CONNECT_REQUEST(a0),
rejectWithError: false
});
};
env5914[16] = function _sendConnectVoiceCommand() {
const r8 = async (platform3, c26346_1, c26346_2, nonce) => {
let r86;
let c26346_6;
let c26346_7 = 0;
let c30014_0, c30014_1, c30014_2, c30014_3, c30014_4, c30014_5, c30014_6;
try {
c30014_0 = platform3;
c30014_1 = c26346_1;
c30014_2 = c26346_2;
c30014_3 = nonce;
c30014_4 = void 0;
c30014_5 = void 0;
Dispatcher.dispatch({
type: "GAME_CONSOLE_DEVICE_SEND_COMMAND_START",
platform: platform3
});
c26346_7 = 1;
c30014_4 = await HTTP.post({
url: Endpoints.CONSOLES_DEVICES_COMMANDS(platform3, c26346_1),
body: {
command: ConsoleCommands.CONNECT_VOICE,
channel_id: c26346_2.id,
guild_id: c26346_2.guild_id,
nonce
},
rejectWithError: false
});
c26346_7 = 0;
c30014_5 = c30014_4.body.id;
Dispatcher.dispatch({
type: "WAIT_FOR_REMOTE_SESSION",
sessionType: c30014_0,
nonce: c30014_3,
channelId: c30014_2.id,
deviceId: c30014_1,
commandId: c30014_5
});
r86 = c30014_5;
} catch ($e) {
const r29 = $e;
let r7 = r29;
c26346_6 = r29;
if (c26346_7 !== 0) {
while (true) {
try {
const r95 = c26346_6;
c26346_7 = 0;
c30014_6 = r95;
Dispatcher.dispatch({
type: "GAME_CONSOLE_DEVICE_SEND_COMMAND_FAIL",
platform: c30014_0,
error: c30014_6
});
throw c30014_6;
} catch (r91) {
r7 = r91;
c26346_6 = r91;
if (c26346_7 === 0) {
break;
}
}
}
}
throw r7;
}
return r86;
};
env5914[16] = r8;
return r8.apply(this, arguments);
};
cancelCommand = async function cancelCommand(platform4, deviceId, commandId) {
let c26347_5;
let c26347_6 = 0;
let c30015_0, c30015_1, c30015_2, c30015_3;
try {
c30015_0 = platform4;
c30015_1 = deviceId;
c30015_2 = commandId;
Dispatcher.dispatch({
type: "GAME_CONSOLE_DEVICE_CANCEL_COMMAND_START",
platform: platform4,
deviceId,
commandId
});
c26347_6 = 1;
await HTTP.del({
url: Endpoints.CONSOLES_DEVICES_COMMAND(platform4, deviceId, commandId),
rejectWithError: false
});
c26347_6 = 0;
Dispatcher.dispatch({
type: "GAME_CONSOLE_DEVICE_CANCEL_COMMAND_SUCCESS",
platform: c30015_0,
deviceId: c30015_1,
commandId: c30015_2
});
} catch ($e) {
const r29 = $e;
let r8 = r29;
c26347_5 = r29;
if (c26347_6 !== 0) {
while (true) {
try {
const r81 = c26347_5;
c26347_6 = 0;
c30015_3 = r81;
Dispatcher.dispatch({
type: "GAME_CONSOLE_DEVICE_CANCEL_COMMAND_FAIL",
platform: c30015_0,
deviceId: c30015_1,
commandId: c30015_2,
error: c30015_3
});
throw c30015_3;
} catch (r77) {
r8 = r77;
c26347_5 = r77;
if (c26347_6 === 0) {
break;
}
}
}
}
throw r8;
}
};
export function waitForSession(a0, a1, a2) {
Dispatcher.dispatch({
type: "WAIT_FOR_REMOTE_SESSION",
sessionType: a0,
nonce: a2,
channelId: a1
});
}
export function connectToRemote(a0) {
Dispatcher.dispatch({
type: "REMOTE_SESSION_CONNECT",
sessionId: a0
});
}
export function remoteVoiceStateUpdate(a0, a1) {
Dispatcher.dispatch({
type: "REMOTE_COMMAND",
sessionId: a0,
payload: {
type: "VOICE_STATE_UPDATE",
self_mute: a1.selfMute,
self_deaf: a1.selfDeaf
}
});
const REMOTE_COMMAND_SENT = AnalyticEvents.REMOTE_COMMAND_SENT;
const sessionById = SessionsStore.getSessionById(a0);
AnalyticsUtils.track(REMOTE_COMMAND_SENT, {
command_type: "VOICE_STATE_UPDATE",
remote_platform: sessionById == null ? void 0 : sessionById.clientInfo?.os
});
}
export function remoteDisconnect(a0) {
Dispatcher.dispatch({
type: "REMOTE_COMMAND",
sessionId: a0,
payload: {
type: "DISCONNECT"
}
});
const REMOTE_COMMAND_SENT = AnalyticEvents.REMOTE_COMMAND_SENT;
const sessionById = SessionsStore.getSessionById(a0);
AnalyticsUtils.track(REMOTE_COMMAND_SENT, {
command_type: "DISCONNECT",
remote_platform: sessionById == null ? void 0 : sessionById.clientInfo?.os
});
disconnectRemote();
}
export function remoteAudioSettingsUpdate(a0, a1, a2, a3) {
const context = coerceAudioContextForProto(a2);
if (context != null) {
Dispatcher.dispatch({
type: "REMOTE_COMMAND",
sessionId: a0,
payload: {
type: "AUDIO_SETTINGS_UPDATE",
context,
id: a1,
...a3
}
});
const REMOTE_COMMAND_SENT = AnalyticEvents.REMOTE_COMMAND_SENT;
const sessionById = SessionsStore.getSessionById(a0);
AnalyticsUtils.track(REMOTE_COMMAND_SENT, {
command_type: "AUDIO_SETTINGS_UPDATE",
remote_platform: sessionById == null ? void 0 : sessionById.clientInfo?.os
});
}
}
export { getConnectNonce };
export { cancelConnectRequest };
export async function fetchDevices(platform2) {
let r71;
let c26345_3;
let c26345_4 = 0;
let c30013_0, c30013_1, c30013_2, c30013_3;
try {
c30013_0 = platform2;
c30013_1 = void 0;
c30013_2 = void 0;
Dispatcher.dispatch({
type: "GAME_CONSOLE_FETCH_DEVICES_START",
platform: platform2
});
c26345_4 = 1;
c30013_1 = await HTTP.get({
url: Endpoints.CONSOLES_DEVICES(platform2),
rejectWithError: false
});
c26345_4 = 0;
c30013_2 = c30013_1.body.devices;
Dispatcher.dispatch({
type: "GAME_CONSOLE_FETCH_DEVICES_SUCCESS",
platform: c30013_0,
devices: c30013_2
});
r71 = c30013_2;
} catch ($e) {
const r25 = $e;
let r8 = r25;
c26345_3 = r25;
if (c26345_4 !== 0) {
while (true) {
try {
const r80 = c26345_3;
c26345_4 = 0;
c30013_3 = r80;
Dispatcher.dispatch({
type: "GAME_CONSOLE_FETCH_DEVICES_FAIL",
platform: c30013_0,
error: c30013_3
});
throw c30013_3;
} catch (r76) {
r8 = r76;
c26345_3 = r76;
if (c26345_4 === 0) {
break;
}
}
}
}
throw r8;
}
return r71;
}
export function persistSelectedDeviceId(a0, a1) {
Dispatcher.dispatch({
type: "GAME_CONSOLE_SELECT_DEVICE",
platform: a0,
deviceId: a1
});
}
export { cancelCommand };
export async function transferToPlayStation(c26348_0, c26348_1, c26348_2) {
let env30016;
const r34 = env5914;
let c26348_4 = r34;
const r10 = env30016 = {
$parent: r34
};
let c26348_3 = r10;
env30016[0] = c26348_0;
env30016[1] = c26348_1;
env30016[2] = c26348_2;
env30016[3] = void 0;
await GameConsoleAlertUtils.maybeShowPTTAlert(c26348_0);
await (0, disconnectRemote)();
env30016[3] = await (0, getConnectNonce)();
const r18 = env30016[0];
const r17 = env30016[1];
const r16 = env30016[2];
const r15 = env30016[3];
await $mk115397(env5914)(r18, r17, r16, r15);
trackVoiceCallTransfer(env30016[2].id, env30016[0]);
}
@@ -0,0 +1,3 @@
// Metro module 9042 (f9043).
import * as _GameConsoleAlertUtils from "./native/GameConsoleAlertUtils";
export default _GameConsoleAlertUtils.default;
@@ -0,0 +1,58 @@
// Metro module 8945 (f8946).
import { ActivityGamePlatforms } from "../../Constants";
import { OAuth2Scopes } from "../../_bundle/Module8174";
const r12 = [OAuth2Scopes.VOICE, OAuth2Scopes.DM_CHANNELS_READ, OAuth2Scopes.GUILDS, OAuth2Scopes.GUILDS_MEMBERS_READ, OAuth2Scopes.IDENTIFY, OAuth2Scopes.CONNECTIONS, OAuth2Scopes.ACTIVITIES_READ];
const r11 = [OAuth2Scopes.VOICE, OAuth2Scopes.DM_CHANNELS_READ, OAuth2Scopes.GUILDS, OAuth2Scopes.GUILDS_MEMBERS_READ, OAuth2Scopes.IDENTIFY, OAuth2Scopes.CONNECTIONS];
const r10 = {
PLAYSTATION: "playstation",
XBOX: "xbox"
};
const set = new Set([r10.XBOX, r10.PLAYSTATION]);
const set2 = new Set([ActivityGamePlatforms.XBOX, ActivityGamePlatforms.PS5]);
const r90 = {
CONSOLE_DEVICE_PASSCODE_UNLOCK_REQUIRED: 270000
};
r90[270000] = "CONSOLE_DEVICE_PASSCODE_UNLOCK_REQUIRED";
r90.CONSOLE_DEVICE_UNAVAILABLE = 270001;
r90[270001] = "CONSOLE_DEVICE_UNAVAILABLE";
r90.CONSOLE_DEVICE_UNVAILABLE_FROM_OTHER_USERS = 270002;
r90[270002] = "CONSOLE_DEVICE_UNVAILABLE_FROM_OTHER_USERS";
r90.CONSOLE_DEVICE_COMMUNICATION_RESTRICTED = 270003;
r90[270003] = "CONSOLE_DEVICE_COMMUNICATION_RESTRICTED";
r90.CONSOLE_DEVICE_INVALID_POWER_MODE = 270004;
r90[270004] = "CONSOLE_DEVICE_INVALID_POWER_MODE";
r90.CONSOLE_DEVICE_ACCOUNT_LINK_ERROR = 270005;
r90[270005] = "CONSOLE_DEVICE_ACCOUNT_LINK_ERROR";
r90.CONSOLE_DEVICE_MAX_MEMBERS_REACHED = 270006;
r90[270006] = "CONSOLE_DEVICE_MAX_MEMBERS_REACHED";
r90.CONSOLE_DEVICE_BAD_COMMAND = 270007;
r90[270007] = "CONSOLE_DEVICE_BAD_COMMAND";
const set3 = new Set([r90.CONSOLE_DEVICE_PASSCODE_UNLOCK_REQUIRED]);
export const XBOX_URL_BASE = "xbox://communitylinking/donut/audio";
export const XBOX_IOS_APP_LINK = "https://apps.apple.com/us/app/xbox/id736179781";
export const XBOX_ANDROID_APP_LINK = "https://play.google.com/store/apps/details?id=com.microsoft.xboxone.smartglass";
export const XBOX_APP_WEB_LINK = "https://www.xbox.com/en-US/apps/xbox-app-for-mobile";
export const XBOX_LINK_DEST_ORIGIN = "https://login.live.com";
export { r12 as XBOX_CLIENT_SCOPES };
export { r11 as PLAYSTATION_CLIENT_SCOPES };
export const PLAYSTATION_LINK_DEST_ORIGIN = "https://my.account.sony.com";
export const XBOX_HANDOFF_SEARCH_PARAMS = ({ guildId, channelName, guildName, channelId, muted, deafened, nonce }) => {
const r3 = {
channelid: channelId,
guildid: guildId,
channelname: channelName,
guildname: guildName,
muted: String(muted),
deafened: String(deafened)
};
if (nonce != null) {
r3.nonce = nonce;
}
return new URLSearchParams(r3);
};
export { r10 as GameConsoleTypes };
export { set as GAME_CONSOLE_SESSIONS };
export { set2 as CONSOLE_VOICE_PLATFORMS };
export { r90 as GameConsoleCommandResultErrorCodes };
export { set3 as USER_ACTION_REQUIRED_ERROR_CODES };
export const GAME_CONSOLE_ALERT_MODAL_LOCATION = "console error alert";
+188
View File
@@ -0,0 +1,188 @@
// Metro module 16186 (f16187).
import AuthenticationStore from "../../stores/AuthenticationStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SessionsStore from "../../stores/SessionsStore";
import VoiceStateStore from "../../stores/VoiceStateStore";
import GameConsoleStore from "./GameConsoleStore";
import { GAME_CONSOLE_SESSIONS, USER_ACTION_REQUIRED_ERROR_CODES } from "./GameConsoleConstants";
import { MediaEngineContextTypes } from "../../_bundle/Module4250";
import Logger from "../debug/Logger";
import Module38 from "../../_bundle/Module38";
import AudioActionCreators from "../../actions/AudioActionCreators";
import { coercePlatformTypeToConsoleType } from "./coercePlatformTypeToConsoleType";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import { Timeout } from "../../_bundle/Timeout";
import { connectToRemote, remoteVoiceStateUpdate, disconnectRemote } from "./GameConsoleActionCreators";
import { isNotNullish } from "../../utils/GlobalUtils";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import getErrorMessageForCommandResult from "./getErrorMessageForCommandResult";
import GameConsoleAlertUtils from "./GameConsoleAlertUtils";
let c11604_13;
const syncLocalState = async function syncLocalState(c28267_0) {
let c28267_2;
let c30980_0;
L16: {
c28267_2 = void 0;
c30980_0 = c28267_0;
Module38(RTCConnectionStore.getChannelId() == null, "Syncing to remote while in voice!");
if (c28267_0.selfMute !== MediaEngineStore.isSelfMute()) {
await AudioActionCreators.toggleSelfMute({
syncRemote: false
});
if (c30980_0.selfDeaf === MediaEngineStore.isSelfDeaf()) {
break L16;
}
AudioActionCreators.toggleSelfDeaf({
syncRemote: false
});
break L16;
}
if (c30980_0.selfDeaf !== MediaEngineStore.isSelfDeaf()) {
AudioActionCreators.toggleSelfDeaf({
syncRemote: false
});
}
return void 0;
}
};
c11604_13 = new Logger("GameConsoleManager");
class GameConsoleManager extends AutomaticLifecycleManager {
rollbackCommandTimeout = new Timeout();
awaitRemoteTimeout = new Timeout();
actions = {
WAIT_FOR_REMOTE_SESSION: () => this.handleWaitForRemoteSession(),
POST_CONNECTION_OPEN: () => this.handleSessionsChanged(),
SESSIONS_REPLACE: () => this.handleSessionsChanged(),
AUDIO_TOGGLE_SELF_DEAF: (a0) => this.handleAudioStateToggle(a0),
AUDIO_TOGGLE_SELF_MUTE: (a0) => this.handleAudioStateToggle(a0),
VOICE_STATE_UPDATES: (a0) => this.handleVoiceStateUpdates(a0),
CONSOLE_COMMAND_UPDATE: (a0) => this.handleConsoleCommandUpdate(a0),
PASSIVE_UPDATE_V2: (a0) => this.handleVoiceStateUpdates(a0),
REMOTE_SESSION_DISCONNECT: () => this.handleRemoteSessionDisconnect()
};
maybeConnect = (a0) => {
const awaitingRemoteSessionInfo = GameConsoleStore.getAwaitingRemoteSessionInfo();
const r11 = a0.find((item) => {
let r11 = GAME_CONSOLE_SESSIONS.has(item.clientInfo.os);
const r2 = VoiceStateStore.getVoiceStateForSession(AuthenticationStore.getId(), item.sessionId) != null;
const r19 = awaitingRemoteSessionInfo == null || coercePlatformTypeToConsoleType(awaitingRemoteSessionInfo.type) === item.clientInfo.os;
if (r11) {
r11 = r19;
}
if (r11) {
r11 = r2;
}
return r11;
});
if (r11 == null) {
return null;
}
this.awaitRemoteTimeout.stop();
connectToRemote(r11.sessionId);
const voiceStateForSession2 = VoiceStateStore.getVoiceStateForSession(AuthenticationStore.getId(), r11.sessionId);
if (voiceStateForSession2 != null) {
syncLocalState(voiceStateForSession2);
}
};
handleAudioStateToggle = ({ syncRemote, context }) => {
let voiceStateForSession;
voiceStateForSession = void 0;
if (syncRemote && context === MediaEngineContextTypes.DEFAULT) {
const isSelfDeaf = MediaEngineStore.isSelfDeaf();
const isSelfMute = MediaEngineStore.isSelfMute();
const id = AuthenticationStore.getId();
const remoteSessionId2 = GameConsoleStore.getRemoteSessionId();
if (remoteSessionId2 != null) {
voiceStateForSession = VoiceStateStore.getVoiceStateForSession(id, remoteSessionId2);
if (voiceStateForSession != null && !(voiceStateForSession.selfDeaf === isSelfDeaf && voiceStateForSession.selfMute === isSelfMute)) {
remoteVoiceStateUpdate(remoteSessionId2, {
selfDeaf: isSelfDeaf,
selfMute: isSelfMute
});
this.rollbackCommandTimeout.start(3000, () => {
syncLocalState(voiceStateForSession);
});
}
}
}
};
handleVoiceStateUpdates = ({ voiceStates }) => {
const remoteSessionId = GameConsoleStore.getRemoteSessionId();
if (remoteSessionId == null) {
return this.maybeConnect(voiceStates.map(({ sessionId }) => sessionId != null ? SessionsStore.getSessionById(sessionId) : null).filter(isNotNullish));
}
const r11 = voiceStates.find((voiceState) => voiceState.sessionId === remoteSessionId);
if (r11 != null) {
this.rollbackCommandTimeout.stop();
syncLocalState(r11);
}
};
handleSessionsChanged = () => {
const remoteSessionId2 = GameConsoleStore.getRemoteSessionId();
if (remoteSessionId2 != null && SessionsStore.getSessionById(remoteSessionId2) == null) {
disconnectRemote();
}
if (remoteSessionId2 == null) {
this.maybeConnect(Object.values(SessionsStore.getSessions()));
}
};
handleWaitForRemoteSession = () => {
this.awaitRemoteTimeout.start(60000, () => {
disconnectRemote();
AlertActionCreators.show({
title: intl.string(t.wGMxr3),
body: intl.string(t.i5k8b5)
});
});
};
handleConsoleCommandUpdate = (a0) => {
L19: {
const { id, result, error } = a0;
const r4 = result === "failed";
if (!(!r4 && result !== "n/a") && error != null) {
c11604_13.info("Console command Error result:", result, error);
const awaitingRemoteSessionInfo2 = GameConsoleStore.getAwaitingRemoteSessionInfo();
if (awaitingRemoteSessionInfo2?.commandId === id) {
const type = awaitingRemoteSessionInfo2.type;
let deviceId = awaitingRemoteSessionInfo2.deviceId;
if (deviceId == null) {
deviceId = "";
}
let r28 = GameConsoleStore.getDevice(type, deviceId);
if (r28 == null) {
r28 = {
id: "id",
platform: intl.string(t["UQMV/E"]),
name: intl.string(t["UQMV/E"])
};
}
const errorMessageForCommandResult = getErrorMessageForCommandResult(r28, result, error);
if (errorMessageForCommandResult != null) {
GameConsoleAlertUtils.showSelfDismissableAlert({
title: errorMessageForCommandResult.title,
body: errorMessageForCommandResult.body,
errorCodeMessage: errorMessageForCommandResult.errorCodeMessage,
reconnectPlatformType: errorMessageForCommandResult.isAccountLinkError ? awaitingRemoteSessionInfo2.type : void 0
});
}
if (USER_ACTION_REQUIRED_ERROR_CODES.has(error.code)) {
if (this.awaitRemoteTimeout.isStarted()) {
this.awaitRemoteTimeout.start(180000, () => disconnectRemote(), true);
break L19;
}
}
if (r4) {
disconnectRemote();
}
}
}
}
};
handleRemoteSessionDisconnect = () => {
this.awaitRemoteTimeout.stop();
};
}
const gameConsoleManager = new GameConsoleManager();
export default gameConsoleManager;
+96
View File
@@ -0,0 +1,96 @@
// Metro module 4203 (f4204).
import SessionsStore from "../../stores/SessionsStore";
import VoiceStateStore from "../../stores/VoiceStateStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
const sessionId = null;
let c2423_3 = null;
let c2423_4 = new Set();
let c2423_5 = {};
let lastSelectedDeviceByPlatform = {};
let c2423_7 = new Set();
let c2423_8 = Object.freeze({});
class GameConsoleStore extends Module589.DeviceSettingsStore {
static displayName = "GameConsoleStore";
static persistKey = "GameConsoleStore";
initialize(a0) {
if (a0 != null) {
lastSelectedDeviceByPlatform = a0.lastSelectedDeviceByPlatform;
}
this.waitFor(SessionsStore, VoiceStateStore);
}
getUserAgnosticState() {
return {
lastSelectedDeviceByPlatform
};
}
getDevicesForPlatform(a0) {
let r4 = c2423_5[a0];
if (r4 == null) {
r4 = c2423_8;
}
return r4;
}
getLastSelectedDeviceByPlatform(a0) {
return lastSelectedDeviceByPlatform[a0];
}
getDevice(a0, a1) {
const r3 = c2423_5[a0];
return r3 == null ? void 0 : r3[a1];
}
getFetchingDevices(a0) {
return c2423_7.has(a0);
}
getPendingDeviceCommands() {
return c2423_4;
}
getRemoteSessionId() {
return sessionId;
}
getAwaitingRemoteSessionInfo() {
return c2423_3;
}
}
const gameConsoleStore = new GameConsoleStore(Dispatcher, {
REMOTE_SESSION_CONNECT: function handleRemoteSessionConnect(a0) {
sessionId = a0.sessionId;
c2423_3 = null;
},
REMOTE_SESSION_DISCONNECT: function handleRemoteSessionDisconnect() {
sessionId = null;
c2423_3 = null;
},
WAIT_FOR_REMOTE_SESSION: function handleWaitForRemoteSession({ sessionType, nonce, channelId, deviceId, commandId }) {
c2423_3 = {
type: sessionType,
nonce,
channelId,
startedAt: Date.now(),
deviceId,
commandId
};
},
GAME_CONSOLE_FETCH_DEVICES_START: function handleFetchDevicesStart(a0) {
c2423_7.add(a0.platform);
},
GAME_CONSOLE_FETCH_DEVICES_SUCCESS: function handleFetchDevicesSuccess({ platform: platform2, devices }) {
c2423_7.delete(platform2);
const r5 = {};
c2423_5[platform2] = r5;
const r24 = {};
for (const item of devices) {
r5[item.id] = item;
if (lastSelectedDeviceByPlatform[platform2] === item.id) {
r24[platform2] = item.id;
}
}
lastSelectedDeviceByPlatform = r24;
},
GAME_CONSOLE_FETCH_DEVICES_FAIL: function handleFetchDevicesFail(a0) {
c2423_7.delete(a0.platform);
},
GAME_CONSOLE_SELECT_DEVICE: function handleSelectDevice(a0) {
lastSelectedDeviceByPlatform[a0.platform] = a0.deviceId;
}
});
export default gameConsoleStore;
@@ -0,0 +1,15 @@
// Metro module 5762 (f5763).
import ApexExperiment from "../experiments/apex/ApexExperiment";
const r16 = ApexExperiment({
kind: "user",
name: "2026-03-churro",
defaultConfig: {
allowPlayStationStaging: false
},
variations: {
1: {
allowPlayStationStaging: true
}
}
});
export { r16 as PlayStationVoiceExperiment };
@@ -0,0 +1,11 @@
// Metro module 15950 (f15951).
import { ActivityGamePlatforms, PlatformTypes } from "../../Constants";
export default function activityPlatformToConnectedAccountType(a0) {
if (ActivityGamePlatforms.PS4 !== a0 && ActivityGamePlatforms.PS5 !== a0) {
if (ActivityGamePlatforms.XBOX === a0) {
return PlatformTypes.XBOX;
}
return void 0;
}
return PlatformTypes.PLAYSTATION;
};
@@ -0,0 +1,22 @@
// Metro module 10803 (f10804).
import { GameConsoleTypes } from "./GameConsoleConstants";
import { PlatformTypes } from "../../Constants";
export function coercePlatformTypeToConsoleType(a0) {
if (PlatformTypes.XBOX === a0) {
return GameConsoleTypes.XBOX;
}
if (PlatformTypes.PLAYSTATION !== a0 && PlatformTypes.PLAYSTATION_STAGING !== a0) {
return null;
}
return GameConsoleTypes.PLAYSTATION;
}
export function coerceConsoleTypeToPlatformType(a0, a1) {
if (GameConsoleTypes.XBOX === a0) {
return PlatformTypes.XBOX;
}
if (GameConsoleTypes.PLAYSTATION === a0) {
const r9 = a1.some(({ type, twoWayLink }) => type === PlatformTypes.PLAYSTATION_STAGING && twoWayLink);
return !a1.some(({ type, twoWayLink }) => type === PlatformTypes.PLAYSTATION && twoWayLink) && r9 ? PlatformTypes.PLAYSTATION_STAGING : PlatformTypes.PLAYSTATION;
}
return null;
}
@@ -0,0 +1,63 @@
// Metro module 16187 (f16188).
import { GameConsoleCommandResultErrorCodes } from "./GameConsoleConstants";
import { intl, t } from "../../intl/index.native";
import HelpdeskUtils from "../../utils/HelpdeskUtils";
export default function getErrorMessageForCommandResult(a0, a1, a2) {
let r15;
if (a1 === "failed") {
const code2 = a2.code;
const { platform: platform3, name: name2 } = a0;
r15 = GameConsoleCommandResultErrorCodes.CONSOLE_DEVICE_COMMUNICATION_RESTRICTED === code2 ? {
title: intl.string(t["GSZ+HI"]),
body: intl.formatToPlainString(t["cYX/3E"], {
deviceType: platform3
})
} : GameConsoleCommandResultErrorCodes.CONSOLE_DEVICE_INVALID_POWER_MODE === code2 ? {
title: intl.formatToPlainString(t.akd6Sx, {
deviceType: platform3
}),
body: intl.formatToPlainString(t.RyOvpJ, {
deviceName: name2
})
} : GameConsoleCommandResultErrorCodes.CONSOLE_DEVICE_UNVAILABLE_FROM_OTHER_USERS === code2 ? {
title: intl.formatToPlainString(t.M6Vzat, {
deviceType: platform3
}),
body: intl.formatToPlainString(t.InKtnC, {
deviceName: name2
})
} : GameConsoleCommandResultErrorCodes.CONSOLE_DEVICE_ACCOUNT_LINK_ERROR === code2 ? {
title: intl.string(t.QL1y93),
body: intl.formatToPlainString(t.D18eZu, {
deviceType: platform3
}),
isAccountLinkError: true
} : {
title: intl.string(t.QL1y93),
body: intl.formatToPlainString(t["6ZyNH/"], {
deviceName: name2
})
};
} else {
r15 = null;
if (a1 === "n/a") {
const code = a2.code;
const { platform: platform2, name } = a0;
r15 = code === GameConsoleCommandResultErrorCodes.CONSOLE_DEVICE_PASSCODE_UNLOCK_REQUIRED ? {
title: intl.formatToPlainString(t.KchfhO, {
deviceType: platform2
}),
body: intl.formatToPlainString(t["21ndz7"], {
deviceName: name
})
} : null;
}
}
if (r15 != null) {
r15.errorCodeMessage = intl.format(t["1Bi9Cf"], {
supportURL: HelpdeskUtils.getSubmitRequestURL(),
errorCode: a2.code
});
}
return r15;
};
@@ -0,0 +1,37 @@
// Metro module 9051 (f9052).
import GuildStore from "../../stores/GuildStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import RelationshipStore from "../../stores/RelationshipStore";
import UserStore from "../../stores/UserStore";
import { XBOX_HANDOFF_SEARCH_PARAMS, XBOX_URL_BASE } from "./GameConsoleConstants";
import { Endpoints, ZERO_STRING_GUILD_ID } from "../../Constants";
import { computeChannelName } from "../channel/useChannelName";
import { intl, t } from "../../intl/index.native";
import { getAPIBaseURL } from "../../_bundle/sendRequest";
export default function getXboxURIForChannel(a0, { nonce, forQRCode }) {
const guildId = a0.getGuildId();
const guild = GuildStore.getGuild(guildId);
let guildId2 = guildId;
if (guildId2 == null) {
guildId2 = ZERO_STRING_GUILD_ID;
}
const r24 = {
guildId: guildId2,
channelId: a0.id,
channelName: computeChannelName(a0, UserStore, RelationshipStore),
guildName: null,
muted: null,
deafened: null,
nonce: null
};
let guildName = guild?.name;
if (guildName == null) {
guildName = intl.string(t.LJpTRF);
}
r24.guildName = guildName;
r24.muted = MediaEngineStore.isSelfMute();
r24.deafened = MediaEngineStore.isSelfDeaf();
r24.nonce = nonce;
const r44 = XBOX_HANDOFF_SEARCH_PARAMS(r24);
return forQRCode ? `${getAPIBaseURL()}${Endpoints.XBOX_HANDOFF}?${r44.toString()}` : `${XBOX_URL_BASE}?${r44.toString()}`;
};
@@ -0,0 +1,6 @@
// Metro module 6049 (f6050).
import GameConsoleStore from "../GameConsoleStore";
import { useStateFromStores } from "../../../_bundle/Module589";
export default function useIsRemote() {
return useStateFromStores([GameConsoleStore], () => GameConsoleStore.getRemoteSessionId() != null || GameConsoleStore.getAwaitingRemoteSessionInfo() != null);
};
@@ -0,0 +1,14 @@
// Metro module 8929 (f8930).
import AuthenticationStore from "../../../stores/AuthenticationStore";
import VoiceStateStore from "../../../stores/VoiceStateStore";
import GameConsoleStore from "../GameConsoleStore";
import { useStateFromStores } from "../../../_bundle/Module589";
export default function useVoiceStateForRemoteSession() {
return useStateFromStores([AuthenticationStore, VoiceStateStore, GameConsoleStore], () => {
let r10 = VoiceStateStore.getVoiceStateForSession(AuthenticationStore.getId(), GameConsoleStore.getRemoteSessionId());
if (r10 == null) {
r10 = void 0;
}
return r10;
}, []);
};
@@ -0,0 +1,38 @@
// Metro module 9046 (f9047).
import { transferToPlayStation } from "../GameConsoleActionCreators";
import AlertActionCreators from "../../../actions/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
export async function transferToPlaystationWithAlert(c26350_0, c26350_1, c26350_2) {
let c26350_6 = 0;
let c30017_0;
L10: {
try {
c30017_0 = c26350_1;
c26350_6 = 1;
await transferToPlayStation(c26350_0, c26350_1.id, c26350_2);
c26350_6 = 0;
} catch ($e) {
let r8 = $e;
if (c26350_6 !== 0) {
while (true) {
try {
c26350_6 = 0;
AlertActionCreators.show({
title: intl.string(t.QL1y93),
body: intl.formatToPlainString(t["6ZyNH/"], {
deviceName: c30017_0.name
})
});
break L10;
} catch ($e) {
r8 = $e;
if (c26350_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
@@ -0,0 +1,35 @@
// Metro module 9044 (f9045).
import { useEffect } from "react";
import { View } from "react-native";
import GameConsoleStore from "../GameConsoleStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../_bundle/Module589";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
errorCodeText: {
marginTop: 16
},
alertBody: {
marginTop: 0
},
container: {
flex: 1
},
body: {
marginTop: 16
}
});
export function SelfDismissibleAlertBody(props) {
const { body, dismissCallback, errorCodeMessage } = props;
const styles = useStyles();
const stateFromStores = useStateFromStores([GameConsoleStore], () => GameConsoleStore.getRemoteSessionId());
useEffect(() => {
if (stateFromStores != null) {
dismissCallback();
}
}, [stateFromStores, dismissCallback]);
return errorCodeMessage != null ? <View style={styles.container}>
<Text maxFontSizeMultiplier={1} variant="text-md/normal" style={[styles.body, styles.alertBody]}>{body}</Text>
<Text maxFontSizeMultiplier={1} variant="text-md/normal" style={[styles.body, styles.errorCodeText]}>{errorCodeMessage}</Text>
</View> : body;
}
@@ -0,0 +1,47 @@
// Metro module 9043 (f9044).
import MediaEngineStore from "../../../stores/MediaEngineStore";
import { GAME_CONSOLE_ALERT_MODAL_LOCATION } from "../GameConsoleConstants";
import { InputModes, PlatformTypes } from "../../../Constants";
import { UNSAFE_isDismissibleContentDismissed, UNSAFE_markDismissibleContentAsDismissed } from "../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../_bundle/Module1358";
import { intl, t } from "../../../intl/index.native";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { SelfDismissibleAlertBody } from "./GameConsoleAlert";
import authorizeConnection_native from "../../connections/authorizeConnection.native";
const r29 = {
maybeShowPTTAlert: (a0) => {
if (MediaEngineStore.getMode() === InputModes.PUSH_TO_TALK && !UNSAFE_isDismissibleContentDismissed(DismissibleContent.CONSOLE_PTT_DISABLE_ALERT)) {
const r25 = {};
r25[PlatformTypes.XBOX] = intl.string(t.bVZ7vy);
r25[PlatformTypes.PLAYSTATION] = intl.string(t["6iqUsf"]);
r25[PlatformTypes.PLAYSTATION_STAGING] = intl.string(t["6iqUsf"]);
const title = r25[a0];
return title == null ? Promise.resolve() : new Promise((c26349_0) => {
AlertActionCreators.show({
title,
body: intl.string(t.bL21zs),
onConfirm: function onConfirm() {
UNSAFE_markDismissibleContentAsDismissed(DismissibleContent.CONSOLE_PTT_DISABLE_ALERT);
c26349_0();
}
});
});
}
return Promise.resolve();
},
showSelfDismissableAlert: ({ title: title2, body, errorCodeMessage, reconnectPlatformType }) => {
AlertActionCreators.show({
title: title2,
body: <SelfDismissibleAlertBody body={body} errorCodeMessage={errorCodeMessage} dismissCallback={AlertActionCreators.close} />,
onConfirm: function onConfirm() {
if (reconnectPlatformType != null) {
authorizeConnection_native({
platformType: reconnectPlatformType,
location: GAME_CONSOLE_ALERT_MODAL_LOCATION
});
}
}
});
}
};
export default r29;
@@ -0,0 +1,192 @@
// Metro module 9047 (f9048).
import { useState, useEffect, useMemo } from "react";
import { ActivityIndicator, Image as Image2, Pressable, View } from "react-native";
import GameConsoleStore from "../GameConsoleStore";
import { ComponentActions } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import { Button } from "../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../intl/index.native";
import Module9048 from "../../../_bundle/Module9048";
import { Text } from "../../../design/components/Text/native/Text";
import Module9049 from "../../../_bundle/Module9049";
import { useStateFromStores } from "../../../_bundle/Module589";
import { persistSelectedDeviceId, fetchDevices } from "../GameConsoleActionCreators";
import Module38 from "../../../_bundle/Module38";
import { transferToPlaystationWithAlert } from "./GameConsoleActionCreators";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { ComponentDispatch } from "../../../utils/ComponentDispatchUtils";
import { RadioGroup } from "../../../design/void/native";
import InfoBox from "../../user_settings/authorized_apps/native/InfoBox";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { BottomSheetScrollView } from "../../../_bundle/Module5245";
let useStyles, DeviceOption, EmptyState;
const TransferFooter = function TransferFooter(props) {
const onPress2 = props.onPress;
let transferring = props.transferring;
const styles = useStyles();
const props2 = {
loading: transferring,
disabled: null,
onPress: null,
text: null,
grow: true
};
if (!transferring) {
transferring = onPress2 == null;
}
props2.disabled = transferring;
props2.onPress = onPress2;
props2.text = intl.string(t.FYi3ry);
return <SafeAreaPaddingView bottom style={styles.footerContainer}>
<Button {...props2} />
</SafeAreaPaddingView>;
};
DeviceOption = function DeviceOption(props) {
const name = props.name;
props.platform;
const styles = useStyles();
return <View style={styles.deviceOption}>
<Image2 style={styles.deviceIcon} source={Module9048} />
<Text style={styles.deviceText} color="mobile-text-heading-primary" variant="text-md/bold">{name}</Text>
</View>;
};
EmptyState = function EmptyState() {
const styles = useStyles();
return <View style={styles.emptyContainer}>
<Image2 source={Module9049} style={styles.emptyArt} />
<Text style={styles.emptyHeader} variant="heading-md/extrabold" color="mobile-text-heading-primary">
{intl.string(t.OkJf1e)}
</Text>
<Text style={styles.emptyBody} variant="text-md/normal" color="text-default">
{intl.string(t["of/l5Z"])}
</Text>
</View>;
};
useStyles = createStyles({
container: {
padding: 16,
justifyContent: "center",
paddingBottom: 90
},
loading: {
minHeight: 56
},
footerContainer: {
padding: 16,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
paddingBottom: 16
},
radioItem: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.xs,
padding: 16
},
deviceIcon: {
marginRight: 16,
width: 32,
height: 32,
tintColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY
},
deviceOption: {
flexDirection: "row",
alignItems: "center",
marginRight: 24
},
deviceText: {
flexShrink: 1
},
emptyContainer: {
alignItems: "center",
justifyContent: "center"
},
emptyArt: {
marginBottom: 16
},
emptyHeader: {
marginBottom: 8,
textAlign: "center"
},
emptyBody: {
textAlign: "center"
},
infoBox: {
marginTop: 8
}
});
export default function GameConsoleListActionSheet(props) {
let stateFromStores, stateFromStores2, state, setState, setState2;
const { platform: platform2, channel } = props;
stateFromStores = void 0;
stateFromStores2 = void 0;
state = void 0;
setState = void 0;
setState2 = void 0;
let _handleTransferVoice2 = function _handleTransferVoice() {
const r9 = async () => {
let c30018_0;
c30018_0 = void 0;
Module38(state != null, "selectedDeviceId cannot be null");
setState2(true);
await transferToPlaystationWithAlert(platform2, stateFromStores[state], channel);
ActionSheetActionCreators.hideActionSheet();
ComponentDispatch.dispatch(ComponentActions.TOGGLE_CALL_CONTROL_DRAWER);
};
_handleTransferVoice2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
stateFromStores = useStateFromStores([GameConsoleStore], () => GameConsoleStore.getDevicesForPlatform(platform2));
const stateFromStores3 = useStateFromStores([GameConsoleStore], () => GameConsoleStore.getFetchingDevices(platform2));
stateFromStores2 = useStateFromStores([GameConsoleStore], () => GameConsoleStore.getLastSelectedDeviceByPlatform(platform2));
[state, setState] = useState(null);
let disabled;
[disabled, setState2] = useState(false);
useEffect(() => {
const r7 = Object.values(stateFromStores);
if (r7.length === 1) {
setState(r7[0].id);
} else if (stateFromStores2 != null) {
setState(stateFromStores2);
}
}, [stateFromStores, stateFromStores2]);
const memo = useMemo(() => {
const r3 = Object;
let r5 = stateFromStores;
if (stateFromStores == null) {
r5 = [];
}
return r3.values(r5).map((item) => ({
value: item.id,
name: <DeviceOption name={item.name} platform={item.platform} />
}));
}, [stateFromStores]);
let r64 = memo.length > 0 ? <>
<RadioGroup style={styles.radioItem} options={memo} value={state} withDividers={false} withSpacing disabled={disabled} onChange={({ value }) => {
setState(value);
persistSelectedDeviceId(platform2, value);
}} />
<InfoBox style={styles.infoBox}>
{intl.string(t.dI4HFq)}
</InfoBox>
</> : <EmptyState />;
const props2 = {
footer: <TransferFooter transferring={disabled} onPress={state != null ? function handleTransferVoice() {
return _handleTransferVoice2.apply(this, arguments);
} : void 0} />,
header: <BottomSheetTitleHeader title={intl.string(t.aUuz7W)} trailing={<Pressable disabled={stateFromStores3 || disabled} onPress={() => fetchDevices(platform2)}>
<Text variant="text-md/semibold" color="text-brand">
{intl.string(t.hb12iG)}
</Text>
</Pressable>} />,
scrollable: true,
children: null
};
if (stateFromStores3) {
r64 = <ActivityIndicator style={styles.loading} />;
}
props2.children = <BottomSheetScrollView contentContainerStyle={styles.container}>{r64}</BottomSheetScrollView>;
return <BottomSheet {...props2} />;
};
@@ -0,0 +1,28 @@
// Metro module 9052 (f9053).
import { XBOX_ANDROID_APP_LINK, XBOX_IOS_APP_LINK } from "../GameConsoleConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import Alert from "../../../components_native/common/Alert";
import { intl, t } from "../../../intl/index.native";
import { Icon } from "../../../design/void/native";
import Module9035 from "../../../_bundle/Module9035";
import { isAndroid } from "../../../utils/PlatformUtils";
import Linking from "../../../lib/native/Linking";
const useStyles = createStyles({
externalLinkIcon: {
tintColor: Module712.colors.WHITE,
width: 20,
height: 20,
marginLeft: 8
}
});
export default function XboxInstallAlert(props) {
const styles = useStyles();
return <Alert {...props} title={intl.string(t["12Kx2v"])} body={intl.string(t.msZW3j)} confirmText={intl.string(t["n+VrqG"])} cancelText={intl.string(t.kYaBOg)} fillCancelText renderConfirmRightIcon={() => <Icon source={Module9035} style={styles.externalLinkIcon} />} onConfirm={() => {
if (isAndroid()) {
Linking.openURL(XBOX_ANDROID_APP_LINK);
} else {
Linking.openURL(XBOX_IOS_APP_LINK);
}
}} />;
};
@@ -0,0 +1,41 @@
// Metro module 9038 (f9039).
import { PlatformTypes } from "../../../Constants";
import { fetchDevices } from "../GameConsoleActionCreators";
import { transferToPlaystationWithAlert } from "./GameConsoleActionCreators";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import "../../../_bundle/asyncRequire";
import { ImpressionNames } from "../../../_bundle/Module503";
import transferToXbox from "./transferToXbox";
let c5913_4 = new Set([PlatformTypes.PLAYSTATION, PlatformTypes.PLAYSTATION_STAGING]);
export async function beginConsoleTransfer(c26342_0, c26342_1) {
let r92;
let c26342_3;
let c30011_0, c30011_1, c30011_2, c30011_3;
L17: {
L16: {
c26342_3 = void 0;
c30011_0 = c26342_0;
c30011_1 = c26342_1;
c30011_2 = void 0;
c30011_3 = void 0;
if (c5913_4.has(c26342_1)) {
c30011_2 = await fetchDevices(c26342_1);
if (c30011_2.length !== 1) {
r92 = ActionSheetActionCreators.openLazy(import("./GameConsoleDeviceListActionSheet"), `GameConsoleDeviceListActionSheet${c30011_0.id}`, {
channel: c30011_0,
platform: c30011_1,
impressionName: ImpressionNames.GAME_CONSOLE_DEVICE_LIST
});
break L17;
}
c30011_3 = c30011_2[0];
await transferToPlaystationWithAlert(c30011_1, c30011_3, c30011_0);
break L16;
}
transferToXbox(c26342_0);
return void 0;
}
return void 0;
}
return r92;
}
@@ -0,0 +1,11 @@
// Metro module 15998 (f15999).
import { PlatformTypes } from "../../../Constants";
import Module712 from "../../../_bundle/Module712";
const r15 = {};
r15[PlatformTypes.XBOX] = Module712.unsafe_rawColors.PLATFORM_XBOX;
r15[PlatformTypes.PLAYSTATION] = Module712.unsafe_rawColors.PLATFORM_PLAYSTATION;
r15[PlatformTypes.PLAYSTATION_STAGING] = Module712.unsafe_rawColors.PLATFORM_PLAYSTATION;
let c11466_0 = r15;
export default function getConsoleColor(a0) {
return c11466_0[a0];
};
@@ -0,0 +1,26 @@
// Metro module 15997 (f15998).
import { PlatformTypes } from "../../../Constants";
import { intl, t } from "../../../intl/index.native";
export function getConsoleConnectingText(a0, a1, a2) {
let r19;
let r7 = a1?.type;
if (r7 == null) {
r7 = a0 == null ? void 0 : a0.clientInfo.os;
}
L22: {
const r15 = a1 != null;
if (r7 === PlatformTypes.XBOX) {
r19 = a2 ? intl.format(t["ynEs/Y"], {}) : r15 ? intl.string(t.UjA4HX) : "Xbox";
} else {
if (r7 !== PlatformTypes.PLAYSTATION) {
const PLAYSTATION_STAGING = PlatformTypes.PLAYSTATION_STAGING;
r19 = void 0;
if (r7 !== PLAYSTATION_STAGING) {
break L22;
}
}
r19 = a2 ? intl.format(t.TZ17Bg, {}) : r15 ? intl.string(t.QCw1oW) : "PS5";
}
}
return r19;
}
@@ -0,0 +1,16 @@
// Metro module 9053 (f9054).
import { PlatformTypes } from "../../../Constants";
import { VoicePlatforms } from "../../calls/CallConstants";
import Module9033 from "../../../_bundle/Module9033";
import Module9054 from "../../../_bundle/Module9054";
const r18 = {};
r18[PlatformTypes.XBOX] = Module9033;
r18[PlatformTypes.PLAYSTATION] = Module9054;
r18[PlatformTypes.PLAYSTATION_STAGING] = Module9054;
let c5923_3 = r18;
export default function getConsoleIcon(a0) {
return c5923_3[a0];
};
export function getConsoleIconForVoicePlatform(a0) {
return a0 === VoicePlatforms.XBOX ? Module9033 : a0 === VoicePlatforms.PLAYSTATION ? Module9054 : null;
}
@@ -0,0 +1,59 @@
// Metro module 9050 (f9051).
import { Linking } from "react-native";
import { PlatformTypes } from "../../../Constants";
import GameConsoleAlertUtils from "../GameConsoleAlertUtils";
import { disconnectRemote, getConnectNonce, waitForSession } from "../GameConsoleActionCreators";
import getXboxURIForChannel from "../getXboxURIForChannel";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import trackVoiceCallTransfer from "../trackVoiceCallTransfer";
import { stopOwnStream } from "../../../actions/StreamActionCreators";
function $mk115399($env) {
return () => {
const r1 = $env;
return import("./XboxInstallAlert").then($mk118112(r1));
};
}
function $mk118112($env) {
return (a0) => {
let env31987 = {
$parent: $env
};
env31987[0] = a0.default;
return (a0) => env31987.$parent[7](env31987[0], {
...a0
});
};
}
let env5920 = {};
export default async function transferToXbox(c26351_0) {
let c26351_1, c26351_2;
L18: {
let env30019;
const r34 = env5920;
c26351_2 = r34;
const r10 = env30019 = {
$parent: r34
};
c26351_1 = r10;
env30019[0] = c26351_0;
env30019[1] = void 0;
env30019[2] = void 0;
await GameConsoleAlertUtils.maybeShowPTTAlert(PlatformTypes.XBOX);
await disconnectRemote();
env30019[1] = await getConnectNonce();
env30019[2] = getXboxURIForChannel(env30019[0], {
nonce: env30019[1],
forQRCode: false
});
if (await Linking.canOpenURL(env30019[2])) {
trackVoiceCallTransfer(env30019[0].id, PlatformTypes.XBOX);
waitForSession(PlatformTypes.XBOX, env30019[0].id, env30019[1]);
stopOwnStream(false);
Linking.openURL(env30019[2]);
break L18;
}
return AlertActionCreators.openLazy({
importer: $mk115399(env5920)
});
}
};
@@ -0,0 +1,16 @@
// Metro module 15996 (f15997).
import { useState, useEffect } from "react";
export default function useShouldDisplayCancelConsoleTransfer(a0) {
const [state, setState] = useState(() => a0 != null && Date.now() - a0.startedAt > 6000);
useEffect(() => {
const r1 = a0 != null && Date.now() - a0.startedAt > 6000;
setState(r1);
if (a0 != null && !r1) {
let c28204_0 = setTimeout(() => setState(a0 != null && Date.now() - a0.startedAt > 6000), 6000 - (Date.now() - a0.startedAt));
return () => {
clearTimeout(c28204_0);
};
}
}, [a0]);
return state;
};
@@ -0,0 +1,22 @@
// Metro module 9045 (f9046).
import ChannelStore from "../../stores/ChannelStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SessionsStore from "../../stores/SessionsStore";
import { AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export default function trackVoiceCallTransfer(a0, a1, a2) {
const VOICE_CALL_TRANSFER = AnalyticEvents.VOICE_CALL_TRANSFER;
const r2 = a2 != null;
let source_platform = "discord_client";
if (r2) {
const sessionById = SessionsStore.getSessionById(a2);
source_platform = sessionById == null ? void 0 : sessionById.clientInfo.os;
}
AnalyticsUtils.track(VOICE_CALL_TRANSFER, {
source_platform,
guild_id: ChannelStore.getChannel(a0)?.guild_id,
channel_id: a0,
rtc_connection_id: RTCConnectionStore.getRTCConnectionId(),
target_platform: a1
});
};
@@ -0,0 +1,22 @@
// Metro module 15949 (f15950).
import ConnectedAccountsStore from "../../stores/ConnectedAccountsStore";
import SelfPresenceStore from "../../stores/SelfPresenceStore";
import GameConsoleStore from "./GameConsoleStore";
import { CONSOLE_VOICE_PLATFORMS } from "./GameConsoleConstants";
import { ActivityTypes } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
import activityPlatformToConnectedAccountType from "./activityPlatformToConnectedAccountType";
export default function useConsoleConnectedAccountForVoiceUpsell() {
let c22637_0;
const r17 = useStateFromStores([SelfPresenceStore], () => SelfPresenceStore.getActivities(true)).filter(({ type, platform: platform2 }) => type === ActivityTypes.PLAYING && platform2 != null && CONSOLE_VOICE_PLATFORMS.has(platform2));
c22637_0 = r17;
const stateFromStores = useStateFromStores([GameConsoleStore], () => GameConsoleStore.getAwaitingRemoteSessionInfo() != null || GameConsoleStore.getRemoteSessionId() != null);
const stateFromStores2 = useStateFromStores([ConnectedAccountsStore], () => c22637_0.map(({ platform: platform2 }) => {
if (platform2 == null) {
return null;
}
const r9 = activityPlatformToConnectedAccountType(platform2);
return r9 == null ? null : ConnectedAccountsStore.getAccount(null, r9);
}).find((item) => item != null));
return r17.length > 0 ? stateFromStores2 != null ? stateFromStores ? null : stateFromStores2 : null : null;
};
@@ -0,0 +1,8 @@
// Metro module 8928 (f8929).
import ConnectedAccountsStore from "../../stores/ConnectedAccountsStore";
import { PlatformTypes } from "../../Constants";
import { useStateFromStoresArray } from "../../_bundle/Module589";
import { isNotNullish } from "../../utils/GlobalUtils";
export default function useGameConsoleAccounts() {
return useStateFromStoresArray([ConnectedAccountsStore], () => [ConnectedAccountsStore.getAccount(null, PlatformTypes.XBOX), ConnectedAccountsStore.getAccount(null, PlatformTypes.PLAYSTATION), ConnectedAccountsStore.getAccount(null, PlatformTypes.PLAYSTATION_STAGING)].filter(isNotNullish));
};