[FIX] Messages View (#2090)
* [FIX] Messages View * [FIX] Opening PDF from Files View * [FIX] Audio * [FIX] SearchMessagesView Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
61afa86c0e
commit
8870ef4236
|
@ -119,10 +119,15 @@ class MessageAudio extends React.Component {
|
|||
const { file } = this.props;
|
||||
const { baseUrl, user } = this.context;
|
||||
|
||||
let url = file.audio_url;
|
||||
if (!url.startsWith('http')) {
|
||||
url = `${ baseUrl }${ file.audio_url }`;
|
||||
}
|
||||
|
||||
this.setState({ loading: true });
|
||||
try {
|
||||
await Audio.setAudioModeAsync(mode);
|
||||
await this.sound.loadAsync({ uri: `${ baseUrl }${ file.audio_url }?rc_uid=${ user.id }&rc_token=${ user.token }` });
|
||||
await this.sound.loadAsync({ uri: `${ url }?rc_uid=${ user.id }&rc_token=${ user.token }` });
|
||||
} catch {
|
||||
// Do nothing
|
||||
}
|
||||
|
|
|
@ -139,7 +139,10 @@ const Reply = React.memo(({
|
|||
return;
|
||||
}
|
||||
if (attachment.type === 'file') {
|
||||
url = `${ baseUrl }${ url }?rc_uid=${ user.id }&rc_token=${ user.token }`;
|
||||
if (!url.startsWith('http')) {
|
||||
url = `${ baseUrl }${ url }`;
|
||||
}
|
||||
url = `${ url }?rc_uid=${ user.id }&rc_token=${ user.token }`;
|
||||
}
|
||||
openLink(url, theme);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ import equal from 'deep-equal';
|
|||
import ActionSheet from 'react-native-action-sheet';
|
||||
|
||||
import styles from './styles';
|
||||
import Message from '../../containers/message/Message';
|
||||
import Message from '../../containers/message';
|
||||
import ActivityIndicator from '../../containers/ActivityIndicator';
|
||||
import I18n from '../../i18n';
|
||||
import RocketChat from '../../lib/rocketchat';
|
||||
|
@ -87,6 +87,7 @@ class MessagesView extends React.Component {
|
|||
const { user, baseUrl, theme } = this.props;
|
||||
|
||||
const renderItemCommonProps = item => ({
|
||||
item,
|
||||
baseUrl,
|
||||
user,
|
||||
author: item.u || item.user,
|
||||
|
@ -110,21 +111,21 @@ class MessagesView extends React.Component {
|
|||
},
|
||||
noDataMsg: I18n.t('No_files'),
|
||||
testID: 'room-files-view',
|
||||
renderItem: (item) => {
|
||||
const url = getFileUrlFromMessage(item);
|
||||
|
||||
return (
|
||||
<Message
|
||||
{...renderItemCommonProps(item)}
|
||||
attachments={[{
|
||||
renderItem: item => (
|
||||
<Message
|
||||
{...renderItemCommonProps(item)}
|
||||
item={{
|
||||
...item,
|
||||
u: item.user,
|
||||
attachments: [{
|
||||
title: item.name,
|
||||
description: item.description,
|
||||
...url
|
||||
}]}
|
||||
theme={theme}
|
||||
/>
|
||||
);
|
||||
}
|
||||
...getFileUrlFromMessage(item)
|
||||
}]
|
||||
}}
|
||||
theme={theme}
|
||||
/>
|
||||
)
|
||||
},
|
||||
// Mentions Messages Screen
|
||||
Mentions: {
|
||||
|
|
|
@ -11,7 +11,7 @@ import styles from './styles';
|
|||
import Markdown from '../../containers/markdown';
|
||||
import debounce from '../../utils/debounce';
|
||||
import RocketChat from '../../lib/rocketchat';
|
||||
import Message from '../../containers/message/Message';
|
||||
import Message from '../../containers/message';
|
||||
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
||||
import I18n from '../../i18n';
|
||||
import StatusBar from '../../containers/StatusBar';
|
||||
|
@ -115,14 +115,10 @@ class SearchMessagesView extends React.Component {
|
|||
const { user, baseUrl, theme } = this.props;
|
||||
return (
|
||||
<Message
|
||||
item={item}
|
||||
baseUrl={baseUrl}
|
||||
user={user}
|
||||
author={item.u}
|
||||
ts={item.ts}
|
||||
msg={item.msg}
|
||||
attachments={item.attachments || []}
|
||||
timeFormat='MMM Do YYYY, h:mm:ss a'
|
||||
isEdited={!!item.editedAt}
|
||||
isHeader
|
||||
showAttachment={() => {}}
|
||||
getCustomEmoji={this.getCustomEmoji}
|
||||
|
|
Loading…
Reference in New Issue