From 8807df13091a21b9d9fa84707ab47c62354c4471 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 26 Apr 2018 12:23:17 -0300 Subject: [PATCH 1/3] Fix white screen of death and code/text preview in iOS (#1627) --- .../profile_picture/profile_picture.js | 29 ++++++++--------- app/screens/code/code.js | 32 ++++--------------- app/screens/text_preview/text_preview.js | 32 ++++--------------- 3 files changed, 26 insertions(+), 67 deletions(-) diff --git a/app/components/profile_picture/profile_picture.js b/app/components/profile_picture/profile_picture.js index c58da5435..869a816c6 100644 --- a/app/components/profile_picture/profile_picture.js +++ b/app/components/profile_picture/profile_picture.js @@ -10,6 +10,7 @@ import {Client4} from 'mattermost-redux/client'; import UserStatus from 'app/components/user_status'; import ImageCacheManager from 'app/utils/image_cache_manager'; +import {emptyFunction} from 'app/utils/general'; import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; import placeholder from 'assets/images/profile.jpg'; @@ -63,27 +64,25 @@ export default class ProfilePicture extends PureComponent { } componentWillUpdate(nextProps) { - if ( - Boolean(nextProps.user) !== Boolean(this.props.user) || - nextProps.user.id !== this.props.user.id || - nextProps.user.last_picture_update !== this.props.user.last_picture_update - ) { - this.setState({pictureUrl: null}); + if (this.mounted) { + const url = this.state.pictureUrl; + const nextUrl = nextProps.user ? Client4.getProfilePictureUrl(nextProps.user.id, nextProps.user.last_picture_update) : null; - const nextUser = nextProps.user; + if (url !== nextUrl) { + this.setState({ + pictureUrl: nextUrl, + }); - if (this.mounted) { - this.setState({pictureUrl: null}); + if (nextUrl) { + // empty function is so that promise unhandled is not triggered in dev mode + ImageCacheManager.cache('', nextUrl, this.setImageUrl).then(emptyFunction).catch(emptyFunction); + } } - if (nextUser) { - ImageCacheManager.cache('', Client4.getProfilePictureUrl(nextUser.id, nextUser.last_picture_update), this.setImageURL); + if (nextProps.edit && nextProps.imageUri !== this.props.imageUri) { + this.setImageURL(nextProps.imageUri); } } - - if (nextProps.edit && nextProps.imageUri !== this.props.imageUri) { - this.setImageURL(nextProps.imageUri); - } } componentWillUnmount() { diff --git a/app/screens/code/code.js b/app/screens/code/code.js index 3a98bd048..d4c73bc6e 100644 --- a/app/screens/code/code.js +++ b/app/screens/code/code.js @@ -8,7 +8,6 @@ import { ScrollView, StyleSheet, Text, - TextInput, View, } from 'react-native'; @@ -50,27 +49,6 @@ export default class Code extends React.PureComponent { lineNumbersStyle = style.lineNumbers; } - let textComponent; - if (Platform.OS === 'ios') { - textComponent = ( - - ); - } else { - textComponent = ( - - {this.props.content} - - ); - } - return ( - {textComponent} + + {this.props.content} + ); @@ -131,9 +114,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { android: { paddingVertical: 4, }, - ios: { - top: -4, - }, }), }, codeText: { diff --git a/app/screens/text_preview/text_preview.js b/app/screens/text_preview/text_preview.js index 5a662574d..a74d67da7 100644 --- a/app/screens/text_preview/text_preview.js +++ b/app/screens/text_preview/text_preview.js @@ -8,7 +8,6 @@ import { ScrollView, StyleSheet, Text, - TextInput, View, } from 'react-native'; @@ -50,27 +49,6 @@ export default class TextPreview extends React.PureComponent { lineNumbersStyle = style.lineNumbers; } - let textComponent; - if (Platform.OS === 'ios') { - textComponent = ( - - ); - } else { - textComponent = ( - - {this.props.content} - - ); - } - return ( - {textComponent} + + {this.props.content} + ); @@ -132,9 +115,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { android: { paddingVertical: 4, }, - ios: { - top: -4, - }, }), }, codeText: { From 14b8e072cf80375ad83976265727f41607b35426 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 26 Apr 2018 12:54:51 -0300 Subject: [PATCH 2/3] Bump iOS build number to 98 (#1628) --- 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 942863ad1..1e53b42f8 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 = 97; + CURRENT_PROJECT_VERSION = 98; 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 = 97; + CURRENT_PROJECT_VERSION = 98; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index d80b48292..beb6ca299 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 97 + 98 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index 68f4395e4..f62e4b23a 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -23,7 +23,7 @@ CFBundleShortVersionString 1.8.0 CFBundleVersion - 97 + 98 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index 09fba9bfc..17a6ff104 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 97 + 98 From 02499c5f990b40ee4602b3da15ab8f7f074b8aab Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 26 Apr 2018 12:57:21 -0300 Subject: [PATCH 3/3] Bump Android build number to 98 (#1629) --- 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 6845c84ab..6bd26a4ee 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 97 + versionCode 98 versionName "1.8.0" multiDexEnabled true ndk {