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/android/app/build.gradle b/android/app/build.gradle index cbbc39478..13ea72d2b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -113,8 +113,8 @@ android { applicationId "com.mattermost.rnbeta" minSdkVersion 21 targetSdkVersion 23 - versionCode 114 - versionName "1.9.1" + versionCode 115 + versionName "1.9.2" ndk { abiFilters "armeabi-v7a", "x86" } diff --git a/app/actions/views/root.js b/app/actions/views/root.js index 04f30a5dc..d158d8cbe 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)); diff --git a/app/components/attachment_button.js b/app/components/attachment_button.js index 7c3514145..6db71b5d8 100644 --- a/app/components/attachment_button.js +++ b/app/components/attachment_button.js @@ -168,6 +168,9 @@ export default class AttachmentButton extends PureComponent { } } + // Decode file uri to get the actual path + res.uri = decodeURIComponent(res.uri); + this.uploadFiles([res]); }); } diff --git a/app/components/post_textbox/post_textbox.js b/app/components/post_textbox/post_textbox.js index c28e081d2..531be6ba1 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 {General, 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 {confirmOutOfOfficeDisabled} from 'app/utils/status'; import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; @@ -527,7 +526,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 ( - - ); - } -} diff --git a/app/screens/image_preview/downloader.ios.js b/app/screens/image_preview/downloader.ios.js index fc7ef6dca..a7f584913 100644 --- a/app/screens/image_preview/downloader.ios.js +++ b/app/screens/image_preview/downloader.ios.js @@ -278,67 +278,53 @@ 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 certificate = await mattermostBucket.getPreference('cert', LocalConfig.AppGroupId); + const imageUrl = Client4.getFileUrl(data.id); + const options = { + session: data.id, + timeout: 10000, + indicator: true, + overwrite: true, + certificate, + }; - if (downloadFile) { - const certificate = await mattermostBucket.getPreference('cert', LocalConfig.AppGroupId); - const imageUrl = Client4.getFileUrl(data.id); - const options = { - session: data.id, - timeout: 10000, - indicator: true, - overwrite: true, - certificate, - }; - - 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 4f376f367..75b4702d5 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}); }; diff --git a/app/utils/sentry/middleware.js b/app/utils/sentry/middleware.js index d64d54bf7..dd253e6b4 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'; }); } 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' diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index bb524437f..fe139720a 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -2533,7 +2533,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; @@ -2583,7 +2583,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..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 @@ -34,7 +34,7 @@ CFBundleVersion - 114 + 115 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index 5aadd76c5..dda69e6ca 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -21,9 +21,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleVersion - 114 + 115 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index f77538025..1d380a42f 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.9.1 + 1.9.2 CFBundleSignature ???? CFBundleVersion - 114 + 115 diff --git a/package-lock.json b/package-lock.json index f22687864..e860d9c80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10100,8 +10100,8 @@ } }, "mattermost-redux": { - "version": "github:mattermost/mattermost-redux#023c043afea98ca35e9c0724d280eef09541da40", - "from": "github:mattermost/mattermost-redux#023c043afea98ca35e9c0724d280eef09541da40", + "version": "github:mattermost/mattermost-redux#ab7fa589f8bbad4f1b2e39f13342dc12d0df98fa", + "from": "github:mattermost/mattermost-redux#ab7fa589f8bbad4f1b2e39f13342dc12d0df98fa", "requires": { "deep-equal": "1.0.1", "eslint-plugin-header": "1.2.0", diff --git a/package.json b/package.json index 9c5e36706..9d09af02e 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#023c043afea98ca35e9c0724d280eef09541da40", + "mattermost-redux": "github:mattermost/mattermost-redux#ab7fa589f8bbad4f1b2e39f13342dc12d0df98fa", "mime-db": "1.33.0", "prop-types": "15.6.1", "react": "16.3.2",