diff --git a/android/app/build.gradle b/android/app/build.gradle index 6bd7c106d..b76419f12 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -113,7 +113,7 @@ android { applicationId "com.mattermost.rnbeta" minSdkVersion 21 targetSdkVersion 26 - versionCode 139 + versionCode 140 versionName "1.12.0" multiDexEnabled = true ndk { diff --git a/app/actions/views/more_dms.js b/app/actions/views/more_dms.js index 4b6e55d8b..79180f729 100644 --- a/app/actions/views/more_dms.js +++ b/app/actions/views/more_dms.js @@ -23,7 +23,7 @@ export function makeDirectChannel(otherUserId, switchToChannel = true) { dispatch(toggleDMChannel(otherUserId, 'true', channel.id)); } else { - result = await createDirectChannel(currentUserId, otherUserId)(dispatch, getState); + result = await dispatch(createDirectChannel(currentUserId, otherUserId)); channel = result.data; } diff --git a/app/components/sidebars/main/channels_list/channels_list.js b/app/components/sidebars/main/channels_list/channels_list.js index 2c203f93c..3b4100fac 100644 --- a/app/components/sidebars/main/channels_list/channels_list.js +++ b/app/components/sidebars/main/channels_list/channels_list.js @@ -56,15 +56,15 @@ export default class ChannelsList extends PureComponent { } onSelectChannel = (channel, currentChannelId) => { - if (this.refs.search_bar) { - this.refs.search_bar.cancel(); - } - if (channel.fake) { this.props.onJoinChannel(channel, currentChannelId); } else { this.props.onSelectChannel(channel, currentChannelId); } + + if (this.refs.search_bar) { + this.refs.search_bar.cancel(); + } }; onSearch = (term) => { diff --git a/app/components/sidebars/main/main_sidebar.js b/app/components/sidebars/main/main_sidebar.js index 95182077b..f2c388db4 100644 --- a/app/components/sidebars/main/main_sidebar.js +++ b/app/components/sidebars/main/main_sidebar.js @@ -164,7 +164,7 @@ export default class ChannelSidebar extends Component { } }; - selectChannel = (channel, currentChannelId) => { + selectChannel = (channel, currentChannelId, closeDrawer = true) => { const { actions, } = this.props; @@ -176,7 +176,10 @@ export default class ChannelSidebar extends Component { tracker.channelSwitch = Date.now(); - this.closeChannelDrawer(); + if (closeDrawer) { + this.closeChannelDrawer(); + setChannelLoading(channel.id !== currentChannelId); + } if (!channel) { const utils = require('app/utils/general'); @@ -189,15 +192,15 @@ export default class ChannelSidebar extends Component { const erroMessage = {}; utils.alertErrorWithFallback(intl, erroMessage, unableToJoinMessage); + setChannelLoading(false); return; } - setChannelLoading(channel.id !== currentChannelId); setChannelDisplayName(channel.display_name); EventEmitter.emit('switch_channel', channel, currentChannelId); }; - joinChannel = async (channel, currentChannelId) => { + joinChannel = (channel, currentChannelId) => { const {intl} = this.context; const { actions, @@ -210,37 +213,45 @@ export default class ChannelSidebar extends Component { makeDirectChannel, } = actions; - const displayValue = {displayName: channel.display_name}; - const utils = require('app/utils/general'); + this.closeChannelDrawer(); + actions.setChannelLoading(channel.id !== currentChannelId); - let result; - if (channel.type === General.DM_CHANNEL) { - result = await makeDirectChannel(channel.id, false); + setTimeout(async () => { + const displayValue = {displayName: channel.display_name}; + const utils = require('app/utils/general'); - if (result.error) { - const dmFailedMessage = { - id: 'mobile.open_dm.error', - defaultMessage: "We couldn't open a direct message with {displayName}. Please check your connection and try again.", - }; - utils.alertErrorWithFallback(intl, result.error, dmFailedMessage, displayValue); + let result; + if (channel.type === General.DM_CHANNEL) { + result = await makeDirectChannel(channel.id, false); + + if (result.error) { + const dmFailedMessage = { + id: 'mobile.open_dm.error', + defaultMessage: "We couldn't open a direct message with {displayName}. Please check your connection and try again.", + }; + utils.alertErrorWithFallback(intl, result.error, dmFailedMessage, displayValue); + } + } else { + result = await joinChannel(currentUserId, currentTeamId, channel.id); + + if (result.error || !result.data || !result.data.channel) { + const joinFailedMessage = { + id: 'mobile.join_channel.error', + defaultMessage: "We couldn't join the channel {displayName}. Please check your connection and try again.", + }; + utils.alertErrorWithFallback(intl, result.error, joinFailedMessage, displayValue); + } } - } else { - result = await joinChannel(currentUserId, currentTeamId, channel.id); - if (result.error || !result.data || !result.data.channel) { - const joinFailedMessage = { - id: 'mobile.join_channel.error', - defaultMessage: "We couldn't join the channel {displayName}. Please check your connection and try again.", - }; - utils.alertErrorWithFallback(intl, result.error, joinFailedMessage, displayValue); + if (result.error || (!result.data && !result.data.channel)) { + actions.setChannelLoading(false); + return; } - } - if (result.error) { - return; - } - - this.selectChannel(result.data.channel || result.data, currentChannelId); + requestAnimationFrame(() => { + this.selectChannel(result.data.channel || result.data, currentChannelId, false); + }); + }, 200); }; onPageSelected = (index) => { diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index 96daa5f8e..b5fcddcd0 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -2427,7 +2427,7 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 139; + CURRENT_PROJECT_VERSION = 140; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; @@ -2476,7 +2476,7 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 139; + CURRENT_PROJECT_VERSION = 140; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index b2bebf07d..03e18129a 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 139 + 140 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index f43165f21..e099d857c 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -23,7 +23,7 @@ CFBundleShortVersionString 1.12.0 CFBundleVersion - 139 + 140 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index 7ea9159f1..61c07c1ae 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 139 + 140