decord/source/modules/user_profile/native/UserProfileVoiceSettings.tsx

270 lines
11 KiB
TypeScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 11969
// Function ID: 92518
2026-07-20 16:05:17 +00:00
// Name: UserVoiceSettings
2026-07-27 11:26:19 +00:00
// Dependencies: [31, 27, 4579, 4178, 3759, 653, 482, 33, 4131, 8045, 566, 4315, 8843, 10710, 8770, 5509, 1212, 8801, 10737, 11970, 6575, 11972, 6580, 6673, 4127, 11650, 8858, 7575, 4099, 8828, 8824, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-27 11:26:19 +00:00
// Module 11969 (UserVoiceSettings)
2026-07-23 10:11:24 +00:00
import "set";
import { View } from "Form";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
import { VideoToggleState } from "ME";
import { Permissions } from "sum";
import jsxProd from "jsxProd";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
let closure_10;
let closure_9;
const require = arg1;
2026-07-20 16:05:17 +00:00
function UserVoiceSettings(user) {
let isLocalMute;
let isLocalVideoDisabled;
let localVolume;
let supportsDisableLocalVideo;
user = user.user;
const channel = user.channel;
const tmp = callback3();
2026-07-23 10:11:24 +00:00
let obj = user(trackUserProfileAction[9]);
trackUserProfileAction = obj.useUserProfileAnalyticsContext().trackUserProfileAction;
let obj1 = user(trackUserProfileAction[10]);
2026-07-20 16:05:17 +00:00
const items = [closure_5];
2026-07-23 10:11:24 +00:00
const stateFromStoresObject = obj1.useStateFromStoresObject(items, () => ({ localVolume: outer1_5.getLocalVolume(user.id), isLocalMute: outer1_5.isLocalMute(user.id), isLocalVideoDisabled: outer1_5.isLocalVideoDisabled(user.id), isLocalVideoAutoDisabled: outer1_5.isLocalVideoAutoDisabled(user.id), supportsDisableLocalVideo: outer1_5.supportsDisableLocalVideo() }));
2026-07-20 16:05:17 +00:00
({ isLocalMute, isLocalVideoDisabled } = stateFromStoresObject);
let isLocalVideoAutoDisabled = stateFromStoresObject.isLocalVideoAutoDisabled;
({ localVolume, supportsDisableLocalVideo } = stateFromStoresObject);
2026-07-23 10:11:24 +00:00
let obj2 = user(trackUserProfileAction[10]);
2026-07-20 16:05:17 +00:00
const items1 = [closure_6];
const stateFromStores = obj2.useStateFromStores(items1, () => {
let isPrivateResult = channel.isPrivate();
if (!isPrivateResult) {
2026-07-23 10:11:24 +00:00
isPrivateResult = outer1_6.can(outer1_8.SPEAK, channel);
2026-07-20 16:05:17 +00:00
}
return isPrivateResult;
});
2026-07-23 10:11:24 +00:00
let obj3 = user(trackUserProfileAction[10]);
const items2 = [isLocalVideoAutoDisabled];
2026-07-20 16:05:17 +00:00
const stateFromStores1 = obj3.useStateFromStores(items2, () => isLocalVideoAutoDisabled.isLocalSoundboardMuted(user.id));
2026-07-23 10:11:24 +00:00
let obj4 = user(trackUserProfileAction[12]);
2026-07-20 16:05:17 +00:00
obj = { channelId: channel.id };
const isSecureFramesUIEnabled = obj4.useIsSecureFramesUIEnabled(obj);
obj = {
style: tmp.volumeSlider,
value: localVolume,
onValueChange(volume) {
trackUserProfileAction({ action: "SET_VOLUME" });
channel(trackUserProfileAction[14]).setLocalVolume(user.id, volume);
}
};
2026-07-23 10:11:24 +00:00
const items3 = [callback(channel(trackUserProfileAction[13]), obj, "set-volume")];
2026-07-20 16:05:17 +00:00
let tmp7 = !stateFromStores;
if (!tmp7) {
let isGuildStageVoiceResult = channel.isGuildStageVoice();
if (isGuildStageVoiceResult) {
2026-07-23 10:11:24 +00:00
isGuildStageVoiceResult = tmp4 !== user(trackUserProfileAction[11]).RequestToSpeakStates.ON_STAGE;
2026-07-20 16:05:17 +00:00
}
tmp7 = isGuildStageVoiceResult;
}
if (tmp7) {
obj1 = {};
2026-07-23 10:11:24 +00:00
const intl2 = user(trackUserProfileAction[16]).intl;
2026-07-20 16:05:17 +00:00
const string2 = intl2.string;
2026-07-23 10:11:24 +00:00
const t2 = user(trackUserProfileAction[16]).t;
2026-07-20 16:05:17 +00:00
if (stateFromStores1) {
2026-07-23 10:11:24 +00:00
let string2Result = string2(t2["639hQT"]);
2026-07-20 16:05:17 +00:00
} else {
string2Result = string2(t2.LxhEuG);
}
obj1.label = string2Result;
if (stateFromStores1) {
let SoundboardIcon = tmp26(tmp27[19]).SoundboardSlashIcon;
} else {
SoundboardIcon = tmp26(tmp27[20]).SoundboardIcon;
}
obj1.icon = SoundboardIcon;
obj1.onPress = function onPress() {
trackUserProfileAction({ action: "MUTE_SOUNDBOARD" });
const result = channel(trackUserProfileAction[14]).toggleLocalSoundboardMute(user.id);
};
2026-07-23 10:11:24 +00:00
items3.push(callback(user(trackUserProfileAction[15]).UserProfileFormRow, obj1, "mute-soundboard"));
2026-07-20 16:05:17 +00:00
if (supportsDisableLocalVideo) {
obj2 = {};
2026-07-23 10:11:24 +00:00
const intl3 = user(trackUserProfileAction[16]).intl;
2026-07-20 16:05:17 +00:00
const string3 = intl3.string;
2026-07-23 10:11:24 +00:00
const t3 = user(trackUserProfileAction[16]).t;
2026-07-20 16:05:17 +00:00
if (isLocalVideoDisabled) {
2026-07-23 10:11:24 +00:00
let string3Result = string3(t3["xc+Psz"]);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
string3Result = string3(t3["4MMsWF"]);
2026-07-20 16:05:17 +00:00
}
obj2.label = string3Result;
if (isLocalVideoDisabled) {
let VideoIcon = tmp35(tmp36[21]).VideoSlashIcon;
} else {
VideoIcon = tmp35(tmp36[22]).VideoIcon;
}
obj2.icon = VideoIcon;
if (isLocalVideoAutoDisabled) {
obj3 = { style: tmp.disableVideoSublabel };
2026-07-23 10:11:24 +00:00
const items4 = [callback(user(trackUserProfileAction[23]).CircleErrorIcon, { size: "xxs", color: "text-feedback-warning" }), ];
obj4 = { variant: "text-xs/medium", color: "text-feedback-warning" };
const intl4 = user(trackUserProfileAction[16]).intl;
obj4.children = intl4.string(user(trackUserProfileAction[16]).t.m2Hyj0);
items4[1] = callback(user(trackUserProfileAction[24]).Text, obj4);
2026-07-20 16:05:17 +00:00
obj3.children = items4;
2026-07-23 10:11:24 +00:00
isLocalVideoAutoDisabled = callback2(isLocalVideoDisabled, obj3);
2026-07-20 16:05:17 +00:00
}
obj2.sublabel = isLocalVideoAutoDisabled;
obj2.onPress = function onPress() {
trackUserProfileAction({ action: "DISABLE_VIDEO" });
if (isLocalVideoAutoDisabled) {
2026-07-23 10:11:24 +00:00
const result = user(trackUserProfileAction[25]).confirmVideoUnstableConnection(() => channel(trackUserProfileAction[14]).setDisableLocalVideo(outer1_0.id, outer2_7.MANUAL_ENABLED));
2026-07-20 16:05:17 +00:00
const obj2 = user(trackUserProfileAction[25]);
} else {
2026-07-23 10:11:24 +00:00
channel(trackUserProfileAction[14]).setDisableLocalVideo(user.id, isLocalVideoDisabled ? outer1_7.MANUAL_ENABLED : outer1_7.DISABLED);
2026-07-20 16:05:17 +00:00
const obj = channel(trackUserProfileAction[14]);
}
};
2026-07-23 10:11:24 +00:00
items3.push(callback(user(trackUserProfileAction[15]).UserProfileFormRow, obj2, "disable-video"));
2026-07-20 16:05:17 +00:00
const tmp29 = callback;
}
if (isSecureFramesUIEnabled) {
const obj5 = {};
2026-07-23 10:11:24 +00:00
const intl5 = user(trackUserProfileAction[16]).intl;
obj5.label = intl5.string(user(trackUserProfileAction[16]).t["8ErYvY"]);
obj5.icon = user(trackUserProfileAction[26]).ShieldLockIcon;
obj5.hint = user(trackUserProfileAction[27]).FormArrow;
2026-07-20 16:05:17 +00:00
obj5.onPress = function onPress() {
trackUserProfileAction({ action: "VIEW_SECURE_FRAMES_VERIFICATION_CODE" });
channel(trackUserProfileAction[28]).hideActionSheet();
2026-07-23 10:11:24 +00:00
let obj = channel(trackUserProfileAction[28]);
2026-07-20 16:05:17 +00:00
const result = channel(trackUserProfileAction[29]).openSecureFramesUserVerificationModal(user.id, channel.id, () => {
2026-07-23 10:11:24 +00:00
let obj = user(trackUserProfileAction[30]);
obj = { userId: outer1_0.id, channelId: outer1_1.id, guildId: outer1_1.guild_id };
2026-07-20 16:05:17 +00:00
return obj.validateSecureFramesKeyConsistent(obj);
});
};
2026-07-23 10:11:24 +00:00
items3.push(callback(user(trackUserProfileAction[15]).UserProfileFormRow, obj5, "view-secure-frames-verification-code"));
2026-07-20 16:05:17 +00:00
}
let tmp48 = null;
if (0 !== items3.length) {
const obj6 = {};
const items5 = [tmp.card, user.style];
obj6.style = items5;
2026-07-23 10:11:24 +00:00
const intl6 = user(trackUserProfileAction[16]).intl;
obj6.title = intl6.string(user(trackUserProfileAction[16]).t.NiTd0e);
2026-07-20 16:05:17 +00:00
obj6.titleStyle = tmp.cardTitle;
const obj7 = { children: items3 };
2026-07-23 10:11:24 +00:00
obj6.children = callback(user(trackUserProfileAction[15]).UserProfileCardRows, obj7);
tmp48 = callback(channel(trackUserProfileAction[15]), obj6);
const tmp52 = channel(trackUserProfileAction[15]);
2026-07-20 16:05:17 +00:00
}
return tmp48;
} else {
const obj8 = {};
2026-07-23 10:11:24 +00:00
const intl = user(trackUserProfileAction[16]).intl;
2026-07-20 16:05:17 +00:00
const string = intl.string;
2026-07-23 10:11:24 +00:00
const t = user(trackUserProfileAction[16]).t;
2026-07-20 16:05:17 +00:00
if (isLocalMute) {
let stringResult = string(t.NHJxcg);
} else {
stringResult = string(t.sWmtI6);
}
obj8.label = stringResult;
if (isLocalMute) {
let MicrophoneIcon = tmp17(tmp18[17]).MicrophoneSlashIcon;
} else {
MicrophoneIcon = tmp17(tmp18[18]).MicrophoneIcon;
}
obj8.icon = MicrophoneIcon;
obj8.onPress = function onPress() {
trackUserProfileAction({ action: "MUTE" });
channel(trackUserProfileAction[14]).toggleLocalMute(user.id);
};
2026-07-23 10:11:24 +00:00
items3.push(callback(user(trackUserProfileAction[15]).UserProfileFormRow, obj8, "mute"));
2026-07-20 16:05:17 +00:00
const tmp11 = callback;
}
}
function CurrentUserVoiceSettings(channel) {
let style;
let user;
channel = channel.channel;
({ user, style } = channel);
const tmp = callback3();
2026-07-25 08:10:48 +00:00
let obj = channel(8045);
2026-07-23 10:11:24 +00:00
const trackUserProfileAction = obj.useUserProfileAnalyticsContext().trackUserProfileAction;
let obj1 = channel(566);
2026-07-20 16:05:17 +00:00
const items = [closure_5];
2026-07-23 10:11:24 +00:00
const stateFromStores = obj1.useStateFromStores(items, () => outer1_5.isSelfMute());
2026-07-20 16:05:17 +00:00
const items1 = [closure_6];
2026-07-23 10:11:24 +00:00
const stateFromStores1 = channel(566).useStateFromStores(items1, () => {
2026-07-20 16:05:17 +00:00
let isPrivateResult = channel.isPrivate();
if (!isPrivateResult) {
2026-07-23 10:11:24 +00:00
isPrivateResult = outer1_6.can(outer1_8.SPEAK, channel);
2026-07-20 16:05:17 +00:00
}
return isPrivateResult;
});
let tmp5 = null;
if (stateFromStores1) {
if (channel.isGuildStageVoice()) {
tmp5 = null;
}
obj = {};
const items2 = [tmp.card, style];
obj.style = items2;
2026-07-23 10:11:24 +00:00
const intl = channel(1212).intl;
obj.title = intl.string(channel(1212).t.NiTd0e);
2026-07-20 16:05:17 +00:00
obj.titleStyle = tmp.cardTitle;
obj = {};
obj1 = {};
2026-07-23 10:11:24 +00:00
const intl2 = channel(1212).intl;
2026-07-20 16:05:17 +00:00
const string = intl2.string;
2026-07-23 10:11:24 +00:00
const t = channel(1212).t;
2026-07-20 16:05:17 +00:00
if (stateFromStores) {
let stringResult = string(t.NHJxcg);
} else {
stringResult = string(t.sWmtI6);
}
obj1.label = stringResult;
if (stateFromStores) {
2026-07-25 08:10:48 +00:00
let MicrophoneIcon = tmp18(8801).MicrophoneSlashIcon;
2026-07-20 16:05:17 +00:00
} else {
2026-07-27 11:26:19 +00:00
MicrophoneIcon = tmp18(10737).MicrophoneIcon;
2026-07-20 16:05:17 +00:00
}
obj1.icon = MicrophoneIcon;
obj1.onPress = function onPress() {
trackUserProfileAction({ action: "MUTE" });
2026-07-23 10:11:24 +00:00
trackUserProfileAction(outer1_2[14]).toggleSelfMute();
2026-07-20 16:05:17 +00:00
};
2026-07-24 07:16:23 +00:00
obj.children = closure_9(channel(5509).UserProfileFormRow, obj1, "mute");
obj = closure_9(channel(5509).UserProfileCardRows, obj);
2026-07-20 16:05:17 +00:00
obj.children = obj;
2026-07-24 07:16:23 +00:00
closure_9(trackUserProfileAction(5509), obj);
const tmp11 = trackUserProfileAction(5509);
2026-07-20 16:05:17 +00:00
const tmp13 = closure_9;
const tmp14 = closure_9;
const tmp8 = closure_9;
}
return tmp5;
}
2026-07-23 10:11:24 +00:00
({ jsx: closure_9, jsxs: closure_10 } = jsxProd);
let closure_11 = _createForOfIteratorHelperLoose.createStyles({ card: { paddingBottom: 0 }, cardTitle: { marginBottom: 0 }, volumeSlider: { paddingVertical: 20 }, disableVideoSublabel: { flexDirection: "row", alignItems: "center", gap: 4 } });
let result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/user_profile/native/UserProfileVoiceSettings.tsx");
2026-07-20 16:05:17 +00:00
export default function UserProfileVoiceSettings(arg0) {
let channel;
let currentUser;
let style;
let user;
({ user, currentUser, channel, style } = arg0);
if (user.id === currentUser.id) {
let obj = { user: currentUser, channel, style };
let tmp3 = callback(CurrentUserVoiceSettings, obj);
} else {
obj = { user, channel, style };
tmp3 = callback(UserVoiceSettings, obj);
}
return tmp3;
};