Skip to content

Commit

Permalink
fix: fixed the blurr issue in chat on join and accept group (#1305)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 authored May 29, 2024
1 parent 794666e commit b295043
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,16 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis

// Change listtype to 'CHATS' and hidden to false when chatAcceptStream is received
useEffect(() => {
if (Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) {
if (
(Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) ||
(Object.keys(participantJoinStream || {}).length > 0 && participantJoinStream.constructor === Object)
) {
// Always change hidden to false and list will be CHATS
const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) };
if (updatedChatInfo) updatedChatInfo.list = 'CHATS';
if (updatedChatInfo) {
updatedChatInfo.list = 'CHATS';
if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = true;
}

// set initialized after chat accept animation is done
const timer = setTimeout(() => {
Expand All @@ -300,10 +306,16 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis

// Change listtype to 'UINITIALIZED' and hidden to true when participantRemoveStream or participantLeaveStream is received
useEffect(() => {
if (Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) {
if (
(Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) ||
(Object.keys(participantLeaveStream || {}).length > 0 && participantLeaveStream.constructor === Object)
) {
// If not encrypted, then set hidden to false
const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) };
if (updatedChatInfo) updatedChatInfo.list = 'UNINITIALIZED';
if (updatedChatInfo) {
updatedChatInfo.list = 'UNINITIALIZED';
if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = false;
}

setInitialized({ ...initialized, chatInfo: updatedChatInfo, isHidden: true });
}
Expand Down Expand Up @@ -515,8 +527,9 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
flexDirection="column"
justifyContent="start"
width="100%"
ref={chatContainerRef}
blur={initialized.isHidden}
ref={chatContainerRef}
blur={initialized.isHidden && initialized?.chatInfo?.list !== 'REQUESTS'}

>
{messages &&
messages?.map((chat: IMessageIPFS, index: number) => {
Expand Down

0 comments on commit b295043

Please sign in to comment.