From 425522a63e36cf79e9c9fab4c4a3804ead2caf38 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Mon, 7 Aug 2023 14:42:41 -0300 Subject: [PATCH] separate audio to a folder inside components and minor tweak attachment --- app/containers/message/Attachments.tsx | 6 +--- .../{Audio.tsx => Components/Audio/index.tsx} | 32 +++++++++---------- 2 files changed, 17 insertions(+), 21 deletions(-) rename app/containers/message/{Audio.tsx => Components/Audio/index.tsx} (89%) diff --git a/app/containers/message/Attachments.tsx b/app/containers/message/Attachments.tsx index 378225a54..289f923ad 100644 --- a/app/containers/message/Attachments.tsx +++ b/app/containers/message/Attachments.tsx @@ -3,12 +3,11 @@ import { dequal } from 'dequal'; import { IMessageAttachments } from './interfaces'; import Image from './Image'; -import Audio from './Audio'; +import Audio from './Components/Audio'; import Video from './Video'; import Reply from './Reply'; import Button from '../Button'; import MessageContext from './Context'; -import { useTheme } from '../../theme'; import { IAttachment, TGetCustomEmoji } from '../../definitions'; import CollapsibleQuote from './Components/CollapsibleQuote'; import openLink from '../../lib/methods/helpers/openLink'; @@ -55,8 +54,6 @@ const AttachedActions = ({ attachment, getCustomEmoji }: { attachment: IAttachme const Attachments: React.FC = React.memo( ({ attachments, timeFormat, showAttachment, style, getCustomEmoji, isReply, author }: IMessageAttachments) => { - const { theme } = useTheme(); - if (!attachments || attachments.length === 0) { return null; } @@ -84,7 +81,6 @@ const Attachments: React.FC = React.memo( getCustomEmoji={getCustomEmoji} isReply={isReply} style={style} - theme={theme} author={author} /> ); diff --git a/app/containers/message/Audio.tsx b/app/containers/message/Components/Audio/index.tsx similarity index 89% rename from app/containers/message/Audio.tsx rename to app/containers/message/Components/Audio/index.tsx index f14353bb4..f7e6d2691 100644 --- a/app/containers/message/Audio.tsx +++ b/app/containers/message/Components/Audio/index.tsx @@ -6,21 +6,21 @@ import moment from 'moment'; import { activateKeepAwakeAsync, deactivateKeepAwake } from 'expo-keep-awake'; import { Sound } from 'expo-av/build/Audio/Sound'; -import Touchable from './Touchable'; -import Markdown from '../markdown'; -import { CustomIcon } from '../CustomIcon'; -import sharedStyles from '../../views/Styles'; -import { themes } from '../../lib/constants'; -import { isAndroid, isIOS } from '../../lib/methods/helpers'; -import MessageContext from './Context'; -import ActivityIndicator from '../ActivityIndicator'; -import { TGetCustomEmoji } from '../../definitions/IEmoji'; -import { IAttachment, IUserMessage } from '../../definitions'; -import { useTheme } from '../../theme'; -import { downloadMediaFile, getMediaCache } from '../../lib/methods/handleMediaDownload'; -import EventEmitter from '../../lib/methods/helpers/events'; -import { PAUSE_AUDIO } from './constants'; -import { fetchAutoDownloadEnabled } from '../../lib/methods/autoDownloadPreference'; +import Touchable from '../../Touchable'; +import Markdown from '../../../markdown'; +import { CustomIcon } from '../../../CustomIcon'; +import sharedStyles from '../../../../views/Styles'; +import { themes } from '../../../../lib/constants'; +import { isAndroid, isIOS } from '../../../../lib/methods/helpers'; +import MessageContext from '../../Context'; +import ActivityIndicator from '../../../ActivityIndicator'; +import { TGetCustomEmoji } from '../../../../definitions/IEmoji'; +import { IAttachment, IUserMessage } from '../../../../definitions'; +import { useTheme } from '../../../../theme'; +import { downloadMediaFile, getMediaCache } from '../../../../lib/methods/handleMediaDownload'; +import EventEmitter from '../../../../lib/methods/helpers/events'; +import { PAUSE_AUDIO } from '../../constants'; +import { fetchAutoDownloadEnabled } from '../../../../lib/methods/autoDownloadPreference'; interface IButton { loading: boolean; @@ -318,6 +318,7 @@ const MessageAudio = ({ file, getCustomEmoji, author, isReply, style }: IMessage ]} >