separate audio to a folder inside components and minor tweak attachment

This commit is contained in:
Reinaldo Neto 2023-08-07 14:42:41 -03:00
parent c469d0f8e9
commit 425522a63e
2 changed files with 17 additions and 21 deletions

View File

@ -3,12 +3,11 @@ import { dequal } from 'dequal';
import { IMessageAttachments } from './interfaces'; import { IMessageAttachments } from './interfaces';
import Image from './Image'; import Image from './Image';
import Audio from './Audio'; import Audio from './Components/Audio';
import Video from './Video'; import Video from './Video';
import Reply from './Reply'; import Reply from './Reply';
import Button from '../Button'; import Button from '../Button';
import MessageContext from './Context'; import MessageContext from './Context';
import { useTheme } from '../../theme';
import { IAttachment, TGetCustomEmoji } from '../../definitions'; import { IAttachment, TGetCustomEmoji } from '../../definitions';
import CollapsibleQuote from './Components/CollapsibleQuote'; import CollapsibleQuote from './Components/CollapsibleQuote';
import openLink from '../../lib/methods/helpers/openLink'; import openLink from '../../lib/methods/helpers/openLink';
@ -55,8 +54,6 @@ const AttachedActions = ({ attachment, getCustomEmoji }: { attachment: IAttachme
const Attachments: React.FC<IMessageAttachments> = React.memo( const Attachments: React.FC<IMessageAttachments> = React.memo(
({ attachments, timeFormat, showAttachment, style, getCustomEmoji, isReply, author }: IMessageAttachments) => { ({ attachments, timeFormat, showAttachment, style, getCustomEmoji, isReply, author }: IMessageAttachments) => {
const { theme } = useTheme();
if (!attachments || attachments.length === 0) { if (!attachments || attachments.length === 0) {
return null; return null;
} }
@ -84,7 +81,6 @@ const Attachments: React.FC<IMessageAttachments> = React.memo(
getCustomEmoji={getCustomEmoji} getCustomEmoji={getCustomEmoji}
isReply={isReply} isReply={isReply}
style={style} style={style}
theme={theme}
author={author} author={author}
/> />
); );

View File

@ -6,21 +6,21 @@ import moment from 'moment';
import { activateKeepAwakeAsync, deactivateKeepAwake } from 'expo-keep-awake'; import { activateKeepAwakeAsync, deactivateKeepAwake } from 'expo-keep-awake';
import { Sound } from 'expo-av/build/Audio/Sound'; import { Sound } from 'expo-av/build/Audio/Sound';
import Touchable from './Touchable'; import Touchable from '../../Touchable';
import Markdown from '../markdown'; import Markdown from '../../../markdown';
import { CustomIcon } from '../CustomIcon'; import { CustomIcon } from '../../../CustomIcon';
import sharedStyles from '../../views/Styles'; import sharedStyles from '../../../../views/Styles';
import { themes } from '../../lib/constants'; import { themes } from '../../../../lib/constants';
import { isAndroid, isIOS } from '../../lib/methods/helpers'; import { isAndroid, isIOS } from '../../../../lib/methods/helpers';
import MessageContext from './Context'; import MessageContext from '../../Context';
import ActivityIndicator from '../ActivityIndicator'; import ActivityIndicator from '../../../ActivityIndicator';
import { TGetCustomEmoji } from '../../definitions/IEmoji'; import { TGetCustomEmoji } from '../../../../definitions/IEmoji';
import { IAttachment, IUserMessage } from '../../definitions'; import { IAttachment, IUserMessage } from '../../../../definitions';
import { useTheme } from '../../theme'; import { useTheme } from '../../../../theme';
import { downloadMediaFile, getMediaCache } from '../../lib/methods/handleMediaDownload'; import { downloadMediaFile, getMediaCache } from '../../../../lib/methods/handleMediaDownload';
import EventEmitter from '../../lib/methods/helpers/events'; import EventEmitter from '../../../../lib/methods/helpers/events';
import { PAUSE_AUDIO } from './constants'; import { PAUSE_AUDIO } from '../../constants';
import { fetchAutoDownloadEnabled } from '../../lib/methods/autoDownloadPreference'; import { fetchAutoDownloadEnabled } from '../../../../lib/methods/autoDownloadPreference';
interface IButton { interface IButton {
loading: boolean; loading: boolean;
@ -318,6 +318,7 @@ const MessageAudio = ({ file, getCustomEmoji, author, isReply, style }: IMessage
]} ]}
> >
<Button disabled={isReply} loading={loading} paused={paused} cached={cached} onPress={onPress} /> <Button disabled={isReply} loading={loading} paused={paused} cached={cached} onPress={onPress} />
<Text style={[styles.duration, { color: themes[theme].auxiliaryText }]}>{getDuration()}</Text>
<Slider <Slider
disabled={isReply} disabled={isReply}
style={styles.slider} style={styles.slider}
@ -330,7 +331,6 @@ const MessageAudio = ({ file, getCustomEmoji, author, isReply, style }: IMessage
onValueChange={onValueChange} onValueChange={onValueChange}
thumbImage={isIOS ? { uri: 'audio_thumb', scale } : undefined} thumbImage={isIOS ? { uri: 'audio_thumb', scale } : undefined}
/> />
<Text style={[styles.duration, { color: themes[theme].auxiliaryText }]}>{getDuration()}</Text>
</View> </View>
</> </>
); );