Fixes for release 1.42 (#5339) (#5340)

* Downgrade MMKV to 0.4.4

* Handle undefined in getMyTeams selector

* Set minimum server version to 5.31.3 and update unsupported URL

(cherry picked from commit 0a2a490e81)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2021-04-19 17:50:57 +02:00 committed by GitHub
parent da6f326e17
commit 19cd3722e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 47 additions and 48 deletions

View file

@ -112,10 +112,10 @@ const ViewTypes = keyMirror({
});
const RequiredServer = {
FULL_VERSION: 5.31,
FULL_VERSION: '5.31.3',
MAJOR_VERSION: 5,
MIN_VERSION: 31,
PATCH_VERSION: 0,
PATCH_VERSION: 3,
};
export default {

View file

@ -110,7 +110,7 @@ export const getMyTeams = reselect.createSelector(
getTeams,
getTeamMemberships,
(teams, members) => {
return Object.values(teams).filter((t) => members[t.id] && t.delete_at === 0);
return Object.values(teams).filter((t) => t && members[t.id] && t.delete_at === 0);
},
);

View file

@ -43,19 +43,16 @@ export default async function getStorage(identifier = 'default') {
): Promise<string | Error> => {
return new Promise((resolve, reject) => {
checkValidInput(key);
MMKV.getString(key, (error: Error, result: string) => {
if (error) {
if (callback) {
callback(error, null);
}
reject(error);
return;
}
MMKV.getStringAsync(key).then((result: string) => {
if (callback) {
callback(null, result);
}
resolve(JSON.parse(result));
}).catch((error: Error) => {
if (callback) {
callback(error, null);
}
reject(error);
});
});
},
@ -67,14 +64,19 @@ export default async function getStorage(identifier = 'default') {
error: Error | null
) => void | null | undefined,
): Promise<null | Error> => {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
checkValidInput(key, value);
MMKV.setString(key, JSON.stringify(value));
if (callback) {
callback(null);
}
resolve(null);
MMKV.setStringAsync(key, JSON.stringify(value)).then(() => {
if (callback) {
callback(null);
}
resolve(null);
}).catch((error: Error) => {
if (callback) {
callback(error);
}
reject(error);
});
});
},

View file

@ -36,7 +36,7 @@ function unsupportedServerAdminAlert(formatMessage: FormatMessageType) {
text: formatMessage({id: 'mobile.server_upgrade.learn_more', defaultMessage: 'Learn More'}),
style: 'cancel',
onPress: () => {
const url = 'https://mattermost.com/blog/support-for-esr-5-9-has-ended/';
const url = 'https://docs.mattermost.com/administration/release-lifecycle.html';
const onError = () => {
Alert.alert(
formatMessage({

View file

@ -246,7 +246,7 @@ PODS:
- React-Core
- react-native-local-auth (1.6.0):
- React
- react-native-mmkv-storage (0.5.3):
- react-native-mmkv-storage (0.4.4):
- MMKV (= 1.2.7)
- React-Core
- react-native-netinfo (6.0.0):
@ -683,7 +683,7 @@ SPEC CHECKSUMS:
react-native-hw-keyboard-event: b517cefb8d5c659a38049c582de85ff43337dc53
react-native-image-picker: 32d1ad2c0024ca36161ae0d5c2117e2d6c441f11
react-native-local-auth: 359af242caa1e5c501ac9dfe33b1e238ad8f08c6
react-native-mmkv-storage: b8c0ce10551ecf9c270477606aa2cab763011097
react-native-mmkv-storage: 5ed53d7c4ac98f1ef184404e781f63a998f98121
react-native-netinfo: 34f4d7a42f49157f3b45c14217d256bce7dc9682
react-native-notifications: e914ff49de3b2268cfa1b5e2ad21fd27c36d5b7b
react-native-passcode-status: 88c4f6e074328bc278bd127646b6c694ad5a530a

6
package-lock.json generated
View file

@ -20978,9 +20978,9 @@
"integrity": "sha512-4Ii7lqiD9iL0LxTWifAiEsDcDPpvos/29fEVkHxgEDD7J5f+NROMkFSFomKgz1Cab1TmN5mau3o8yFmYrPFcnw=="
},
"react-native-mmkv-storage": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/react-native-mmkv-storage/-/react-native-mmkv-storage-0.5.3.tgz",
"integrity": "sha512-6JAD3IYfpdWTiQZWiKSQn4RAjbxVhyziZncvwPY2ToO/o/DiRdW4fce+ZJ755KpfBfG6EcB3is5sX+LXIJqVkA=="
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/react-native-mmkv-storage/-/react-native-mmkv-storage-0.4.4.tgz",
"integrity": "sha512-NuLKc9C0xLPgteQpieGMGbkNm8A0ma8rzfErQKZbS4KLD2bWQ8c1rZ71JgGBiJrCffpDy1BNZt86DZtPl7djXw=="
},
"react-native-modal": {
"version": "11.7.0",

View file

@ -54,7 +54,7 @@
"react-native-linear-gradient": "2.5.6",
"react-native-local-auth": "1.6.0",
"react-native-localize": "2.0.2",
"react-native-mmkv-storage": "0.5.3",
"react-native-mmkv-storage": "0.4.4",
"react-native-navigation": "7.11.3",
"react-native-notifications": "3.4.2",
"react-native-passcode-status": "1.1.2",

View file

@ -0,0 +1,19 @@
diff --git a/node_modules/react-native-mmkv-storage/ios/MMKVStorage.m b/node_modules/react-native-mmkv-storage/ios/MMKVStorage.m
index 2875bda..8235771 100644
--- a/node_modules/react-native-mmkv-storage/ios/MMKVStorage.m
+++ b/node_modules/react-native-mmkv-storage/ios/MMKVStorage.m
@@ -45,10 +45,10 @@ - (id)init
{
self = [super init];
if (self) {
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
- NSString *libraryPath = (NSString *) [paths firstObject];
- NSString *rootDir = [libraryPath stringByAppendingPathComponent:@"mmkv"];
- [MMKV initializeMMKV:rootDir];
+ NSBundle *bundle = [NSBundle mainBundle];
+ NSString *APP_GROUP_ID = [bundle objectForInfoDictionaryKey:@"AppGroupIdentifier"];
+ NSString *groupDir = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:APP_GROUP_ID].path;
+ [MMKV initializeMMKV:nil groupDir:groupDir logLevel:MMKVLogInfo];
secureStorage = [[SecureStorage alloc]init];
IdStore = [[IDStore alloc] initWithMMKV:[MMKV mmkvWithID:@"mmkvIdStore"]];

View file

@ -1,22 +0,0 @@
diff --git a/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm b/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
index 299942e..9c5b3f9 100644
--- a/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
+++ b/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
@@ -690,12 +690,12 @@ static void install(jsi::Runtime & jsiRuntime)
mmkvInstances = [NSMutableDictionary dictionary];
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
- NSString *libraryPath = (NSString *) [paths firstObject];
- NSString *rootDir = [libraryPath stringByAppendingPathComponent:@"mmkv"];
- rPath = rootDir;
+ NSBundle *bundle = [NSBundle mainBundle];
+ NSString *APP_GROUP_ID = [bundle objectForInfoDictionaryKey:@"AppGroupIdentifier"];
+ NSString *groupDir = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:APP_GROUP_ID].path;
+ rPath = groupDir;
_secureStorage = [[SecureStorage alloc] init];
- [MMKV initializeMMKV:rootDir];
+ [MMKV initializeMMKV:nil groupDir:groupDir logLevel:MMKVLogInfo];
install(*(jsi::Runtime *)cxxBridge.runtime);
[self migrate];