Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useNavigation } from "@react-navigation/native";
import { StyleSheet } from "react-native";
import { CHATBOT_INITIATE_SCREEN, CHATROOM } from "../../constants/Screens";
import Layout from "../../constants/Layout";
import { getUniqueId } from "react-native-device-info";

interface LMChatAIButtonProps {
text?: string;
Expand Down Expand Up @@ -83,12 +84,14 @@ export default function LMChatAIButton({
callValidateApi(accessToken, refreshToken);
return;
}
const deviceID = await getUniqueId();
const payload: InitUserWithUuid = {
userName: userName,
apiKey: apiKey ? apiKey : "",
uuid: uuid ? uuid : "",
isGuest: false,
imageUrl: imageUrl ? imageUrl : "",
deviceId: deviceID,
};
const initiateResponse: any = await dispatch(initAPI(payload));
if (initiateResponse !== undefined && initiateResponse !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ const MessagesComponent = ({
setShowRetry,
setRetryUploadInProgress,
retryUploadInProgress,
failedMessageId
failedMessageId,
messageUploadInProgressId
} = useMessageContext();

const styles = STYLES?.$CHAT_BUBBLE_STYLE;

useEffect(() => {
let interval;
let isCurrentlyBeingUploaded = item?.id == messageUploadInProgressId;
let uploadFailed = item?.id == failedMessageId;

const checkMessageStatus = () => {
Expand All @@ -94,7 +96,7 @@ const MessagesComponent = ({
if (item?.attachments?.length > 0) {
const localTimestamp = Math.floor(Math.abs(parseInt(item?.attachmentUploadedEpoch)));

if ( (uploadFailed) || (currentTimeStampEpoch - localTimestamp > 30000 && ((item?.inProgress == undefined || item?.inProgress == null)) )) {
if ( (uploadFailed) || ( (!isCurrentlyBeingUploaded) && (currentTimeStampEpoch - localTimestamp > 30000 && ((item?.inProgress == undefined || item?.inProgress == null))) )) {
setShowRetry(true);

// Stop checking once the condition is met
Expand Down Expand Up @@ -127,7 +129,7 @@ const MessagesComponent = ({

// Cleanup interval when component unmounts
return () => clearInterval(interval);
}, [item, failedMessageId])
}, [item, failedMessageId, messageUploadInProgressId])


const { customReactionList }: CustomReactionList =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { isValidURI } from "../../shareUtils";
import { DeepLinkRequest, DeepLinkResponse } from "./models";
import { CHATROOM } from "../../constants/Screens";
import { Client } from "../../client";
import { getUniqueId } from "react-native-device-info";

// this function is to parse deep link url
export async function parseDeepLink(
Expand Down Expand Up @@ -34,11 +35,13 @@ export async function parseDeepLink(
const internalRoute = `route://collabcard?collabcard_id=${chatroomId}`;
const user: any = await Client.myClient.getUserFromLocalStorage();
// initiate API call
const deviceID = await getUniqueId();
const initiateUserRequest = {
userName: request?.userName,
uuid: request?.uuid,
isGuest: false,
apiKey: user?.apiKey,
deviceId: deviceID,
};
const initiateUserResponse = await Client.myClient?.initiateUser(
initiateUserRequest
Expand Down
Loading