Skip to content

Commit

Permalink
Few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello committed Jun 26, 2020
1 parent b0def4c commit e2739d2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/containers/MessageBox/RightButtons.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const RightButtons = React.memo(({
if (showSend) {
return <SendButton onPress={submit} theme={theme} />;
}
if (recordAudioMessageEnabled || isActionsEnabled) {
if (recordAudioMessageEnabled && isActionsEnabled) {
return (
<>
{isActionsEnabled ? <AudioButton onPress={recordAudioMessage} theme={theme} /> : null}
Expand Down
2 changes: 1 addition & 1 deletion app/selectors/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createSelector } from 'reselect';
import { isEmpty } from 'lodash';

const getUser = (state) => {
if (!isEmpty(state.share.user)) {
if (!isEmpty(state.share?.user)) {
return state.share.user;
}
return state.login?.user;
Expand Down
4 changes: 1 addition & 3 deletions app/views/AttachmentView.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ class AttachmentView extends React.Component {

render() {
const { loading, attachment } = this.state;
const {
theme, user, baseUrl
} = this.props;
const { theme, user, baseUrl } = this.props;
let content = null;

if (attachment && attachment.image_url) {
Expand Down
4 changes: 2 additions & 2 deletions app/views/RoomView/UploadProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class UploadProgress extends Component {
[
<View key='row' style={styles.row}>
<CustomIcon name='clip' size={20} color={themes[theme].auxiliaryText} />
<Text style={[styles.descriptionContainer, styles.descriptionText, { color: themes[theme].auxiliaryText }]} ellipsizeMode='tail' numberOfLines={1}>
<Text style={[styles.descriptionContainer, styles.descriptionText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
{I18n.t('Uploading')} {item.name}
</Text>
<CustomIcon name='Cross' size={20} color={themes[theme].auxiliaryText} onPress={() => this.cancelUpload(item)} />
Expand All @@ -186,7 +186,7 @@ class UploadProgress extends Component {
<View style={styles.row}>
<CustomIcon name='warning' size={20} color={themes[theme].dangerColor} />
<View style={styles.descriptionContainer}>
<Text style={[styles.descriptionText, { color: themes[theme].auxiliaryText }]}>{I18n.t('Error_uploading')} {item.name}</Text>
<Text style={[styles.descriptionText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>{I18n.t('Error_uploading')} {item.name}</Text>
<TouchableOpacity onPress={() => this.tryAgain(item)}>
<Text style={[styles.tryAgainButtonText, { color: themes[theme].tintColor }]}>{I18n.t('Try_again')}</Text>
</TouchableOpacity>
Expand Down
5 changes: 3 additions & 2 deletions app/views/ShareListView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { themes } from '../../constants/colors';
import { animateNextTransition } from '../../utils/layoutAnimation';
import { withTheme } from '../../theme';
import SafeAreaView from '../../containers/SafeAreaView';
import RocketChat from '../../lib/rocketchat';

const permission = {
title: I18n.t('Read_External_Permission'),
Expand Down Expand Up @@ -57,7 +58,7 @@ class ShareListView extends React.Component {
text: '',
loading: true,
serverInfo: null,
needsPermission: true
needsPermission: isAndroid || false
};
this.setHeader();
this.unsubscribeFocus = props.navigation.addListener('focus', () => BackHandler.addEventListener('hardwareBackPress', this.handleBackPress));
Expand Down Expand Up @@ -307,7 +308,7 @@ class ShareListView extends React.Component {
}}
title={this.getRoomTitle(item)}
baseUrl={server}
avatar={item.t === 'd' ? item.name : this.getRoomTitle(item)}
avatar={RocketChat.getRoomAvatar(item)}
description={
item.t === 'c'
? (item.topic || item.description)
Expand Down
2 changes: 1 addition & 1 deletion app/views/ShareView/Thumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const ThumbContent = React.memo(({ item, theme, isShareExtension }) => {
);
}

// Multiple files selection (not audio or video) is not implemented, so there's no thumb
// Multiple files upload of files different than image/video is not implemented, so there's no thumb
return null;
});

Expand Down
24 changes: 11 additions & 13 deletions app/views/ShareView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,17 @@ class ShareView extends Component {
};

selectFile = (item) => {
const { text } = this.messagebox.current;
const { attachments, selected } = this.state;
const newAttachments = attachments.map((att) => {
if (att.path === selected.path) {
att.description = text;
}
return att;
});
this.setState({ attachments: newAttachments, selected: item });
if (attachments.length > 0) {
const { text } = this.messagebox.current;
const newAttachments = attachments.map((att) => {
if (att.path === selected.path) {
att.description = text;
}
return att;
});
return this.setState({ attachments: newAttachments, selected: item });
}
}

removeFile = (item) => {
Expand All @@ -240,11 +242,7 @@ class ShareView extends Component {
}

onChangeText = (text) => {
const { attachments } = this.state;
// we manage attachments on this state only when it's text only sharing
if (!attachments.length) {
this.setState({ text });
}
this.setState({ text });
}

renderContent = () => {
Expand Down

0 comments on commit e2739d2

Please sign in to comment.