Skip to content

Commit

Permalink
Merge pull request #1106 from ethereum-push-notification-service/medi…
Browse files Browse the repository at this point in the history
…a-emoji

fix: media emoji added
  • Loading branch information
HarshRajat authored Feb 9, 2024
2 parents d832ae3 + 49d6bfc commit 2b4fbce
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
37 changes: 35 additions & 2 deletions packages/uiweb/src/lib/components/chat/ChatPreview/ChatPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { formatAddress, formatDate } from '../helpers';
import { resolveNewEns, shortenText } from '../../../helpers';
import { CoreContractChainId, InfuraAPIKey } from '../../../config';
import { ethers } from 'ethers';

import { FaFile } from "react-icons/fa";
import { CiImageOn } from "react-icons/ci";
/**
* @interface IThemeProps
* this interface is used for defining the props for styled components
Expand Down Expand Up @@ -123,7 +124,39 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (
flex="1"
>
<Message theme={theme}>
{options?.chatPreviewPayload?.chatMsg?.messageContent}
{
(options?.chatPreviewPayload?.chatMsg?.messageType === "Image" || options?.chatPreviewPayload?.chatMsg?.messageType === "GIF" || options?.chatPreviewPayload?.chatMsg?.messageType === "MediaEmbed" )
?
(
<Section
justifyContent="flex-start"
flexDirection="row"
alignItems="center"
alignSelf="stretch"
overflow="hidden"
flex="1"
gap="4px"
>
<CiImageOn />
Media
</Section>
) : (options?.chatPreviewPayload?.chatMsg?.messageType === "File" ?
<Section
justifyContent="flex-start"
flexDirection="row"
alignItems="center"
alignSelf="stretch"
overflow="hidden"
flex="1"
gap="4px"
>
<FaFile/>
File
</Section>

: options?.chatPreviewPayload?.chatMsg?.messageContent )

}
</Message>
{!!options?.badge?.count && <Badge theme={theme}>{options.badge.count}</Badge>}
</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,11 @@ export const ChatPreviewList: React.FC<IChatPreviewListProps> = (
chatRequestStream.constructor === Object
) {
console.debug('Chat request stream', chatRequestStream);
if (options.listType === CONSTANTS.CHAT.LIST_TYPE.REQUESTS) {
if (options.listType === CONSTANTS.CHAT.LIST_TYPE.CHATS && chatRequestStream.origin === "self") {
console.debug('to transform stream')
transformStreamMessage(chatRequestStream);
}else if(options.listType === CONSTANTS.CHAT.LIST_TYPE.REQUESTS && chatRequestStream.origin === "other" ){
transformStreamMessage(chatRequestStream);
}
}
}, [chatRequestStream]);
Expand Down

0 comments on commit 2b4fbce

Please sign in to comment.