Skip to content

Commit

Permalink
fix: fixed approve button
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 committed Dec 3, 2023
1 parent 5dbc943 commit 477e5c4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ChatViewComponentTest = () => {

<ChatView
onVerificationFail={() => console.log("BOIIII RETURNNNSSSSS")}
chatId='0x2B335905ab1C7574E7f15aF4C22cCBde000c47e0'
chatId='0xf8250D363BD1F25f52F10C21188fe82c68C049c4'

limit={10}
isConnected={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,19 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
}
})();
}, [account]);

useEffect(() => {
setMessages(undefined);
setConversationHash(undefined);
setChatFeed({} as IFeeds);
setMessages(undefined);


}, [chatId, account, pgpPrivateKey, env]);

//need to make a common method for fetching chatFeed to ruse in messageInput
useEffect(() => {
(async () => {
if (!account && !env) return;
const chat = await fetchChat({ chatId });
const chat = await fetchChat({ chatId:chatId });
if (Object.keys(chat || {}).length) {
setConversationHash(chat?.threadhash as string);
setChatFeed(chat as IFeeds);
Expand Down Expand Up @@ -128,6 +130,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
}
setLoading(false);
})();

}, [chatId, pgpPrivateKey, account, env]);

//moniters socket changes
Expand All @@ -136,17 +139,18 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
const updatedChatFeed = chatFeed;
updatedChatFeed.msg = messagesSinceLastConnection;
if (!Object.keys(messages || {}).length) {

setFilteredMessages([
messagesSinceLastConnection,
] as IMessageIPFSWithCID[]);

setConversationHash(messagesSinceLastConnection.cid);
} else {
const newChatViewList = appendUniqueMessages(
messages as Messagetype,
[messagesSinceLastConnection],
false
);

setFilteredMessages(newChatViewList as IMessageIPFSWithCID[]);
}
setChatStatusText('');
Expand Down Expand Up @@ -249,7 +253,6 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
} else {
threadHash = messages?.lastThreadHash;
}

if (
threadHash &&
((account && pgpPrivateKey&& chatFeed && !chatFeed?.groupInformation) ||
Expand All @@ -267,9 +270,9 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
chatHistory,
true
);

setFilteredMessages(newChatViewList as IMessageIPFSWithCID[]);
} else {

setFilteredMessages(chatHistory as IMessageIPFSWithCID[]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
import type { FileMessageContent, IGroup } from '../../../types';
import { GIFType, IChatTheme, MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE, MessageInputProps } from '../exportedTypes';
import { PUBLIC_GOOGLE_TOKEN, device } from '../../../config';
import { checkIfAccessVerifiedGroup, checkIfMember } from '../helpers';
import { checkIfAccessVerifiedGroup, checkIfMember, isValidETHAddress } from '../helpers';
import { InfoContainer } from '../reusables';

/**
Expand Down Expand Up @@ -153,6 +153,7 @@ export const MessageInput: React.FC<MessageInputProps> = ({
}, [account]);

useEffect(() => {
if (!isValidETHAddress(chatId)) {
const storedTimestampJSON = localStorage.getItem(chatId);

if (storedTimestampJSON) {
Expand All @@ -170,6 +171,7 @@ export const MessageInput: React.FC<MessageInputProps> = ({
setAccessControl(chatId, true);
}
}
}
}, [chatId, verified, isMember, account, env]);

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion packages/uiweb/src/lib/hooks/chat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './useChatData';
export * from './useChatProfile';
export * from './usePushChatSocket';
export * from './useFetchChat';
export * from './useFetchConversationHash';
export * from './usePushSendMessage';
export * from './useGetGroupByID';
export * from './useAccount';
Expand Down
38 changes: 0 additions & 38 deletions packages/uiweb/src/lib/hooks/chat/useFetchConversationHash.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './useFetchChats';
export * from './useFetchRequests';
export * from './useFetchHistoryMessages';
export * from './useFetchConversationHash';
export * from './useApproveChatRequest';
export * from './useFetchChat';
export * from './usePushSendMessage';
Expand Down

0 comments on commit 477e5c4

Please sign in to comment.