Merge branch 'release-1.7'

This commit is contained in:
Elias Nahum 2018-03-23 11:30:01 +03:00
commit 8640222b4d
No known key found for this signature in database
GPG key ID: E038DB71E0B61702
15 changed files with 99 additions and 32 deletions

View file

@ -111,7 +111,7 @@ android {
applicationId "com.mattermost.rnbeta"
minSdkVersion 21
targetSdkVersion 23
versionCode 90
versionCode 91
versionName "1.7.0"
multiDexEnabled true
ndk {

View file

@ -31,7 +31,7 @@ export function handleUploadFiles(files, rootId) {
extension: fileData.extension,
});
fileData.name = encodeHeaderURIStringToUTF8(file.fileName);
fileData.name = encodeHeaderURIStringToUTF8(fileData.name);
formData.append('files', fileData);
formData.append('channel_id', channelId);
formData.append('client_ids', clientId);
@ -60,14 +60,11 @@ export function retryFileUpload(file, rootId) {
const channelId = state.entities.channels.currentChannelId;
const formData = new FormData();
const fileData = buildFileUploadData(file);
const fileData = {
uri: file.localPath,
name: file.name,
type: file.type,
};
fileData.uri = file.localPath;
fileData.name = encodeHeaderURIStringToUTF8(file.fileName);
fileData.name = encodeHeaderURIStringToUTF8(fileData.name);
formData.append('files', fileData);
formData.append('channel_id', channelId);
formData.append('client_ids', file.clientId);

View file

@ -2,13 +2,16 @@ import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Alert,
Platform,
StyleSheet,
TouchableOpacity,
} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import ImagePicker from 'react-native-image-picker';
import Permissions from 'react-native-permissions';
import {PermissionTypes} from 'app/constants';
import {changeOpacity} from 'app/utils/theme';
class AttachmentButton extends PureComponent {
@ -29,7 +32,7 @@ class AttachmentButton extends PureComponent {
maxFileCount: 5,
};
attachFileFromCamera = () => {
attachFileFromCamera = async () => {
const {formatMessage} = this.props.intl;
const options = {
quality: 1.0,
@ -55,13 +58,17 @@ class AttachmentButton extends PureComponent {
},
};
ImagePicker.launchCamera(options, (response) => {
if (response.error || response.didCancel) {
return;
}
const hasPhotoPermission = await this.hasPhotoPermission();
this.uploadFiles([response]);
});
if (hasPhotoPermission) {
ImagePicker.launchCamera(options, (response) => {
if (response.error || response.didCancel) {
return;
}
this.uploadFiles([response]);
});
}
};
attachFileFromLibrary = () => {
@ -131,6 +138,59 @@ class AttachmentButton extends PureComponent {
});
};
hasPhotoPermission = async () => {
if (Platform.OS === 'ios') {
const {formatMessage} = this.props.intl;
let permissionRequest;
const hasPermissionToStorage = await Permissions.check('photo');
switch (hasPermissionToStorage) {
case PermissionTypes.UNDETERMINED:
permissionRequest = await Permissions.request('photo');
if (permissionRequest !== PermissionTypes.AUTHORIZED) {
return false;
}
break;
case PermissionTypes.DENIED: {
const canOpenSettings = await Permissions.canOpenSettings();
let grantOption = null;
if (canOpenSettings) {
grantOption = {
text: formatMessage({
id: 'mobile.android.permission_denied_retry',
defaultMessage: 'Set permission',
}),
onPress: () => Permissions.openSettings(),
};
}
Alert.alert(
formatMessage({
id: 'mobile.android.photos_permission_denied_title',
defaultMessage: 'Photo library access is required',
}),
formatMessage({
id: 'mobile.android.photos_permission_denied_description',
defaultMessage: 'To upload images from your library, please change your permission settings.',
}),
[
grantOption,
{
text: formatMessage({
id: 'mobile.android.permission_denied_dismiss',
defaultMessage: 'Dismiss',
}),
},
]
);
return false;
}
}
}
return true;
};
uploadFiles = (images) => {
this.props.uploadFiles(images);
};

View file

@ -53,7 +53,6 @@ class FilteredList extends Component {
};
static defaultProps = {
currentTeam: {},
currentChannel: {},
pastDirectMessages: [],
};

View file

@ -16,6 +16,7 @@ import {
getOtherChannels,
} from 'mattermost-redux/selectors/entities/channels';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId, getProfilesInCurrentTeam, getUsers, getUserIdsInChannels, getUserStatuses} from 'mattermost-redux/selectors/entities/users';
import {getDirectShowPreferences, getTeammateNameDisplaySetting, getTheme} from 'mattermost-redux/selectors/entities/preferences';
@ -109,6 +110,7 @@ function mapStateToProps(state) {
return {
channels: getChannelsWithUnreadSection(state),
currentChannel: getCurrentChannel(state),
currentTeam: getCurrentTeam(state),
currentUserId,
otherChannels: getOtherChannels(state),
groupChannelMemberDetails: getGroupChannelMemberDetails(state),

View file

@ -7,9 +7,9 @@ import PropTypes from 'prop-types';
import CustomPropTypes from 'app/constants/custom_prop_types';
import SlackAttachment from './slack_attachment';
import MessageAttachment from './message_attachment';
export default class SlackAttachments extends PureComponent {
export default class MessageAttachments extends PureComponent {
static propTypes = {
attachments: PropTypes.array.isRequired,
baseTextStyle: CustomPropTypes.Style,
@ -38,7 +38,7 @@ export default class SlackAttachments extends PureComponent {
attachments.forEach((attachment, i) => {
content.push(
<SlackAttachment
<MessageAttachment
attachment={attachment}
baseTextStyle={baseTextStyle}
blockStyles={blockStyles}

View file

@ -23,7 +23,7 @@ const STATUS_COLORS = {
danger: '#e40303',
};
export default class SlackAttachment extends PureComponent {
export default class MessageAttachment extends PureComponent {
static propTypes = {
attachment: PropTypes.object.isRequired,
baseTextStyle: CustomPropTypes.Style,
@ -392,8 +392,12 @@ export default class SlackAttachment extends PureComponent {
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
container: {
borderColor: changeOpacity(theme.centerChannelColor, 0.15),
borderWidth: 1,
borderBottomColor: changeOpacity(theme.centerChannelColor, 0.15),
borderRightColor: changeOpacity(theme.centerChannelColor, 0.15),
borderTopColor: changeOpacity(theme.centerChannelColor, 0.15),
borderBottomWidth: 1,
borderRightWidth: 1,
borderTopWidth: 1,
marginTop: 5,
padding: 10,
},

View file

@ -18,7 +18,7 @@ import youTubeVideoId from 'youtube-video-id';
import youtubePlayIcon from 'assets/images/icons/youtube-play-icon.png';
import PostAttachmentOpenGraph from 'app/components/post_attachment_opengraph';
import SlackAttachments from 'app/components/slack_attachments';
import MessageAttachments from 'app/components/message_attachments';
import CustomPropTypes from 'app/constants/custom_prop_types';
import {emptyFunction} from 'app/utils/general';
import {isImageLink, isYoutubeLink} from 'app/utils/url';
@ -109,7 +109,7 @@ export default class PostBodyAdditionalContent extends PureComponent {
}
const {isReplyPost, link, openGraphData, showLinkPreviews, theme} = this.props;
const attachments = this.getSlackAttachment();
const attachments = this.getMessageAttachment();
if (attachments) {
return attachments;
}
@ -154,7 +154,7 @@ export default class PostBodyAdditionalContent extends PureComponent {
}
};
getSlackAttachment = () => {
getMessageAttachment = () => {
const {
postId,
postProps,
@ -169,7 +169,7 @@ export default class PostBodyAdditionalContent extends PureComponent {
if (attachments && attachments.length) {
return (
<SlackAttachments
<MessageAttachments
attachments={attachments}
baseTextStyle={baseTextStyle}
blockStyles={blockStyles}

View file

@ -22,7 +22,7 @@ export default class Root extends PureComponent {
theme: PropTypes.object.isRequired,
};
componentDidMount() {
componentWillMount() {
if (!this.props.excludeEvents) {
EventEmitter.on(ViewTypes.NOTIFICATION_IN_APP, this.handleInAppNotification);
EventEmitter.on(ViewTypes.NOTIFICATION_TAPPED, this.handleNotificationTapped);
@ -56,6 +56,11 @@ export default class Root extends PureComponent {
};
handleNoTeams = () => {
if (!this.refs.provider) {
setTimeout(this.handleNoTeams, 200);
return;
}
const {currentUrl, navigator, theme} = this.props;
const {intl} = this.refs.provider.getChildContext();

View file

@ -2468,7 +2468,7 @@
CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 90;
CURRENT_PROJECT_VERSION = 91;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = UQ8HT4Q2XM;
ENABLE_BITCODE = NO;
@ -2517,7 +2517,7 @@
CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 90;
CURRENT_PROJECT_VERSION = 91;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = UQ8HT4Q2XM;
ENABLE_BITCODE = NO;

View file

@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>90</string>
<string>91</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>

View file

@ -23,7 +23,7 @@
<key>CFBundleShortVersionString</key>
<string>1.7.0</string>
<key>CFBundleVersion</key>
<string>90</string>
<string>91</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>

View file

@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>90</string>
<string>91</string>
</dict>
</plist>