diff --git a/android/app/build.gradle b/android/app/build.gradle index 7e38ec8a1..1015f3d89 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 118 + versionCode 119 versionName "1.10.0" ndk { abiFilters "armeabi-v7a", "x86" diff --git a/app/store/index.js b/app/store/index.js index b2ce5492a..ad8860e20 100644 --- a/app/store/index.js +++ b/app/store/index.js @@ -20,7 +20,7 @@ import {createSentryMiddleware} from 'app/utils/sentry/middleware'; import mattermostBucket from 'app/mattermost_bucket'; import Config from 'assets/config'; -import {messageRetention, shareExtensionData} from './middleware'; +import {messageRetention} from './middleware'; import {transformSet} from './utils'; function getAppReducer() { @@ -208,6 +208,11 @@ export default function configureAppStore(initialState) { }, ])); + // When logging out remove the data stored in the bucket + mattermostBucket.removePreference('cert', Config.AppGroupId); + mattermostBucket.removePreference('emm', Config.AppGroupId); + mattermostBucket.removeFile('entities', Config.AppGroupId); + setTimeout(() => { purging = false; }, 500); @@ -267,7 +272,7 @@ export default function configureAppStore(initialState) { }, }; - const additionalMiddleware = [createSentryMiddleware(), messageRetention, shareExtensionData]; + const additionalMiddleware = [createSentryMiddleware(), messageRetention]; return configureStore(initialState, appReducer, offlineOptions, getAppReducer, { additionalMiddleware, }); diff --git a/app/store/middleware.js b/app/store/middleware.js index 2ada8e05f..1321a1678 100644 --- a/app/store/middleware.js +++ b/app/store/middleware.js @@ -3,12 +3,8 @@ import DeviceInfo from 'react-native-device-info'; -import {UserTypes} from 'mattermost-redux/action_types'; - import {ViewTypes} from 'app/constants'; import initialState from 'app/initial_state'; -import mattermostBucket from 'app/mattermost_bucket'; -import Config from 'assets/config'; import { captureException, @@ -354,22 +350,6 @@ function cleanupState(action, keepCurrent = false) { }; } -export function shareExtensionData() { - return (next) => (action) => { - // allow other middleware to do their things - const nextAction = next(action); - - switch (action.type) { - case UserTypes.LOGOUT_SUCCESS: - mattermostBucket.removePreference('cert', Config.AppGroupId); - mattermostBucket.removePreference('emm', Config.AppGroupId); - mattermostBucket.removeFile('entities', Config.AppGroupId); - break; - } - return nextAction; - }; -} - function removePendingPost(pendingPostIds, id) { const pendingIndex = pendingPostIds.indexOf(id); if (pendingIndex !== -1) { diff --git a/app/utils/error_handling.js b/app/utils/error_handling.js index 380fd0785..b0429c097 100644 --- a/app/utils/error_handling.js +++ b/app/utils/error_handling.js @@ -24,16 +24,16 @@ import { import {app, store} from 'app/mattermost'; const errorHandler = (e, isFatal) => { - console.warn('Handling Javascript error ' + JSON.stringify(e)); // eslint-disable-line no-console - const {dispatch, getState} = store; + console.warn('Handling Javascript error ', e); // eslint-disable-line no-console + const {dispatch} = store; captureException(e, LOGGER_JAVASCRIPT, store); const translations = app.getTranslations(); - closeWebSocket()(dispatch, getState); + dispatch(closeWebSocket()); if (Client4.getUrl()) { - logError(e)(dispatch, getState); + dispatch(logError(e)); } if (isFatal) { @@ -44,7 +44,7 @@ const errorHandler = (e, isFatal) => { text: translations['mobile.error_handler.button'], onPress: () => { // purge the store - purgeOfflineStore()(dispatch, getState); + dispatch(purgeOfflineStore()); }, }], {cancelable: false} diff --git a/app/utils/sentry/index.js b/app/utils/sentry/index.js index 9edb203ca..af184abfc 100644 --- a/app/utils/sentry/index.js +++ b/app/utils/sentry/index.js @@ -45,9 +45,11 @@ function getDsn() { } export function captureException(error, logger, store) { - capture(() => { - Sentry.captureException(error, {logger}); - }, store); + if (error && logger && store) { + capture(() => { + Sentry.captureException(error, {logger}); + }, store); + } } export function captureExceptionWithoutState(err, logger) { @@ -55,17 +57,21 @@ export function captureExceptionWithoutState(err, logger) { return; } - try { - Sentry.captureException(err, {logger}); - } catch (error) { - // do nothing... + if (err && logger) { + try { + Sentry.captureException(err, {logger}); + } catch (error) { + // do nothing... + } } } export function captureMessage(message, logger, store) { - capture(() => { - Sentry.captureMessage(message, {logger}); - }, store); + if (message && logger && store) { + capture(() => { + Sentry.captureMessage(message, {logger}); + }, store); + } } // Wrapper function to any calls to Sentry so that we can gather any necessary extra data diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index 2c9070753..00c4697d7 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -2532,7 +2532,11 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; +<<<<<<< HEAD CURRENT_PROJECT_VERSION = 118; +======= + CURRENT_PROJECT_VERSION = 119; +>>>>>>> release-1.9 DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; @@ -2582,7 +2586,11 @@ CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; +<<<<<<< HEAD CURRENT_PROJECT_VERSION = 118; +======= + CURRENT_PROJECT_VERSION = 119; +>>>>>>> release-1.9 DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index b0c50c672..71a8bdbb1 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -19,7 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString +<<<<<<< HEAD 1.10.0 +======= + 1.9.3 +>>>>>>> release-1.9 CFBundleSignature ???? CFBundleURLTypes @@ -34,7 +38,11 @@ CFBundleVersion +<<<<<<< HEAD 118 +======= + 119 +>>>>>>> release-1.9 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostBucket.m b/ios/MattermostBucket.m index 13358e70b..49ca7e403 100644 --- a/ios/MattermostBucket.m +++ b/ios/MattermostBucket.m @@ -81,7 +81,9 @@ RCT_EXPORT_METHOD(removePreference:(NSString *) key if(![fileManager fileExistsAtPath:filePath]) { [fileManager createFileAtPath:filePath contents:nil attributes:nil]; } - [content writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + if ([content length] > 0) { + [content writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + } } -(NSString *)readFromFile:(NSString *)fileName appGroupId:(NSString *)appGroupId { @@ -107,7 +109,9 @@ RCT_EXPORT_METHOD(removePreference:(NSString *) key -(void) setPreference:(NSString *)key value:(NSString *) value appGroupId:(NSString*)appGroupId { NSUserDefaults* bucket = [self bucketByName: appGroupId]; - [bucket setObject:value forKey:key]; + if ([key length] > 0 && [value length] > 0) { + [bucket setObject:value forKey:key]; + } } -(id) getPreference:(NSString *)key appGroupId:(NSString*)appGroupId { diff --git a/ios/MattermostShare/Info.plist b/ios/MattermostShare/Info.plist index 5fd0bbd17..6228ba53d 100644 --- a/ios/MattermostShare/Info.plist +++ b/ios/MattermostShare/Info.plist @@ -21,9 +21,15 @@ CFBundlePackageType XPC! CFBundleShortVersionString +<<<<<<< HEAD 1.10.0 CFBundleVersion 118 +======= + 1.9.3 + CFBundleVersion + 119 +>>>>>>> release-1.9 NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index 0b555fc07..074beee82 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -15,10 +15,18 @@ CFBundlePackageType BNDL CFBundleShortVersionString +<<<<<<< HEAD 1.10.0 CFBundleSignature ???? CFBundleVersion 118 +======= + 1.9.3 + CFBundleSignature + ???? + CFBundleVersion + 119 +>>>>>>> release-1.9