Files
discord-decomp/modules/video_calls/native/useOnConnectToConsole.tsx
T
2026-11-01 12:12:55 +02:00

44 lines
1.9 KiB
TypeScript

// Metro module 8930 (f8931).
import { useCallback } from "react";
import { AnalyticsLocations, PlatformTypes } from "../../../Constants";
import { UNSAFE_markDismissibleContentAsDismissed } from "../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../_bundle/Module1358";
import XboxLinkModalActionCreators from "../../user_settings/connections/native/two_way_link/xbox/XboxLinkModalActionCreators";
import PlayStationLinkModalActionCreators from "../../user_settings/connections/native/two_way_link/playstation/PlayStationLinkModalActionCreators";
import { beginConsoleTransfer } from "../../game_console/native/beginConsoleTransfer";
export function onConnectToConsole(a0, a1) {
UNSAFE_markDismissibleContentAsDismissed(DismissibleContent.DONUT_MOBILE_NUX);
if (a1.twoWayLink && !a1.revoked) {
beginConsoleTransfer(a0, a1.type);
return void 0;
}
const type = a1.type;
if (PlatformTypes.XBOX === type) {
return XboxLinkModalActionCreators.showModal([AnalyticsLocations.CHANNEL_CALL]);
}
if (PlatformTypes.PLAYSTATION !== type && PlatformTypes.PLAYSTATION_STAGING !== type) {
return void 0;
}
return PlayStationLinkModalActionCreators.showModal([AnalyticsLocations.CHANNEL_CALL], a1.type);
}
export function useOnConnectToConsole(a0, a1) {
return useCallback(() => {
L8: {
UNSAFE_markDismissibleContentAsDismissed(DismissibleContent.DONUT_MOBILE_NUX);
if (a1.twoWayLink && !a1.revoked) {
beginConsoleTransfer(a0, a1.type);
} else {
const type = a1.type;
if (PlatformTypes.XBOX === type) {
XboxLinkModalActionCreators.showModal([AnalyticsLocations.CHANNEL_CALL]);
} else {
if (PlatformTypes.PLAYSTATION !== type && PlatformTypes.PLAYSTATION_STAGING !== type) {
break L8;
}
PlayStationLinkModalActionCreators.showModal([AnalyticsLocations.CHANNEL_CALL], a1.type);
}
}
}
}, [a0, a1]);
}