From 599fa7b4e17a03a1727fa8f9617055b6d206ad96 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 25 Jun 2018 11:25:31 -0400 Subject: [PATCH 01/11] MM-11018 Provide default message for Sentry breadcrumbs (#1819) --- app/utils/sentry/middleware.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/utils/sentry/middleware.js b/app/utils/sentry/middleware.js index 8822dfb81..434fadba6 100644 --- a/app/utils/sentry/middleware.js +++ b/app/utils/sentry/middleware.js @@ -19,23 +19,22 @@ export function createSentryMiddleware() { } function makeBreadcrumbFromAction(action) { + if (!action.type) { + console.warn('dispatching action with undefined type', action); // eslint-disable-line no-console + } + const breadcrumb = { category: BREADCRUMB_REDUX_ACTION, - message: action.type, + message: action.type || 'undefined action', }; - if (action.type === BATCH) { - // Attach additional information so that batched actions display what they're doing - breadcrumb.data = action.payload.map((a) => a.type); - } - if (action.type === BATCH) { // Attach additional information so that batched actions display what they're doing, and make it // into an object because that's what is expected breadcrumb.data = {}; action.payload.forEach((a, index) => { - breadcrumb.data[index] = a.type; + breadcrumb.data[index] = a.type || 'undefined action'; }); } From f30d278cf1a935743e4600515f23d7b869fec642 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 25 Jun 2018 11:39:17 -0400 Subject: [PATCH 02/11] Revert "MM-10822 Change post textbox to only be partially connected" (#1820) This reverts commit 3703309fad1b73b9b70b8816d0253fb2c7046939. --- app/components/post_textbox/post_textbox.js | 5 +- app/components/quick_text_input.js | 86 --------------------- 2 files changed, 2 insertions(+), 89 deletions(-) delete mode 100644 app/components/quick_text_input.js diff --git a/app/components/post_textbox/post_textbox.js b/app/components/post_textbox/post_textbox.js index 38c425355..a6f5cddc6 100644 --- a/app/components/post_textbox/post_textbox.js +++ b/app/components/post_textbox/post_textbox.js @@ -3,7 +3,7 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; -import {Alert, BackHandler, Keyboard, Platform, Text, TouchableOpacity, View} from 'react-native'; +import {Alert, BackHandler, Keyboard, Platform, Text, TextInput, TouchableOpacity, View} from 'react-native'; import {intlShape} from 'react-intl'; import {RequestStatus} from 'mattermost-redux/constants'; import EventEmitter from 'mattermost-redux/utils/event_emitter'; @@ -11,7 +11,6 @@ import EventEmitter from 'mattermost-redux/utils/event_emitter'; import AttachmentButton from 'app/components/attachment_button'; import Autocomplete from 'app/components/autocomplete'; import FileUploadPreview from 'app/components/file_upload_preview'; -import QuickTextInput from 'app/components/quick_text_input'; import {INITIAL_HEIGHT, INSERT_TO_COMMENT, INSERT_TO_DRAFT, IS_REACTION_REGEX, MAX_CONTENT_HEIGHT, MAX_FILE_COUNT} from 'app/constants/post_textbox'; import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; @@ -495,7 +494,7 @@ export default class PostTextbox extends PureComponent { {!channelIsReadOnly && attachmentButton} - { - if (!this.input) { - return; - } - - this.input.setNativeProps({text: this.props.value}); - } - - get value() { - return this.input.value; - } - - set value(value) { - this.input.setNativeProps({text: this.props.value}); - } - - focus() { - this.input.focus(); - } - - blur() { - this.input.blur(); - } - - getInput = () => { - return this.input; - }; - - setInput = (input) => { - this.input = input; - } - - render() { - const {value, ...props} = this.props; - - Reflect.deleteProperty(props, 'delayInputUpdate'); - - // Only set the defaultValue since the real one will be updated using componentDidUpdate if necessary - return ( - - ); - } -} From 71e16afbb41382e8bcd147defca023d57393766d Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 11:44:42 -0400 Subject: [PATCH 03/11] Fix bad action when tapping on a push notification (#1822) --- app/actions/views/root.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/actions/views/root.js b/app/actions/views/root.js index fa8cfdb71..131719a9f 100644 --- a/app/actions/views/root.js +++ b/app/actions/views/root.js @@ -87,7 +87,7 @@ export function loadFromPushNotification(notification) { // we should get the posts if (channelId === currentChannelId) { dispatch(markChannelAsRead(channelId, null, false)); - await dispatch(retryGetPostsAction(getPosts(channelId))); + await retryGetPostsAction(getPosts(channelId), dispatch, getState); } else { // when the notification is from a channel other than the current channel dispatch(markChannelAsRead(channelId, currentChannelId, false)); From b102e99f438b2fd5c3849bec90c434f67d75e7d0 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 11:45:07 -0400 Subject: [PATCH 04/11] Fix uploading files with blank spaces in the filename (#1821) --- app/components/attachment_button.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/components/attachment_button.js b/app/components/attachment_button.js index 189f0c612..b23960eb7 100644 --- a/app/components/attachment_button.js +++ b/app/components/attachment_button.js @@ -166,6 +166,9 @@ export default class AttachmentButton extends PureComponent { } } + // Decode file uri to get the actual path + res.uri = decodeURIComponent(res.uri); + this.uploadFiles([res]); }); } From 763016cf1a93af2150a04b55be70e0f91fa91ffe Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 25 Jun 2018 12:08:07 -0400 Subject: [PATCH 05/11] MM-11016 Updated redux to not error when failing to parse websocket origin (#1823) --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3de0eda78..55fbc8832 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10100,8 +10100,8 @@ } }, "mattermost-redux": { - "version": "github:mattermost/mattermost-redux#d2e9ba4f30a7bdfccda9aab1cfa8124c4ca1f275", - "from": "github:mattermost/mattermost-redux#d2e9ba4f30a7bdfccda9aab1cfa8124c4ca1f275", + "version": "github:mattermost/mattermost-redux#d0b887aa93d1f9527016258dfc226f802723433d", + "from": "github:mattermost/mattermost-redux#d0b887aa93d1f9527016258dfc226f802723433d", "requires": { "deep-equal": "1.0.1", "eslint-plugin-header": "1.2.0", diff --git a/package.json b/package.json index adb0de5d7..76c790ee3 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "intl": "1.2.5", "jail-monkey": "1.0.0", "jsc-android": "216113.0.3", - "mattermost-redux": "github:mattermost/mattermost-redux#d2e9ba4f30a7bdfccda9aab1cfa8124c4ca1f275", + "mattermost-redux": "github:mattermost/mattermost-redux#d0b887aa93d1f9527016258dfc226f802723433d", "mime-db": "1.33.0", "prop-types": "15.6.1", "react": "16.3.2", From 6446b370d2001c44d6c117017251374df14eb4fb Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 12:30:03 -0400 Subject: [PATCH 06/11] Fix opening video when file has localPath set (#1817) --- app/screens/image_preview/downloader.ios.js | 80 +++++++++------------ app/screens/image_preview/video_preview.js | 10 ++- 2 files changed, 41 insertions(+), 49 deletions(-) diff --git a/app/screens/image_preview/downloader.ios.js b/app/screens/image_preview/downloader.ios.js index 81c836d2f..caf405a16 100644 --- a/app/screens/image_preview/downloader.ios.js +++ b/app/screens/image_preview/downloader.ios.js @@ -275,65 +275,51 @@ export default class Downloader extends PureComponent { startDownload = async () => { const {file, downloadPath, prompt, saveToCameraRoll} = this.props; const {data} = file; - let downloadFile = true; try { if (this.state.didCancel) { this.setState({didCancel: false}); } - let path; - let res; - if (data && data.localPath) { - path = data.localPath; - downloadFile = false; - this.setState({ - progress: 100, - started: true, - }); - } + const imageUrl = Client4.getFileUrl(data.id); + const options = { + session: data.id, + timeout: 10000, + indicator: true, + overwrite: true, + }; - if (downloadFile) { - const imageUrl = Client4.getFileUrl(data.id); - const options = { - session: data.id, - timeout: 10000, - indicator: true, - overwrite: true, - }; - - if (downloadPath && prompt) { - const isDir = await RNFetchBlob.fs.isDir(downloadPath); - if (!isDir) { - try { - await RNFetchBlob.fs.mkdir(downloadPath); - } catch (error) { - this.showDownloadFailedAlert(); - return; - } + if (downloadPath && prompt) { + const isDir = await RNFetchBlob.fs.isDir(downloadPath); + if (!isDir) { + try { + await RNFetchBlob.fs.mkdir(downloadPath); + } catch (error) { + this.showDownloadFailedAlert(); + return; } - - options.path = `${downloadPath}/${data.id}-${file.caption}`; - } else { - options.fileCache = true; - options.appendExt = data.extension; } - this.downloadTask = RNFetchBlob.config(options).fetch('GET', imageUrl); - this.downloadTask.progress((received, total) => { - const progress = (received / total) * 100; - if (this.mounted) { - this.setState({ - progress, - started: true, - }); - } - }); - - res = await this.downloadTask; - path = res.path(); + options.path = `${downloadPath}/${data.id}-${file.caption}`; + } else { + options.fileCache = true; + options.appendExt = data.extension; } + this.downloadTask = RNFetchBlob.config(options).fetch('GET', imageUrl); + this.downloadTask.progress((received, total) => { + const progress = (received / total) * 100; + if (this.mounted) { + this.setState({ + progress, + started: true, + }); + } + }); + + const res = await this.downloadTask; + let path = res.path(); + if (saveToCameraRoll) { path = await CameraRoll.saveToCameraRoll(path, 'photo'); } diff --git a/app/screens/image_preview/video_preview.js b/app/screens/image_preview/video_preview.js index e0104751c..0f52fa1a5 100644 --- a/app/screens/image_preview/video_preview.js +++ b/app/screens/image_preview/video_preview.js @@ -40,6 +40,12 @@ export default class VideoPreview extends PureComponent { constructor(props) { super(props); + let path = null; + const {file} = props; + if (file && file.data && file.data.localPath) { + path = file.data.localPath; + } + this.state = { isLoading: true, isFullScreen: false, @@ -47,7 +53,7 @@ export default class VideoPreview extends PureComponent { paused: true, currentTime: 0, duration: 0, - path: null, + path, showDownloader: true, }; } @@ -84,7 +90,7 @@ export default class VideoPreview extends PureComponent { onDownloadSuccess = () => { const {file} = this.props; - const path = `${VIDEOS_PATH}/${file.data.id}-${file.caption}`; + const path = file.data.localPath || `${VIDEOS_PATH}/${file.data.id}-${file.caption}`; this.setState({showDownloader: false, path}); }; From abd67c1bec6bc8545729eae46a1b23955a9ff0d9 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 12:34:15 -0400 Subject: [PATCH 07/11] Always create a temp file for Android share (#1824) --- .../main/java/com/mattermost/share/RealPathUtil.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/android/app/src/main/java/com/mattermost/share/RealPathUtil.java b/android/app/src/main/java/com/mattermost/share/RealPathUtil.java index 69478cb0b..8640f161f 100644 --- a/android/app/src/main/java/com/mattermost/share/RealPathUtil.java +++ b/android/app/src/main/java/com/mattermost/share/RealPathUtil.java @@ -73,16 +73,6 @@ public class RealPathUtil { return uri.getLastPathSegment(); } - try { - String path = getDataColumn(context, uri, null, null); - - if (path != null) { - return path; - } - } catch (Exception e) { - // do nothing and try to get a temp file - } - // Try save to tmp file, and return tmp file path return getPathFromSavingTempFile(context, uri); } else if ("file".equalsIgnoreCase(uri.getScheme())) { From be22eb9a42169c2058814b678459c1fa2b2ae826 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 13:46:50 -0400 Subject: [PATCH 08/11] Fix setting iOS app group id on build time --- Makefile | 10 ---------- fastlane/Fastfile | 6 ++++++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 2f558e789..7c66fafe5 100644 --- a/Makefile +++ b/Makefile @@ -177,10 +177,6 @@ run-android: | check-device-android pre-run prepare-android-build ## Runs the ap fi build-ios: | pre-run check-style ## Creates an iOS build -ifneq ($(IOS_APP_GROUP),) - @mkdir -p assets/override - @echo "{\n\t\"AppGroupId\": \"$$IOS_APP_GROUP\"\n}" > assets/override/config.json -endif @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start & echo; \ @@ -188,7 +184,6 @@ endif @echo "Building iOS app" @cd fastlane && BABEL_ENV=production NODE_ENV=production bundle exec fastlane ios build @ps -e | grep -i "cli.js start" | grep -iv grep | awk '{print $$1}' | xargs kill -9 - @rm -rf assets/override build-android: | pre-run check-style prepare-android-build ## Creates an Android build @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ @@ -205,17 +200,12 @@ unsigned-ios: pre-run check-style npm start & echo; \ fi @echo "Building unsigned iOS app" -ifneq ($(IOS_APP_GROUP),) - @mkdir -p assets/override - @echo "{\n\t\"AppGroupId\": \"$$IOS_APP_GROUP\"\n}" > assets/override/config.json -endif @cd fastlane && NODE_ENV=production bundle exec fastlane ios unsigned @mkdir -p build-ios @cd ios/ && xcodebuild -workspace Mattermost.xcworkspace/ -scheme Mattermost -sdk iphoneos -configuration Relase -parallelizeTargets -resultBundlePath ../build-ios/result -derivedDataPath ../build-ios/ CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO @cd build-ios/ && mkdir -p Payload && cp -R Build/Products/Release-iphoneos/Mattermost.app Payload/ && zip -r Mattermost-unsigned.ipa Payload/ @mv build-ios/Mattermost-unsigned.ipa . @rm -rf build-ios/ - @rm -rf assets/override @ps -e | grep -i "cli.js start" | grep -iv grep | awk '{print $$1}' | xargs kill -9 unsigned-android: pre-run check-style prepare-android-build diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b8dd62eda..3acc0bca4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -145,6 +145,12 @@ platform :ios do entitlements_file: './ios/MattermostShare/MattermostShare.entitlements', app_group_identifiers: [ENV['IOS_APP_GROUP']] ) + + find_replace_string( + path_to_file: './dist/assets/config.json', + old_string: 'group.com.mattermost.rnbeta', + new_string: ENV['IOS_APP_GROUP'] + ) end unless ENV['IOS_EXTENSION_APP_IDENTIFIER'].nil? || ENV['IOS_EXTENSION_APP_IDENTIFIER'].empty? || ENV['IOS_EXTENSION_APP_IDENTIFIER'] == 'com.mattermost.rnbeta.MattermostShare' From e06fa00509c181eaea5b69375f7ee2ff3cee469f Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 14:24:29 -0400 Subject: [PATCH 09/11] Bump iOS build number to 115 (#1825) --- 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 dfe88e55f..5d9b86e71 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -2516,7 +2516,7 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; @@ -2566,7 +2566,7 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index 3ed0b2bb1..4408dd9ca 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 114 + 115 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index 5aadd76c5..981b1265d 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -23,7 +23,7 @@ CFBundleShortVersionString 1.9.1 CFBundleVersion - 114 + 115 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index f77538025..2e206fec4 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 114 + 115 From a373ba3dce17efc9146df9ac25c69e2351508932 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 14:28:51 -0400 Subject: [PATCH 10/11] Bump Android build number to 115 (#1826) --- 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 cbbc39478..e41de4079 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -113,7 +113,7 @@ android { applicationId "com.mattermost.rnbeta" minSdkVersion 21 targetSdkVersion 23 - versionCode 114 + versionCode 115 versionName "1.9.1" ndk { abiFilters "armeabi-v7a", "x86" From c0cb5e3f240533e7c6af2707d5066be4646ca7f1 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 25 Jun 2018 14:48:35 -0400 Subject: [PATCH 11/11] Bump app version to 1.9.2 --- android/app/build.gradle | 2 +- ios/Mattermost/Info.plist | 2 +- ios/MattermostShare/Info.plist | 2 +- ios/MattermostTests/Info.plist | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e41de4079..13ea72d2b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -114,7 +114,7 @@ android { minSdkVersion 21 targetSdkVersion 23 versionCode 115 - versionName "1.9.1" + versionName "1.9.2" ndk { abiFilters "armeabi-v7a", "x86" } diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index 4408dd9ca..ff11ab60f 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleURLTypes diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index 981b1265d..dda69e6ca 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -21,7 +21,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleVersion 115 NSAppTransportSecurity diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index 2e206fec4..1d380a42f 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion