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

128 lines
4.4 KiB
TypeScript

// Metro module 16033 (f16034).
import StreamRTCConnectionStore from "../../../stores/StreamRTCConnectionStore";
import { AnalyticsPages, InstantInviteSources, RPC_APPLICATION_LOGGING_CATEGORY, UserSettingsSections } from "../../../Constants";
import { intl, t } from "../../../intl/index.native";
import Module16034 from "../../../_bundle/Module16034";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import ChannelRTCActionCreators from "../../../actions/ChannelRTCActionCreators";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import Module16035 from "../../../_bundle/Module16035";
import { encodeStreamKey } from "../../go_live/utils/StreamKeyUtils";
import { showInstantInviteActionSheet } from "../../instant_invite/native/InstantInviteUtils";
import { navigateToNewGroupDM } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import Module10795 from "../../../_bundle/Module10795";
import Module7690 from "../../../_bundle/Module7690";
import { stringify } from "../../debug/LogAggregator";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { showShareActionSheet } from "../../action_sheet/native/showShareActionSheet";
export function voiceSettings() {
return {
label: intl.string(t.NiTd0e),
icon: Module16034,
onPress: () => {
openUserSettings({
screen: UserSettingsSections.VOICE
});
ActionSheetActionCreators.hideActionSheet();
}
};
}
export function videoParticipantsHidden(c22741_0, a1) {
return {
label: intl.string(t.hoZYAA),
switchValue: !a1,
onPress: () => {
ChannelRTCActionCreators.toggleVoiceParticipantsHidden(c22741_0.id, !a1);
}
};
}
export function openHideSelfStreamAndVideoConfirmDialog(type, onConfirm) {
AlertActionCreators.openLazy({
importer: () => import("./components/HideSelfStreamAndVideoConfirmDialog").then(({ default: Component }) => (a0) => <Component {...a0} type={type} onConfirm={onConfirm} />)
});
}
export function selfVideoHidden(a0, c22743_0) {
return {
label: intl.string(t.MH8ESU),
switchValue: !a0,
onPress: () => {
c22743_0();
}
};
}
export function reportStreamIssue(stream) {
return {
label: intl.string(t.KHGhHf),
icon: Module16035,
onPress: () => {
const r10 = encodeStreamKey(stream);
let r16 = StreamRTCConnectionStore.getVideoStats(r10);
if (r16 == null) {
r16 = {};
}
const analyticsData = {
media_session_id: StreamRTCConnectionStore.getMediaSessionId(r10),
rtc_connection_id: StreamRTCConnectionStore.getRtcConnectionId(r10),
stream_region: StreamRTCConnectionStore.getRegion(r10),
max_viewers: StreamRTCConnectionStore.getMaxViewers(r10),
...r16
};
ActionSheetActionCreators.openLazy(import("../../../components_native/calls/stream/StreamReportProblemActionSheet"), `StreamReportProblem${stream.ownerId}`, {
stream,
analyticsData
});
}
};
}
export function invite(a0, a1, a2) {
const stream2 = a1;
const targetApplicationId = a2;
let onPress2 = a1 != null ? () => showInstantInviteActionSheet(a0, {
source: InstantInviteSources.STREAM,
stream: stream2
}) : a2 != null ? () => showInstantInviteActionSheet(a0, {
source: InstantInviteSources.ACTIVITY_INVITE,
targetApplicationId
}) : () => showInstantInviteActionSheet(a0, {
source: InstantInviteSources.VOICE_CHANNEL
});
if (a0.isPrivate()) {
onPress2 = () => navigateToNewGroupDM(a0.id, AnalyticsPages.CHANNEL_CALL);
}
return {
label: intl.string(t.VINpSK),
icon: Module10795,
onPress: onPress2
};
}
export function rtcDebugPanel(c22746_0) {
return {
label: intl.string(t.X8bCMe),
icon: Module7690,
onPress: () => {
c22746_0();
ActionSheetActionCreators.hideActionSheet();
}
};
}
export function shareActivityLogs() {
return {
label: intl.string(t.iQzQs3),
icon: Module7690,
onPress: () => {
const message = stringify([RPC_APPLICATION_LOGGING_CATEGORY]);
if (message === "") {
ToastActionCreators.open({
key: "EMBEDDED_ACTIVITIES_SHARE_EMPTY_LOGS_ERROR_MESSAGE",
content: intl.string(t["i+9VWy"])
});
} else {
showShareActionSheet({
message
}, "Activity Logs");
}
}
};
}