diff --git a/app/containers/message/Attachments.tsx b/app/containers/message/Attachments.tsx index 6c6a6cb6a..1203c55af 100644 --- a/app/containers/message/Attachments.tsx +++ b/app/containers/message/Attachments.tsx @@ -13,6 +13,15 @@ import MessageContext from './Context'; import { useTheme } from '../../theme'; import { IAttachment } from '../../definitions'; import CollapsibleQuote from './Components/CollapsibleQuote'; +import openLink from '../../utils/openLink'; +import { themes } from '../../constants/colors'; + +export type TElement = { + type: string; + msg?: string; + url?: string; + text: string; +}; const AttachedActions = ({ attachment }: IMessageAttachedActions) => { if (!attachment.actions) { @@ -21,15 +30,26 @@ const AttachedActions = ({ attachment }: IMessageAttachedActions) => { const { onAnswerButtonPress } = useContext(MessageContext); const { theme } = useTheme(); - const attachedButtons = attachment.actions.map((element: { type: string; msg: string; text: string }) => { + const attachedButtons = attachment.actions.map((element: TElement) => { + const onPress = () => { + if (element.msg) { + onAnswerButtonPress(element.msg); + } + + if (element.url) { + openLink(element.url); + } + }; + if (element.type === 'button') { - return