diff --git a/.circleci/config.yml b/.circleci/config.yml index 751e39933..3225b8f63 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,7 +170,7 @@ commands: type: string steps: - attach_workspace: - at: / + at: ~/ - run: name: <> working_directory: fastlane @@ -180,7 +180,7 @@ commands: description: "Persist mattermost-mobile directory" steps: - persist_to_workspace: - root: / + root: ~/ paths: - mattermost-mobile* diff --git a/android/app/build.gradle b/android/app/build.gradle index 44203c5bb..c913cd3a4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -140,7 +140,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60" - versionCode 241 + versionCode 242 versionName "1.25.0" multiDexEnabled = true ndk { diff --git a/app/components/message_attachments/attachment_image/__snapshots__/index.test.js.snap b/app/components/message_attachments/attachment_image/__snapshots__/index.test.js.snap index 75cf22a00..c941946d9 100644 --- a/app/components/message_attachments/attachment_image/__snapshots__/index.test.js.snap +++ b/app/components/message_attachments/attachment_image/__snapshots__/index.test.js.snap @@ -23,7 +23,6 @@ exports[`AttachmentImage it matches snapshot 1`] = ` "borderRadius": 2, "borderWidth": 1, "flex": 1, - "padding": 5, }, Object { "height": 28, diff --git a/app/components/message_attachments/attachment_image/index.js b/app/components/message_attachments/attachment_image/index.js index b30735032..2843c11b3 100644 --- a/app/components/message_attachments/attachment_image/index.js +++ b/app/components/message_attachments/attachment_image/index.js @@ -177,7 +177,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { borderWidth: 1, borderRadius: 2, flex: 1, - padding: 5, }, }; }); diff --git a/app/components/progressive_image/progressive_image.js b/app/components/progressive_image/progressive_image.js index 1db062fd1..1b4d73bd7 100644 --- a/app/components/progressive_image/progressive_image.js +++ b/app/components/progressive_image/progressive_image.js @@ -167,7 +167,7 @@ export default class ProgressiveImage extends PureComponent { resizeMethod={resizeMethod} onError={onError} source={{uri}} - style={StyleSheet.absoluteFill} + style={[StyleSheet.absoluteFill, styles.attachmentMargin]} > {this.props.children} @@ -189,4 +189,10 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, + attachmentMargin: { + marginTop: 2.5, + marginLeft: 2.5, + marginBottom: 5, + marginRight: 5, + }, }); diff --git a/app/screens/channel/channel_base.js b/app/screens/channel/channel_base.js index 65a0ae1d0..eb41aa3c4 100644 --- a/app/screens/channel/channel_base.js +++ b/app/screens/channel/channel_base.js @@ -108,6 +108,8 @@ export default class ChannelBase extends PureComponent { componentWillReceiveProps(nextProps) { if (this.props.theme !== nextProps.theme) { + setNavigatorStyles(this.props.componentId, nextProps.theme); + EphemeralStore.allNavigationComponentIds.forEach((componentId) => { setNavigatorStyles(componentId, nextProps.theme); }); diff --git a/app/screens/channel/channel_base.test.js b/app/screens/channel/channel_base.test.js index 7dc29d405..975bcb907 100644 --- a/app/screens/channel/channel_base.test.js +++ b/app/screens/channel/channel_base.test.js @@ -14,6 +14,7 @@ import ChannelBase from './channel_base'; jest.mock('react-intl'); describe('ChannelBase', () => { + const channelBaseComponentId = 'component-0'; const componentIds = ['component-1', 'component-2', 'component-3']; const baseProps = { actions: { @@ -24,7 +25,7 @@ describe('ChannelBase', () => { recordLoadTime: jest.fn(), getChannelStats: jest.fn(), }, - componentId: componentIds[0], + componentId: channelBaseComponentId, theme: Preferences.THEMES.default, }; const optionsForTheme = (theme) => { @@ -61,7 +62,7 @@ describe('ChannelBase', () => { const themeOptions = optionsForTheme(Preferences.THEMES.default); expect(mergeNavigationOptions.mock.calls).toEqual([ - [componentIds[0], themeOptions], + [baseProps.componentId, themeOptions], ]); mergeNavigationOptions.mockClear(); @@ -69,6 +70,7 @@ describe('ChannelBase', () => { const newThemeOptions = optionsForTheme(Preferences.THEMES.mattermostDark); expect(mergeNavigationOptions.mock.calls).toEqual([ + [baseProps.componentId, newThemeOptions], [componentIds[2], newThemeOptions], [componentIds[1], newThemeOptions], [componentIds[0], newThemeOptions], diff --git a/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap b/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap index 479afcd5c..ba2e68dcb 100644 --- a/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap +++ b/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap @@ -213,7 +213,7 @@ exports[`channel_info_header should match snapshot 1`] = ` "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -364,7 +364,7 @@ exports[`channel_info_header should match snapshot 1`] = ` "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -658,7 +658,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests and is "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -809,7 +809,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests and is "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -1075,7 +1075,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests but its "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -1226,7 +1226,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests but its "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -1520,7 +1520,7 @@ exports[`channel_info_header should match snapshot when GM and hasGuests 1`] = ` "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -1671,7 +1671,7 @@ exports[`channel_info_header should match snapshot when GM and hasGuests 1`] = ` "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -1937,7 +1937,7 @@ exports[`channel_info_header should match snapshot when is group constrained 1`] "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -2088,7 +2088,7 @@ exports[`channel_info_header should match snapshot when is group constrained 1`] "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -2404,7 +2404,7 @@ exports[`channel_info_header should match snapshot when public channel and hasGu "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -2555,7 +2555,7 @@ exports[`channel_info_header should match snapshot when public channel and hasGu "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", diff --git a/app/screens/channel_info/channel_info.js b/app/screens/channel_info/channel_info.js index 208d10c3f..0dc41efad 100644 --- a/app/screens/channel_info/channel_info.js +++ b/app/screens/channel_info/channel_info.js @@ -87,32 +87,29 @@ export default class ChannelInfo extends PureComponent { }; } + static getDerivedStateFromProps(nextProps, state) { + if (state.isFavorite !== nextProps.isFavorite || + state.isMuted !== nextProps.isChannelMuted || + state.ignoreChannelMentions !== nextProps.ignoreChannelMentions) { + return { + isFavorite: nextProps.isFavorite, + isMuted: nextProps.isChannelMuted, + ignoreChannelMentions: nextProps.ignoreChannelMentions, + }; + } + + return null; + } + componentDidMount() { this.props.actions.getChannelStats(this.props.currentChannel.id); this.props.actions.getCustomEmojisInText(this.props.currentChannel.header); } - componentWillReceiveProps(nextProps) { - if (this.props.theme !== nextProps.theme) { - setNavigatorStyles(this.props.componentId, nextProps.theme); + componentDidUpdate(prevProps) { + if (prevProps.theme !== this.props.theme) { + setNavigatorStyles(prevProps.componentId, this.props.theme); } - - let isFavorite = this.state.isFavorite; - if (isFavorite !== nextProps.isFavorite) { - isFavorite = nextProps.isFavorite; - } - - let isMuted = this.state.isMuted; - if (isMuted !== nextProps.isChannelMuted) { - isMuted = nextProps.isChannelMuted; - } - - let ignoreChannelMentions = this.state.ignoreChannelMentions; - if (ignoreChannelMentions !== nextProps.ignoreChannelMentions) { - ignoreChannelMentions = nextProps.ignoreChannelMentions; - } - - this.setState({isFavorite, isMuted, ignoreChannelMentions}); } close = (redirect = true) => { diff --git a/app/screens/edit_channel/edit_channel.js b/app/screens/edit_channel/edit_channel.js index 22aa7f883..c439afc05 100644 --- a/app/screens/edit_channel/edit_channel.js +++ b/app/screens/edit_channel/edit_channel.js @@ -92,6 +92,7 @@ export default class EditChannel extends PureComponent { this.state = { error: null, updating: false, + updateChannelRequest: props.updateChannelRequest, displayName, channelURL, purpose, @@ -114,30 +115,50 @@ export default class EditChannel extends PureComponent { this.emitCanUpdateChannel(false); } - componentWillReceiveProps(nextProps) { - if (this.props.theme !== nextProps.theme) { - setNavigatorStyles(this.props.componentId, nextProps.theme); - } - + static getDerivedStateFromProps(nextProps, state) { const {updateChannelRequest} = nextProps; - if (this.props.updateChannelRequest !== updateChannelRequest) { + if (state.updateChannelRequest !== updateChannelRequest) { + const newState = { + error: null, + updating: true, + updateChannelRequest, + }; + switch (updateChannelRequest.status) { + case RequestStatus.SUCCESS: + newState.updating = false; + break; + case RequestStatus.FAILURE: + newState.error = updateChannelRequest.error; + newState.updating = false; + break; + } + + return newState; + } + return null; + } + + componentDidUpdate(prevProps) { + if (prevProps.theme !== this.props.theme) { + setNavigatorStyles(prevProps.componentId, this.props.theme); + } + + if (prevProps.updateChannelRequest !== this.props.updateChannelRequest) { + switch (this.props.updateChannelRequest.status) { case RequestStatus.STARTED: this.emitUpdating(true); - this.setState({error: null, updating: true}); break; case RequestStatus.SUCCESS: EventEmitter.emit('close_channel_drawer'); InteractionManager.runAfterInteractions(() => { this.emitUpdating(false); - this.setState({error: null, updating: false}); this.close(); }); break; case RequestStatus.FAILURE: this.emitUpdating(false); - this.setState({error: updateChannelRequest.error, updating: false}); break; } } diff --git a/app/screens/interactive_dialog/__snapshots__/dialog_introduction_text.test.js.snap b/app/screens/interactive_dialog/__snapshots__/dialog_introduction_text.test.js.snap index fba0ce2bd..66c8f5a60 100644 --- a/app/screens/interactive_dialog/__snapshots__/dialog_introduction_text.test.js.snap +++ b/app/screens/interactive_dialog/__snapshots__/dialog_introduction_text.test.js.snap @@ -109,7 +109,7 @@ exports[`DialogIntroductionText should render the introduction text correctly 1` "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", diff --git a/app/screens/terms_of_service/__snapshots__/terms_of_service.test.js.snap b/app/screens/terms_of_service/__snapshots__/terms_of_service.test.js.snap index 803b8f1ef..b02f70ca2 100644 --- a/app/screens/terms_of_service/__snapshots__/terms_of_service.test.js.snap +++ b/app/screens/terms_of_service/__snapshots__/terms_of_service.test.js.snap @@ -115,7 +115,7 @@ exports[`TermsOfService should enable/disable navigator buttons on setNavigatorB "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -250,7 +250,7 @@ exports[`TermsOfService should enable/disable navigator buttons on setNavigatorB "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", @@ -450,7 +450,7 @@ exports[`TermsOfService should match snapshot on enableNavigatorLogout 1`] = ` "color": "#2389d7", }, "mention": Object { - "color": "#166de0", + "color": "#2389d7", }, "mention_highlight": Object { "backgroundColor": "#ffe577", diff --git a/app/utils/markdown.js b/app/utils/markdown.js index 50f002aeb..3a0110dc6 100644 --- a/app/utils/markdown.js +++ b/app/utils/markdown.js @@ -81,7 +81,7 @@ export const getMarkdownTextStyles = makeStyleSheetFromTheme((theme) => { fontFamily: codeFont, }, mention: { - color: theme.mentionHighlightLink, + color: theme.linkColor, }, error: { color: theme.errorTextColor, diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index 33b9e1eba..bef59d0e7 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -1060,7 +1060,7 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 240; + CURRENT_PROJECT_VERSION = 242; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; @@ -1098,7 +1098,7 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 240; + CURRENT_PROJECT_VERSION = 242; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index 8c44bcc81..088daeb8b 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 241 + 242 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index e255e6235..062a64deb 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.25.0 CFBundleVersion - 241 + 242 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index f8024cc6d..8a3571d2b 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 241 + 242 diff --git a/ios/NotificationService/Info.plist b/ios/NotificationService/Info.plist index d4fbeb2f1..1d21bc3d6 100644 --- a/ios/NotificationService/Info.plist +++ b/ios/NotificationService/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.25.0 CFBundleVersion - 241 + 242 NSExtension NSExtensionPointIdentifier