Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/hooks/useRoomActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface UserProfile {
}

interface CollaborationConfigParams {
provider_url: string;
providerUrl: string;
getUserProfile: () => Promise<{ data: UserProfile }>;
getUserAccessToken: () => Promise<{ data: string }>;
}
Expand Down Expand Up @@ -47,7 +47,7 @@ interface UserMapping {
}

interface UseRoomActivityParams {
provider_url?: string;
providerUrl?: string;
getUserProfile?: () => Promise<{ data: UserProfile }>;
getUserAccessToken?: () => Promise<{ data: string }>;
}
Expand Down Expand Up @@ -100,7 +100,7 @@ const getSignalingUrlFromProviderUrl = (providerUrl: string): string => {
* Gets collaboration configuration for WebRTC
*/
export const getCollaborationConfig = async ({
provider_url,
providerUrl,
getUserProfile,
getUserAccessToken
}: CollaborationConfigParams): Promise<CollaborationConfig> => {
Expand All @@ -116,7 +116,7 @@ export const getCollaborationConfig = async ({
};

return {
signalingUrl: [getSignalingUrlFromProviderUrl(provider_url)],
signalingUrl: [getSignalingUrlFromProviderUrl(providerUrl)],
user: userProfile,
authToken: accessToken,
refreshAuthToken: refreshToken,
Expand All @@ -135,18 +135,18 @@ export const getCollaborationConfig = async ({
const subscribeToRoomActivity = async (
wsRef: React.MutableRefObject<WebSocket | null>,
onUserMapChange: (userMap: UserMapping) => void,
provider_url: string,
providerUrl: string,
getUserProfile: () => Promise<{ data: UserProfile }>,
getUserAccessToken: () => Promise<{ data: string }>
): Promise<void> => {
if (!provider_url || !getUserProfile || !getUserAccessToken) {
if (!providerUrl || !getUserProfile || !getUserAccessToken) {
console.warn('Missing required parameters for subscription');
return;
}

try {
const config = await getCollaborationConfig({
provider_url,
providerUrl,
getUserProfile,
getUserAccessToken
});
Expand Down Expand Up @@ -187,7 +187,7 @@ const subscribeToRoomActivity = async (
*/
export const useRoomActivity = (
{
provider_url,
providerUrl,
getUserProfile,
getUserAccessToken
}: UseRoomActivityParams = {} as UseRoomActivityParams
Expand All @@ -197,11 +197,11 @@ export const useRoomActivity = (

useEffect(() => {
// -> all parameters check
if (provider_url && getUserProfile && getUserAccessToken) {
if (providerUrl && getUserProfile && getUserAccessToken) {
subscribeToRoomActivity(
wsRef,
setAllRoomsUserMapping,
provider_url,
providerUrl,
getUserProfile,
getUserAccessToken
);
Expand All @@ -215,7 +215,7 @@ export const useRoomActivity = (
ws.close();
}
};
}, [provider_url, getUserProfile, getUserAccessToken]);
}, [providerUrl, getUserProfile, getUserAccessToken]);

return [allRoomsUserMapping, wsRef];
};
Expand Down
Loading