-
Notifications
You must be signed in to change notification settings - Fork 53
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
class based restapi migration for chat components #862
Conversation
return ( | ||
<Section justifyContent="start" alignItems="start"> | ||
{chat.fromCAIP10.split(':')[1] !== account && ( | ||
{(chat.fromDID || chat.fromDID).split(':')[1] !== account && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chat.fromDID || chat.fromDID
aren't these 2 the same? what's the point of OR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, thanks for pointing out will remove one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whereever you are checking
if(pushUser) use instead of pushUser use Object.keys(PushUser || {}).length
Because its an object.
Make a chat profile fetch hook
@@ -62,10 +63,10 @@ const SenderMessageProfilePicture = ({ chat }: { chat: IMessagePayload }) => { | |||
}; | |||
useEffect(() => { | |||
getUserPfp(); | |||
}, [account, chat.fromCAIP10]); | |||
}, [account, chat.fromDID]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets revert this back to .fromCAIP10, in this file
}); | ||
if (result) { | ||
newChatFeed = getDefaultFeedObject({ user: result }); | ||
console.log(signer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the console .log
}, [conversationHash, pgpPrivateKey, account, env,chatFeed]); | ||
// if (conversationHash) { | ||
(async function () { | ||
console.log('chatHistory', pushUser) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the console.log
threadHash, | ||
}); | ||
|
||
if (pushUser && chatId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did we change the condtion
Lets make it
if (
threadHash &&
((account && chatFeed && !chatFeed?.groupInformation) ||
(chatFeed && chatFeed?.groupInformation))
)
instead of
if (pushUser && chatId) {
return !!( | ||
chatFeed && | ||
chatFeed?.groupInformation && | ||
!chatFeed?.groupInformation?.isPublic && | ||
((!isMember && pgpPrivateKey) || (!pgpPrivateKey)) | ||
(!isMember) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for blurring out private chats, so if the user has not logged in yet we will show it as blurred to not show the decrypted chat. so the condition will be
(!isMember && pushUser)
if (!pushUser && signer) { | ||
console.log("userrr",user); | ||
if (user) { | ||
setPushUser(user); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this condition mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bff2e19#diff-09cd3b29295dd9aa7c4597a09653d6700b9bca9086110130257a85b6cf1e36a5
Follow this for chatDataProvider code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current code is not right
setConnectedProfile | ||
setConnectedProfile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove connectedProfile
(walletToPCAIP10(account!).toLowerCase() === | ||
msg.fromCAIP10?.toLowerCase()))) | ||
msg.fromDID?.toLowerCase()))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace fromDID to fromCAIP10
@@ -1,32 +1,41 @@ | |||
import * as PushAPI from '@pushprotocol/restapi'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this hook is for initialisation, then it should be names something else like useInitializePushUser()
} | ||
|
||
const useChatProfile = () => { | ||
const { env } = useChatData(); | ||
const fetchUserChatProfile = useCallback( | ||
const { signer, pushUser, setPushUser, setConnectedProfile, env } = useChatData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove setConnectedProfile
…om did with caip10
All looks good. |
No description provided.