(wip): migrate ttp to mtp -> snake case to pascal case
This commit is contained in:
parent
ee5955fc75
commit
7f75a36d73
23 changed files with 214 additions and 248 deletions
|
|
@ -61,15 +61,15 @@ export default function InviteButton({
|
|||
>
|
||||
{contacts.map((contact) => (
|
||||
<Wrapper
|
||||
key={contact.user_id}
|
||||
userId={contact.user_id}
|
||||
key={contact.UserId}
|
||||
userId={contact.UserId}
|
||||
loading={<div>Loading...</div>}
|
||||
component={(user) => (
|
||||
<Button
|
||||
className="w-full justify-start"
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
void sendCallInvite(contact.user_id).catch((err) => {
|
||||
void sendCallInvite(contact.UserId).catch((err) => {
|
||||
toast(
|
||||
"error",
|
||||
"Failed to send call invite. Check console for details.",
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ function Overlay({
|
|||
user: User;
|
||||
participant: Participant;
|
||||
}) {
|
||||
const isAdmin = getRoomMetadata()?.admins.includes(user.user_id) === true;
|
||||
const isAdmin = getRoomMetadata()?.admins.includes(user.UserId) === true;
|
||||
const isDeafened = participant.attributes["deafened"] === "true";
|
||||
|
||||
return (
|
||||
|
|
@ -171,7 +171,7 @@ export default function Base({
|
|||
const [avatarBackgroundColor, setAvatarBackgroundColor] = useState<
|
||||
string | undefined
|
||||
>(undefined);
|
||||
const isSpeaking = useIsSpeaking(user?.user_id ?? -1);
|
||||
const isSpeaking = useIsSpeaking(user?.UserId ?? -1);
|
||||
const screenSharePublication = getTrackPublicationBySource(
|
||||
participant,
|
||||
Track.Source.ScreenShare,
|
||||
|
|
@ -242,12 +242,12 @@ export default function Base({
|
|||
|
||||
const onClick = () => {
|
||||
if (view === "grid") {
|
||||
focusParticipant(user.user_id, type);
|
||||
focusParticipant(user.UserId, type);
|
||||
} else {
|
||||
if (user.user_id === focusedParticipantId) {
|
||||
if (user.UserId === focusedParticipantId) {
|
||||
setCallView("grid");
|
||||
} else {
|
||||
focusParticipant(user.user_id, type);
|
||||
focusParticipant(user.UserId, type);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -256,7 +256,7 @@ export default function Base({
|
|||
screenSharePublication?.isSubscribed && screenSharePublication.track;
|
||||
|
||||
const isFocusedInFocusedView =
|
||||
view === "focused" && user.user_id === focusedParticipantId;
|
||||
view === "focused" && user.UserId === focusedParticipantId;
|
||||
|
||||
return (
|
||||
<UIContextMenu>
|
||||
|
|
@ -276,7 +276,7 @@ export default function Base({
|
|||
variant="outline"
|
||||
onClick={(event) => {
|
||||
if (isFocusedInFocusedView) event.stopPropagation();
|
||||
startWatchingStream(user.user_id);
|
||||
startWatchingStream(user.UserId);
|
||||
}}
|
||||
>
|
||||
Watch Stream
|
||||
|
|
@ -286,7 +286,7 @@ export default function Base({
|
|||
variant="outline"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
startWatchingStream(user.user_id);
|
||||
startWatchingStream(user.UserId);
|
||||
}}
|
||||
>
|
||||
<Plus className="w-8 h-8" />
|
||||
|
|
@ -295,8 +295,7 @@ export default function Base({
|
|||
</div>
|
||||
)}
|
||||
{view === "grid" ||
|
||||
(view === "focused" &&
|
||||
user.user_id !== focusedParticipantId) ? (
|
||||
(view === "focused" && user.UserId !== focusedParticipantId) ? (
|
||||
<Overlay type={type} user={user} participant={participant} />
|
||||
) : null}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ export default function ContextMenu({
|
|||
|
||||
return (
|
||||
<ContextMenuContent className="p-1">
|
||||
{watchedStreamParticipantIds.includes(user.user_id) &&
|
||||
user.user_id !== ownId ? (
|
||||
{watchedStreamParticipantIds.includes(user.UserId) &&
|
||||
user.UserId !== ownId ? (
|
||||
<ContextMenuItem variant="destructive">Stop Watching</ContextMenuItem>
|
||||
) : null}
|
||||
<ContextMenuItem>Profile</ContextMenuItem>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export default function TopBar() {
|
|||
<div className="w-full flex justify-between h-12">
|
||||
<div className="flex gap-1 m-3 ml-7">
|
||||
{users.map((user) => (
|
||||
<div key={user.user_id} className="-ml-4">
|
||||
<div key={user.UserId} className="-ml-4">
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ type GetSharedSecretFn = (
|
|||
type DecryptTextFn = (sharedSecret: string, text: string) => Promise<string>;
|
||||
type EncryptTextFn = (sharedSecret: string, text: string) => Promise<string>;
|
||||
type LoadFn = (key: string) => Promise<unknown>;
|
||||
type GetUserFn = (userId: number) => Promise<{ public_key: string }>;
|
||||
type GetUserFn = (userId: number) => Promise<{ PublicKey: string }>;
|
||||
type RemoteVideoTrackSelector = Track.Kind | Track.Source;
|
||||
|
||||
type Runtime = {
|
||||
|
|
@ -605,15 +605,15 @@ export async function openCallPage(callId: string) {
|
|||
export async function getCallToken(callId: string): Promise<string> {
|
||||
const response = await requireRuntime(useCall.getState().runtime)
|
||||
.send("call_token", {
|
||||
call_id: callId,
|
||||
CallId: callId,
|
||||
})
|
||||
.catch((err) => {
|
||||
log(1, "call", "red", "Failed to get call secret", err);
|
||||
throw err;
|
||||
});
|
||||
|
||||
const data = response.data as { call_token: string };
|
||||
return data.call_token;
|
||||
const data = response.data as { CallToken: string };
|
||||
return data.CallToken;
|
||||
}
|
||||
|
||||
// Encrypt the active call secret for a recipient and send the call invite.
|
||||
|
|
@ -629,10 +629,10 @@ export async function sendCallInvite(userId: number) {
|
|||
const privateKey = await runtime.load("private_key");
|
||||
const ownPublicKey = await runtime
|
||||
.getUser(ownUserId)
|
||||
.then((data) => data.public_key);
|
||||
.then((data) => data.PublicKey);
|
||||
const remotePublicKey = await runtime
|
||||
.getUser(userId)
|
||||
.then((data) => data.public_key);
|
||||
.then((data) => data.PublicKey);
|
||||
const sharedSecret = await runtime.getSharedSecret(
|
||||
privateKey,
|
||||
ownPublicKey,
|
||||
|
|
@ -644,9 +644,9 @@ export async function sendCallInvite(userId: number) {
|
|||
);
|
||||
|
||||
await runtime.send("call_invite", {
|
||||
receiver_id: userId,
|
||||
call_id: callId,
|
||||
call_secret: encryptedCallSecret,
|
||||
ReceiverId: userId,
|
||||
CallId: callId,
|
||||
CallSecret: encryptedCallSecret,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -900,8 +900,8 @@ export async function joinCall(
|
|||
await runtime.load("private_key"),
|
||||
await runtime
|
||||
.getUser((await runtime.load("user_id")) as number)
|
||||
.then((res) => res.public_key),
|
||||
await runtime.getUser(userId).then((res) => res.public_key),
|
||||
.then((res) => res.PublicKey),
|
||||
await runtime.getUser(userId).then((res) => res.PublicKey),
|
||||
);
|
||||
const decryptedSecret = await runtime.decryptText(
|
||||
sharedSecret,
|
||||
|
|
@ -1150,9 +1150,9 @@ export function useInitializeCall() {
|
|||
}
|
||||
|
||||
insertCall({
|
||||
call_id: invite.callId,
|
||||
call_secret: invite.callSecret,
|
||||
call_members: [invite.senderId],
|
||||
CallId: invite.callId,
|
||||
CallSecret: invite.callSecret,
|
||||
CallMembers: [invite.senderId],
|
||||
});
|
||||
|
||||
if (accepted) {
|
||||
|
|
@ -1180,13 +1180,13 @@ export function useInitializeCall() {
|
|||
subscribePush(async (message) => {
|
||||
if (message.type !== "call_invite") return;
|
||||
|
||||
const { call_id, call_secret, sender_id } = message.data as {
|
||||
call_id: string;
|
||||
call_secret: string;
|
||||
sender_id: number;
|
||||
const { CallId, CallSecret, SenderId } = message.data as {
|
||||
CallId: string;
|
||||
CallSecret: string;
|
||||
SenderId: number;
|
||||
};
|
||||
|
||||
showCallingScreen(call_id, call_secret, sender_id);
|
||||
showCallingScreen(CallId, CallSecret, SenderId);
|
||||
});
|
||||
}, [subscribePush, showCallingScreen]);
|
||||
|
||||
|
|
@ -1500,7 +1500,7 @@ export function useInitializeCall() {
|
|||
return;
|
||||
}
|
||||
|
||||
send("call_data", { call_id: callId })
|
||||
send("call_data", { CallId: callId })
|
||||
.then((data) => {
|
||||
setCurrentCallData({
|
||||
...(data.data as z.infer<typeof mtp.call_data.response>),
|
||||
|
|
@ -1513,7 +1513,7 @@ export function useInitializeCall() {
|
|||
error: err,
|
||||
});
|
||||
setCurrentCallData({
|
||||
user_ids: [],
|
||||
UserIds: [],
|
||||
exists: false,
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export default function Preview() {
|
|||
};
|
||||
}
|
||||
|
||||
void Promise.all(currentCallData.user_ids.map((id) => get(id)))
|
||||
void Promise.all(currentCallData.UserIds.map((id) => get(id)))
|
||||
.then((users) => {
|
||||
if (!active) {
|
||||
return;
|
||||
|
|
@ -44,7 +44,7 @@ export default function Preview() {
|
|||
<div className="flex flex-col gap-2">
|
||||
{data.map((user) => {
|
||||
return (
|
||||
<p key={user.user_id} className="text-2xl">
|
||||
<p key={user.UserId} className="text-2xl">
|
||||
User: {user.display}
|
||||
</p>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue