From e46ee13b381355038653f881201bbf33f46a4cea Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Thu, 30 Apr 2020 17:05:59 -0300 Subject: [PATCH] [IMPROVEMENT] Message Touchable (#2082) * [FIX] Avatar touchable * [IMPROVEMENT] onLongPress on all Message Touchables * [IMPROVEMENT] User & baseUrl on MessageContext * [FIX] Context Access * [FIX] BaseURL * Fix User Co-authored-by: Diego Mello --- .../__snapshots__/Storyshots.test.js.snap | 7629 ++++++++--------- app/containers/Avatar.js | 10 +- app/containers/message/Attachments.js | 12 +- app/containers/message/Audio.js | 24 +- app/containers/message/Broadcast.js | 12 +- app/containers/message/CallButton.js | 2 +- app/containers/message/Content.js | 10 +- app/containers/message/Context.js | 4 + app/containers/message/Discussion.js | 11 +- app/containers/message/Emoji.js | 7 +- app/containers/message/Image.js | 10 +- app/containers/message/Message.js | 14 +- app/containers/message/MessageAvatar.js | 35 +- app/containers/message/MessageError.js | 9 +- app/containers/message/Reactions.js | 59 +- app/containers/message/Reply.js | 17 +- app/containers/message/Touchable.js | 25 + app/containers/message/Urls.js | 24 +- app/containers/message/User.js | 18 +- app/containers/message/Video.js | 11 +- app/containers/message/index.js | 120 +- app/views/RoomView/Header/RoomHeaderLeft.js | 1 - storybook/stories/Message.js | 38 +- 23 files changed, 3831 insertions(+), 4271 deletions(-) create mode 100644 app/containers/message/Context.js create mode 100644 app/containers/message/Touchable.js diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index b9950e32d..4338ff0f3 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -3666,7 +3666,7 @@ exports[`Storyshots Message list message 1`] = ` - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - - + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + - - - diego.mello - - + diego.mello + - + Diego Mello - Diego Mello - - @ - diego.mello - + @ + diego.mello - + - + Diego Mello - Diego Mello - - @ - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - + @ + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - Diego Mello - - + Diego Mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - rocket.cat - - + rocket.cat + - - - diego.mello - - + diego.mello + - - - rocket.cat - - + rocket.cat + - - - diego.mello - - + diego.mello + - - - rocket.cat - - + rocket.cat + - - - diego.mello - - + diego.mello + - - - rocket.cat - - + rocket.cat + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + - - - diego.mello - - + diego.mello + { const avatarStyle = { width: size, @@ -36,9 +37,9 @@ const Avatar = React.memo(({ if (onPress) { image = ( - + {image} - + ); } @@ -61,7 +62,6 @@ Avatar.propTypes = { children: PropTypes.object, userId: PropTypes.string, token: PropTypes.string, - theme: PropTypes.string, onPress: PropTypes.func }; diff --git a/app/containers/message/Attachments.js b/app/containers/message/Attachments.js index cf3f6106c..3d4ff48b4 100644 --- a/app/containers/message/Attachments.js +++ b/app/containers/message/Attachments.js @@ -8,7 +8,7 @@ import Video from './Video'; import Reply from './Reply'; const Attachments = React.memo(({ - attachments, timeFormat, user, baseUrl, showAttachment, getCustomEmoji, theme + attachments, timeFormat, showAttachment, getCustomEmoji, theme }) => { if (!attachments || attachments.length === 0) { return null; @@ -16,25 +16,23 @@ const Attachments = React.memo(({ return attachments.map((file, index) => { if (file.image_url) { - return ; + return ; } if (file.audio_url) { - return