Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed the blurr issue in chat on join and accept group #1305

Merged
merged 2 commits into from
May 29, 2024
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
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 @@ -298,10 +304,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 @@ -513,8 +525,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
Loading