From bb7bae18a4128ef30166914d0307ca5311fe5227 Mon Sep 17 00:00:00 2001 From: Rishab Kumar Jha Date: Tue, 17 Dec 2024 12:58:08 +0530 Subject: [PATCH 1/3] fix-member-list-update --- app/views/RoomMembersView/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/views/RoomMembersView/index.tsx b/app/views/RoomMembersView/index.tsx index 17d5e8b66a..e59b16ef6c 100644 --- a/app/views/RoomMembersView/index.tsx +++ b/app/views/RoomMembersView/index.tsx @@ -127,6 +127,14 @@ const RoomMembersView = (): React.ReactElement => { return () => subscription?.unsubscribe(); }, []); + useEffect(() => { + const unsubscribe = navigation.addListener('focus', () => { + const { allUsers } = state; + fetchMembers(allUsers); + }); + return unsubscribe; + }, [navigation]); + useEffect(() => { const fetchRoles = () => { if (isGroupChat(state.room)) { From ca94b9cb0de9d95c4df9c3238988f80d37171678 Mon Sep 17 00:00:00 2001 From: Rishab Kumar Jha Date: Wed, 18 Dec 2024 16:42:41 +0530 Subject: [PATCH 2/3] fixed-quote-attatchemnts --- .../components/Quotes/Quote.tsx | 88 +++++++++++++++---- 1 file changed, 73 insertions(+), 15 deletions(-) diff --git a/app/containers/MessageComposer/components/Quotes/Quote.tsx b/app/containers/MessageComposer/components/Quotes/Quote.tsx index 3e47b29928..84b645ad35 100644 --- a/app/containers/MessageComposer/components/Quotes/Quote.tsx +++ b/app/containers/MessageComposer/components/Quotes/Quote.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { View, Text, ScrollView } from 'react-native'; import moment from 'moment'; import { useTheme } from '../../../../theme'; @@ -8,7 +8,6 @@ import { useRoomContext } from '../../../../views/RoomView/context'; import { BaseButton } from '../Buttons'; import { useMessage } from '../../hooks'; import { useAppSelector } from '../../../../lib/hooks'; -import { MarkdownPreview } from '../../../markdown'; export const Quote = ({ messageId }: { messageId: string }) => { const [styles, colors] = useStyle(); @@ -19,11 +18,19 @@ export const Quote = ({ messageId }: { messageId: string }) => { let username = ''; let msg = ''; let time = ''; + let imgcnt = 0; + let audiocnt = 0; + let videocnt = 0; + let otherfilescnt = 0; if (message) { username = useRealName ? message.u?.name || message.u?.username || '' : message.u?.username || ''; - msg = message.msg || ''; + msg = message.msg || (message.attachments? message.attachments[0]?.description : '') || ''; time = message.ts ? moment(message.ts).format('LT') : ''; + imgcnt = message?.attachments?.filter((attachment) => attachment.image_type).length || 0; + audiocnt = message?.attachments?.filter((attachment) => attachment.audio_type).length || 0; + videocnt = message?.attachments?.filter((attachment) => attachment.video_type).length || 0; + otherfilescnt = message?.attachments?.length? message.attachments.length - imgcnt - audiocnt - videocnt : 0; } if (!message) { @@ -39,6 +46,7 @@ export const Quote = ({ messageId }: { messageId: string }) => { {time} + { testID={`composer-quote-remove-${message.id}`} /> - + + + {msg} + + + + {imgcnt > 0 && 📷 {imgcnt}} + {audiocnt > 0 && 🔊 {audiocnt}} + {videocnt > 0 && 🎥 {videocnt}} + {otherfilescnt > 0 && 📎 {otherfilescnt}} + ); }; @@ -56,23 +78,35 @@ function useStyle() { const { colors } = useTheme(); const style = { root: { - backgroundColor: colors.surfaceTint, - height: 64, + backgroundColor: colors.surfaceTint || '#1C1C1C', + minHeight: 89, + maxHeight: 120, width: 320, - borderColor: colors.strokeExtraLight, - borderLeftColor: colors.strokeMedium, + borderColor: colors.strokeExtraLight || '#2F2F2F', + borderLeftColor: colors.strokeMedium || '#404040', borderWidth: 1, borderTopRightRadius: 4, borderBottomRightRadius: 4, paddingLeft: 16, padding: 8, - marginRight: 8 + marginRight: 8, + flexDirection: 'column', + justifyContent: 'space-between' + }, + header: { + flexDirection: 'row', + alignItems: 'center', + marginBottom: 4, + minHeight: 24 + }, + title: { + flexDirection: 'row', + flex: 1, + alignItems: 'center' }, - header: { flexDirection: 'row', alignItems: 'center' }, - title: { flexDirection: 'row', flex: 1, alignItems: 'center' }, username: { ...sharedStyles.textBold, - color: colors.fontTitlesLabels, + color: colors.fontTitlesLabels || '#FFFFFF', fontSize: 14, lineHeight: 20, flexShrink: 1, @@ -80,16 +114,40 @@ function useStyle() { }, time: { ...sharedStyles.textRegular, - color: colors.fontAnnotation, + color: colors.fontAnnotation || '#9EA2A8', fontSize: 12, lineHeight: 16 }, + messageWrapper: { + flex: 1, + minHeight: 20, + marginVertical: 4 + }, + messageContainer: { + flex: 1 + }, + messageContentContainer: { + flexGrow: 1 + }, message: { ...sharedStyles.textRegular, - color: colors.fontDefault, + color: colors.fontDefault || '#FFFFFF', fontSize: 14, lineHeight: 20 + }, + attachmentBox: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'flex-start', + gap: 8, + minHeight: 20 + }, + attachmentText: { + ...sharedStyles.textRegular, + color: colors.fontDefault || '#FFFFFF', + fontSize: 12, + lineHeight: 16 } } as const; return [style, colors] as const; -} +} \ No newline at end of file From e3f3e42bb4219205aedc9862d4b037ddabd166a2 Mon Sep 17 00:00:00 2001 From: Rishab Kumar Jha Date: Wed, 18 Dec 2024 17:14:58 +0530 Subject: [PATCH 3/3] snapshot-fix --- .../MessageComposer.test.tsx.snap | 420 ++++++++++++------ 1 file changed, 275 insertions(+), 145 deletions(-) diff --git a/app/containers/MessageComposer/__snapshots__/MessageComposer.test.tsx.snap b/app/containers/MessageComposer/__snapshots__/MessageComposer.test.tsx.snap index e6e8b47ee2..77dab09785 100644 --- a/app/containers/MessageComposer/__snapshots__/MessageComposer.test.tsx.snap +++ b/app/containers/MessageComposer/__snapshots__/MessageComposer.test.tsx.snap @@ -494,8 +494,11 @@ exports[`MessageComposer Quote Add quote \`abc\` 1`] = ` "borderLeftColor": "#9EA2A8", "borderTopRightRadius": 4, "borderWidth": 1, - "height": 64, + "flexDirection": "column", + "justifyContent": "space-between", "marginRight": 8, + "maxHeight": 120, + "minHeight": 89, "padding": 8, "paddingLeft": 16, "width": 320, @@ -508,6 +511,8 @@ exports[`MessageComposer Quote Add quote \`abc\` 1`] = ` { "alignItems": "center", "flexDirection": "row", + "marginBottom": 4, + "minHeight": 24, } } > @@ -616,38 +621,59 @@ exports[`MessageComposer Quote Add quote \`abc\` 1`] = ` - + + + + Message abc + + + + + - Message abc - + /> @@ -914,8 +940,11 @@ exports[`MessageComposer Quote Add quote \`def\` 1`] = ` "borderLeftColor": "#9EA2A8", "borderTopRightRadius": 4, "borderWidth": 1, - "height": 64, + "flexDirection": "column", + "justifyContent": "space-between", "marginRight": 8, + "maxHeight": 120, + "minHeight": 89, "padding": 8, "paddingLeft": 16, "width": 320, @@ -928,6 +957,8 @@ exports[`MessageComposer Quote Add quote \`def\` 1`] = ` { "alignItems": "center", "flexDirection": "row", + "marginBottom": 4, + "minHeight": 24, } } > @@ -1036,38 +1067,59 @@ exports[`MessageComposer Quote Add quote \`def\` 1`] = ` - + + + + Message abc + + + + + - Message abc - + /> @@ -1213,38 +1270,59 @@ exports[`MessageComposer Quote Add quote \`def\` 1`] = ` - + + + + Message def + + + + + - Message def - + /> @@ -1511,8 +1589,11 @@ exports[`MessageComposer Quote Remove a quote 1`] = ` "borderLeftColor": "#9EA2A8", "borderTopRightRadius": 4, "borderWidth": 1, - "height": 64, + "flexDirection": "column", + "justifyContent": "space-between", "marginRight": 8, + "maxHeight": 120, + "minHeight": 89, "padding": 8, "paddingLeft": 16, "width": 320, @@ -1525,6 +1606,8 @@ exports[`MessageComposer Quote Remove a quote 1`] = ` { "alignItems": "center", "flexDirection": "row", + "marginBottom": 4, + "minHeight": 24, } } > @@ -1633,38 +1716,59 @@ exports[`MessageComposer Quote Remove a quote 1`] = ` - + + + + Message abc + + + + + - Message abc - + /> @@ -1810,38 +1919,59 @@ exports[`MessageComposer Quote Remove a quote 1`] = ` - + + + + Message def + + + + + - Message def - + />