From bdb247a90ea253987393700da10d1737b26f2dda Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 16 Mar 2018 16:14:02 +0200 Subject: [PATCH 01/14] Fix team_icon to reference the pure component (#1507) * Fix team_icon to reference the pure component * Fix team icon in Android extension * Fix team icon in select team screen * Fix team switch divider in channel drawer --- .../switch_teams_button/switch_teams_button.js | 7 +++++++ app/screens/select_team/select_team.js | 5 +++-- .../android/extension_teams/team_item/team_item.js | 4 ++++ share_extension/ios/extension_team_item.js | 10 ++++++++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/components/channel_drawer/channels_list/switch_teams_button/switch_teams_button.js b/app/components/channel_drawer/channels_list/switch_teams_button/switch_teams_button.js index c1484062a..aeabaa37a 100644 --- a/app/components/channel_drawer/channels_list/switch_teams_button/switch_teams_button.js +++ b/app/components/channel_drawer/channels_list/switch_teams_button/switch_teams_button.js @@ -70,6 +70,7 @@ export default class SwitchTeamsButton extends React.PureComponent { size={12} style={styles.switcherArrow} /> + { color: theme.sidebarHeaderBg, marginRight: 3, }, + switcherDivider: { + backgroundColor: theme.sidebarHeaderBg, + height: 15, + marginHorizontal: 6, + width: 1, + }, teamIconContainer: { width: 26, height: 26, diff --git a/app/screens/select_team/select_team.js b/app/screens/select_team/select_team.js index a47d40db2..b208cc28c 100644 --- a/app/screens/select_team/select_team.js +++ b/app/screens/select_team/select_team.js @@ -7,7 +7,6 @@ import { Alert, FlatList, InteractionManager, - StyleSheet, Text, TouchableOpacity, View, @@ -261,7 +260,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { line: { backgroundColor: changeOpacity(theme.centerChannelColor, 0.2), width: '100%', - height: StyleSheet.hairlineWidth, + height: 1, }, teamWrapper: { marginTop: 20, @@ -275,8 +274,10 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { teamIconContainer: { width: 40, height: 40, + backgroundColor: theme.sidebarBg, }, teamIconText: { + color: theme.sidebarText, fontSize: 18, }, noTeam: { diff --git a/share_extension/android/extension_teams/team_item/team_item.js b/share_extension/android/extension_teams/team_item/team_item.js index cf02b7fa7..47c709186 100644 --- a/share_extension/android/extension_teams/team_item/team_item.js +++ b/share_extension/android/extension_teams/team_item/team_item.js @@ -96,8 +96,12 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { paddingRight: 5, }, teamIconContainer: { + backgroundColor: theme.sidebarBg, marginRight: 10, }, + teamIconText: { + color: theme.sidebarText, + }, checkmarkContainer: { alignItems: 'flex-end', }, diff --git a/share_extension/ios/extension_team_item.js b/share_extension/ios/extension_team_item.js index 317652e4d..a6c6f83b2 100644 --- a/share_extension/ios/extension_team_item.js +++ b/share_extension/ios/extension_team_item.js @@ -12,7 +12,7 @@ import { import {preventDoubleTap} from 'app/utils/tap'; import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; -import TeamIcon from 'app/components/team_icon'; +import TeamIcon from 'app/components/team_icon/team_icon'; export default class TeamsListItem extends React.PureComponent { static propTypes = { @@ -51,9 +51,11 @@ export default class TeamsListItem extends React.PureComponent { { paddingRight: 5, }, teamIconContainer: { + backgroundColor: theme.sidebarBg, marginRight: 10, }, + teamIconText: { + color: theme.sidebarText, + }, checkmarkContainer: { alignItems: 'flex-end', }, From cc64cc5dc6624191282fbeab57bd65d50878c095 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 16 Mar 2018 16:15:06 +0200 Subject: [PATCH 02/14] Handle permalink Android back button and use the same permalink window to avoid nesting (#1508) --- app/components/post_list/post_list.js | 11 ++++- app/screens/channel_info/channel_info.js | 1 + app/screens/permalink/permalink.js | 52 +++++++++++++++--------- app/screens/search/search.js | 1 + 4 files changed, 43 insertions(+), 22 deletions(-) diff --git a/app/components/post_list/post_list.js b/app/components/post_list/post_list.js index 4cb765ce8..c87d60d0b 100644 --- a/app/components/post_list/post_list.js +++ b/app/components/post_list/post_list.js @@ -105,8 +105,14 @@ export default class PostList extends PureComponent { }; handlePermalinkPress = (postId, teamName) => { - this.props.actions.loadChannelsByTeamName(teamName); - this.showPermalinkView(postId); + const {actions, onPermalinkPress} = this.props; + + if (onPermalinkPress) { + onPermalinkPress(postId, true); + } else { + actions.loadChannelsByTeamName(teamName); + this.showPermalinkView(postId); + } }; showPermalinkView = (postId) => { @@ -119,6 +125,7 @@ export default class PostList extends PureComponent { screen: 'Permalink', animationType: 'none', backButtonTitle: '', + overrideBackPress: true, navigatorStyle: { navBarHidden: true, screenBackgroundColor: changeOpacity('#000', 0.2), diff --git a/app/screens/channel_info/channel_info.js b/app/screens/channel_info/channel_info.js index ab007e59b..93405b80a 100644 --- a/app/screens/channel_info/channel_info.js +++ b/app/screens/channel_info/channel_info.js @@ -263,6 +263,7 @@ export default class ChannelInfo extends PureComponent { screen: 'Permalink', animationType: 'none', backButtonTitle: '', + overrideBackPress: true, navigatorStyle: { navBarHidden: true, screenBackgroundColor: changeOpacity('#000', 0.2), diff --git a/app/screens/permalink/permalink.js b/app/screens/permalink/permalink.js index ef22ed1fd..7929b9f02 100644 --- a/app/screens/permalink/permalink.js +++ b/app/screens/permalink/permalink.js @@ -86,12 +86,14 @@ export default class Permalink extends PureComponent { super(props); const {postIds, channelName} = props; - let loading = false; + let loading = true; if (postIds && postIds.length >= 10) { - loading = true; + loading = false; } + props.navigator.setOnNavigatorEvent(this.onNavigatorEvent); + this.state = { title: channelName, loading, @@ -101,7 +103,7 @@ export default class Permalink extends PureComponent { } componentWillMount() { - if (!this.state.loading) { + if (this.state.loading) { this.loadPosts(this.props); } } @@ -112,11 +114,11 @@ export default class Permalink extends PureComponent { } if (this.props.focusedPostId !== nextProps.focusedPostId) { - this.setState({loading: false}); + this.setState({loading: true}); if (nextProps.postIds && nextProps.postIds.length < 10) { this.loadPosts(nextProps); } else { - this.setState({loading: true}); + this.setState({loading: false}); } } } @@ -162,6 +164,16 @@ export default class Permalink extends PureComponent { } }; + handlePress = () => { + const {channelId, channelName} = this.props; + + if (this.refs.view) { + this.refs.view.growOut().then(() => { + this.jumpToChannel(channelId, channelName); + }); + } + }; + jumpToChannel = (channelId, channelDisplayName) => { if (channelId) { const {actions, channelTeamId, currentTeamId, navigator, onClose, theme} = this.props; @@ -210,16 +222,6 @@ export default class Permalink extends PureComponent { } }; - handlePress = () => { - const {channelId, channelName} = this.props; - - if (this.refs.view) { - this.refs.view.growOut().then(() => { - this.jumpToChannel(channelId, channelName); - }); - } - }; - loadPosts = async (props) => { const {intl} = this.context; const {actions, channelId, currentUserId, focusedPostId, isPermalink, postIds} = props; @@ -261,11 +263,21 @@ export default class Permalink extends PureComponent { actions.getPostsAfter(focusChannelId, focusedPostId, 0, 10), ]); - this.setState({loading: true}); + this.setState({loading: false}); + }; + + onNavigatorEvent = (event) => { + switch (event.id) { + case 'backPress': + this.handleClose(); + break; + default: + break; + } }; retry = () => { - this.setState({loading: false, error: null, retry: false}); + this.setState({loading: true, error: null, retry: false}); this.loadPosts(this.props); }; @@ -298,6 +310,8 @@ export default class Permalink extends PureComponent { ); } else if (loading) { + postList = ; + } else { postList = ( ); - } else { - postList = ; } return ( @@ -361,7 +373,7 @@ export default class Permalink extends PureComponent { {postList} - {!error && loading && + {!error && !loading && Date: Fri, 16 Mar 2018 16:20:27 +0200 Subject: [PATCH 03/14] MM-9857 Disconnect WS for Android when sent to the background (#1511) --- app/screens/channel/channel.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/screens/channel/channel.js b/app/screens/channel/channel.js index b7c908070..1a7b7329c 100644 --- a/app/screens/channel/channel.js +++ b/app/screens/channel/channel.js @@ -5,6 +5,7 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import {injectIntl, intlShape} from 'react-intl'; import { + AppState, Platform, View, } from 'react-native'; @@ -66,6 +67,10 @@ class Channel extends PureComponent { } componentDidMount() { + if (Platform.OS === 'android') { + AppState.addEventListener('change', this.handleAppStateChange); + } + if (tracker.initialLoad) { this.props.actions.recordLoadTime('Start time', 'initialLoad'); } @@ -95,6 +100,10 @@ class Channel extends PureComponent { EventEmitter.off('leave_team', this.handleLeaveTeam); this.networkListener.removeEventListener(); + if (Platform.OS === 'android') { + AppState.removeEventListener('change', this.handleAppStateChange); + } + closeWebSocket(); stopPeriodicStatusUpdates(); } @@ -141,6 +150,25 @@ class Channel extends PureComponent { } }); + handleAppStateChange = async (appState) => { + const {actions} = this.props; + const { + closeWebSocket, + initWebSocket, + startPeriodicStatusUpdates, + stopPeriodicStatusUpdates, + } = actions; + const isActive = appState === 'active'; + + if (isActive) { + initWebSocket(Platform.OS); + startPeriodicStatusUpdates(); + } else { + closeWebSocket(true); + stopPeriodicStatusUpdates(); + } + }; + handleConnectionChange = (isConnected) => { const {actions} = this.props; const { From ae6cc7752fd644f4ffe114bb97a78f3b1e39b686 Mon Sep 17 00:00:00 2001 From: Yusuke Nemoto Date: Sat, 17 Mar 2018 00:37:46 +0900 Subject: [PATCH 04/14] Fix missing messages (#1514) * Fix missing message * Move a message to webapp repo --- assets/base/i18n/en.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/assets/base/i18n/en.json b/assets/base/i18n/en.json index 6aed28579..b4f70d048 100644 --- a/assets/base/i18n/en.json +++ b/assets/base/i18n/en.json @@ -1938,6 +1938,7 @@ "mobile.account_notifications.threads_mentions": "Mentions in threads", "mobile.account_notifications.threads_start": "Threads that I start", "mobile.account_notifications.threads_start_participate": "Threads that I start or participate in", + "mobile.advanced_settings.clockDisplay": "Clock display", "mobile.advanced_settings.delete": "Delete", "mobile.advanced_settings.delete_file_cache": "Delete File Cache", "mobile.advanced_settings.delete_file_cache_message": "\nThis will delete all the files stored in the cache. Are you sure you want to delete them?\n", @@ -1977,6 +1978,7 @@ "mobile.channel_list.closeGM": "Close Group Message", "mobile.channel_list.dm": "Direct Message", "mobile.channel_list.gm": "Group Message", + "mobile.channel_list.members": "MEMBERS", "mobile.channel_list.not_member": "NOT A MEMBER", "mobile.channel_list.open": "Open {term}", "mobile.channel_list.openDM": "Open Direct Message", @@ -1992,6 +1994,7 @@ "mobile.client_upgrade.download_error.message": "An error occurred downloading the new version.", "mobile.client_upgrade.download_error.title": "Unable to Install Update", "mobile.client_upgrade.latest_version": "Your Version: {version}", + "mobile.client_upgrade.listener.message": "A client upgrade is available!", "mobile.client_upgrade.must_upgrade_subtitle": "Please update the app to continue.", "mobile.client_upgrade.must_upgrade_title": "Update Required", "mobile.client_upgrade.no_upgrade_subtitle": "You already have the latest version.", @@ -2014,6 +2017,7 @@ "mobile.document_preview.failed_title": "Open Document failed", "mobile.downloader.android_complete": "Download complete", "mobile.downloader.android_failed": "Download failed", + "mobile.downloader.android_permission": "We need access to the downloads folder to save files.", "mobile.downloader.android_started": "Download started", "mobile.downloader.android_success": "download successful", "mobile.downloader.complete": "Download complete", @@ -2073,6 +2077,10 @@ "mobile.markdown.image.too_large": "Image exceeds max dimensions of {maxWidth} by {maxHeight}:", "mobile.markdown.link.copy_url": "Copy URL", "mobile.mention.copy_mention": "Copy Mention", + "mobile.message_length.message": "Your current message is too long. Current character count: {max}/{count}", + "mobile.message_length.title": "Message Length", + "mobile.more_dms.add_more": "You can add {remaining, number} more users", + "mobile.more_dms.cannot_add_more": "You cannot add more users", "mobile.more_dms.start": "Start", "mobile.more_dms.title": "New Conversation", "mobile.more_dms.you": "(@{username} - you)", @@ -2126,6 +2134,8 @@ "mobile.post_textbox.empty.message": "You are trying to send an empty message.\nPlease make sure you have a message or at least one attached file.", "mobile.post_textbox.empty.ok": "OK", "mobile.post_textbox.empty.title": "Empty Message", + "mobile.post_textbox.uploadFailedDesc": "Some attachments failed to upload to the server, Are you sure you want to post the message?", + "mobile.post_textbox.uploadFailedTitle": "Attachment failure", "mobile.posts_view.moreMsg": "More New Messages Above", "mobile.rename_channel.display_name_maxLength": "Channel name must be less than {maxLength, number} characters", "mobile.rename_channel.display_name_minLength": "Channel name must be {minLength, number} or more characters", @@ -2179,6 +2189,10 @@ "mobile.server_upgrade.title": "Server upgrade required", "mobile.server_url.invalid_format": "URL must start with http:// or https://", "mobile.session_expired": "Session Expired: Please log in to continue receiving notifications.", + "mobile.set_status.away": "Away", + "mobile.set_status.dnd": "Do Not Disturb", + "mobile.set_status.offline": "Offline", + "mobile.set_status.online": "Online", "mobile.settings.clear": "Clear Offline Store", "mobile.settings.clear_button": "Clear", "mobile.settings.clear_message": "\nThis will clear all offline data and restart the app. You will be automatically logged back in once the app restarts.\n", From 5575795e32519b454ba7c677891d7fd9f1f35466 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 16 Mar 2018 19:40:31 +0200 Subject: [PATCH 05/14] Bump iOS build number to 90 (#1516) --- ios/Mattermost.xcodeproj/project.pbxproj | 4 ++-- ios/Mattermost/Info.plist | 2 +- ios/MattermostShare/Info.plist | 2 +- ios/MattermostTests/Info.plist | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index c0398bf28..e5723058b 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -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 = 89; + CURRENT_PROJECT_VERSION = 90; 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 = 89; + CURRENT_PROJECT_VERSION = 90; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index 8ac73b2c4..7bb4d6a74 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 89 + 90 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index bb391ec51..b82b8d1de 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -23,7 +23,7 @@ CFBundleShortVersionString 1.7.0 CFBundleVersion - 89 + 90 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index 51fd09c82..d45ef9a01 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 89 + 90 From a1c11897d39f8d1c3952133c21011e73aeb28bb1 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 16 Mar 2018 19:29:38 +0200 Subject: [PATCH 06/14] Update fastlane --- fastlane/Gemfile.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fastlane/Gemfile.lock b/fastlane/Gemfile.lock index 3b4eec201..83f7e63eb 100644 --- a/fastlane/Gemfile.lock +++ b/fastlane/Gemfile.lock @@ -5,15 +5,15 @@ GEM addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) atomos (0.1.2) - aws-partitions (1.59.0) - aws-sdk-core (3.15.0) + aws-partitions (1.70.0) + aws-sdk-core (3.17.0) aws-partitions (~> 1.0) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-kms (1.4.0) + aws-sdk-kms (1.5.0) aws-sdk-core (~> 3) aws-sigv4 (~> 1.0) - aws-sdk-s3 (1.8.0) + aws-sdk-s3 (1.8.2) aws-sdk-core (~> 3) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.0) @@ -22,7 +22,7 @@ GEM claide (1.0.2) colored (1.2) colored2 (3.1.2) - commander-fastlane (4.4.5) + commander-fastlane (4.4.6) highline (~> 1.7.2) declarative (0.0.10) declarative-option (0.1.0) @@ -38,20 +38,20 @@ GEM faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) fastimage (2.1.1) - fastlane (2.80.0) + fastlane (2.85.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) bundler (>= 1.12.0, < 2.0.0) colored - commander-fastlane (>= 4.4.5, < 5.0.0) + commander-fastlane (>= 4.4.6, < 5.0.0) dotenv (>= 2.1.1, < 3.0.0) excon (>= 0.45.0, < 1.0.0) faraday (~> 0.9) faraday-cookie_jar (~> 0.0.6) faraday_middleware (~> 0.9) fastimage (>= 2.1.0, < 3.0.0) - gh_inspector (>= 1.0.1, < 2.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) google-api-client (>= 0.13.1, < 0.14.0) highline (>= 1.7.2, < 2.0.0) json (< 3.0.0) @@ -76,7 +76,7 @@ GEM fastlane-plugin-android_change_string_app_name (0.1.1) nokogiri fastlane-plugin-find_replace_string (0.1.0) - gh_inspector (1.1.1) + gh_inspector (1.1.3) google-api-client (0.13.6) addressable (~> 2.5, >= 2.5.1) googleauth (~> 0.5) From c4709a4eade72c911b32e838cb83eb7971649f10 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 16 Mar 2018 19:30:50 +0200 Subject: [PATCH 07/14] Bump Android build number to 90 --- android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 07c8216b5..5c4ff5abc 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -111,7 +111,7 @@ android { applicationId "com.mattermost.rnbeta" minSdkVersion 21 targetSdkVersion 23 - versionCode 89 + versionCode 90 versionName "1.7.0" multiDexEnabled true ndk { From f85880d0659553fca797bf055744af2795f09af4 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 22 Mar 2018 00:06:23 +0200 Subject: [PATCH 08/14] MM-9415 Fix convertion of heic to jpg (#1529) --- app/actions/views/file_upload.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/actions/views/file_upload.js b/app/actions/views/file_upload.js index c77cd0a52..bf4f29d8b 100644 --- a/app/actions/views/file_upload.js +++ b/app/actions/views/file_upload.js @@ -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); From 1114c3f8ddbcd80e1d2668dfc81e219f075e4e21 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 22 Mar 2018 02:59:54 +0200 Subject: [PATCH 09/14] MM-9920 Fix Invalid or missing team_id parameter in request URL (#1530) * MM-9920 Fix Invalid or missing team_id parameter in request URL * Feedback review --- .../channel_drawer/channels_list/filtered_list/filtered_list.js | 1 - .../channel_drawer/channels_list/filtered_list/index.js | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/components/channel_drawer/channels_list/filtered_list/filtered_list.js b/app/components/channel_drawer/channels_list/filtered_list/filtered_list.js index 5d87373d5..067aa6133 100644 --- a/app/components/channel_drawer/channels_list/filtered_list/filtered_list.js +++ b/app/components/channel_drawer/channels_list/filtered_list/filtered_list.js @@ -53,7 +53,6 @@ class FilteredList extends Component { }; static defaultProps = { - currentTeam: {}, currentChannel: {}, pastDirectMessages: [], }; diff --git a/app/components/channel_drawer/channels_list/filtered_list/index.js b/app/components/channel_drawer/channels_list/filtered_list/index.js index ac8fba2bd..68f3bf3e1 100644 --- a/app/components/channel_drawer/channels_list/filtered_list/index.js +++ b/app/components/channel_drawer/channels_list/filtered_list/index.js @@ -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), From fb9760b5a600b8d5052f3a12c2b12b6e73f1c645 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 22 Mar 2018 16:08:03 +0200 Subject: [PATCH 10/14] MM-9921 Load select team screen when user has no teams (#1527) * MM-9921 Load select team screen when user has no teams * Revert to PureComponent --- app/components/root/root.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/root/root.js b/app/components/root/root.js index 1237dd29a..59b0632c9 100644 --- a/app/components/root/root.js +++ b/app/components/root/root.js @@ -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(); From 3bd7275cfa949ea4758a0b3f10dc496a02c04f12 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 22 Mar 2018 16:08:27 +0200 Subject: [PATCH 11/14] Rename slack attachment to message attachment and fix border color on Android (#1533) --- .../index.js | 6 +++--- .../interactive_action/index.js | 0 .../interactive_action/interactive_action.js | 0 .../message_attachment.js} | 10 +++++++--- .../post_body_additional_content.js | 8 ++++---- 5 files changed, 14 insertions(+), 10 deletions(-) rename app/components/{slack_attachments => message_attachments}/index.js (91%) rename app/components/{slack_attachments => message_attachments}/interactive_action/index.js (100%) rename app/components/{slack_attachments => message_attachments}/interactive_action/interactive_action.js (100%) rename app/components/{slack_attachments/slack_attachment.js => message_attachments/message_attachment.js} (97%) diff --git a/app/components/slack_attachments/index.js b/app/components/message_attachments/index.js similarity index 91% rename from app/components/slack_attachments/index.js rename to app/components/message_attachments/index.js index 7a63401ec..ac08deabb 100644 --- a/app/components/slack_attachments/index.js +++ b/app/components/message_attachments/index.js @@ -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( - { 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, }, diff --git a/app/components/post_body_additional_content/post_body_additional_content.js b/app/components/post_body_additional_content/post_body_additional_content.js index 85fea118a..15831c0d5 100644 --- a/app/components/post_body_additional_content/post_body_additional_content.js +++ b/app/components/post_body_additional_content/post_body_additional_content.js @@ -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 ( - Date: Thu, 22 Mar 2018 19:08:59 +0200 Subject: [PATCH 12/14] MM-9926 Fix iOS crash caused by permissions (#1535) --- app/components/attachment_button.js | 74 ++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/app/components/attachment_button.js b/app/components/attachment_button.js index dbdedc122..bb068746b 100644 --- a/app/components/attachment_button.js +++ b/app/components/attachment_button.js @@ -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); }; From 5c773221d4ac2fc21473dbe89e53d985bbc6799f Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 23 Mar 2018 11:19:25 +0300 Subject: [PATCH 13/14] Bump Android build number to 91 (#1536) --- android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5c4ff5abc..ad3578719 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -111,7 +111,7 @@ android { applicationId "com.mattermost.rnbeta" minSdkVersion 21 targetSdkVersion 23 - versionCode 90 + versionCode 91 versionName "1.7.0" multiDexEnabled true ndk { From 91ccf2e51f180f13efefc088277084a06b455cce Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 23 Mar 2018 11:19:52 +0300 Subject: [PATCH 14/14] Bump iOS build number to 91 (#1537) --- ios/Mattermost.xcodeproj/project.pbxproj | 4 ++-- ios/Mattermost/Info.plist | 2 +- ios/MattermostShare/Info.plist | 2 +- ios/MattermostTests/Info.plist | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index e5723058b..160317d8f 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -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; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index 7bb4d6a74..965bf8a7d 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 90 + 91 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index b82b8d1de..fb798a102 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -23,7 +23,7 @@ CFBundleShortVersionString 1.7.0 CFBundleVersion - 90 + 91 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index d45ef9a01..2a56a9fa6 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 90 + 91