mattermost-mobile/patches/react-native-mmkv-storage+0.6.6.patch
Elias Nahum 8287e620d8
Upgrade to rn 0.66.1 (#5727)
* Upgrade to rn 0.66.0

* Add keys to re-render post list and channel list

* Finish dep updates and rn to 0.66.1

* upgrade more dependencies

* Fix select_server tests
2021-10-31 13:57:07 -03:00

30 lines
1.7 KiB
Diff

diff --git a/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm b/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
index ffac535..4608563 100644
--- a/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
+++ b/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
@@ -79,11 +79,12 @@ BOOL functionDiedBeforeCompletion = YES;
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];
}
@@ -186,7 +187,7 @@ static void install(jsi::Runtime &jsiRuntime) {
jsiRuntime, PropNameID::forAscii(jsiRuntime, "initializeMMKV"), 0,
[](Runtime &runtime, const Value &thisValue, const Value *arguments,
size_t count) -> Value {
- [MMKV initializeMMKV:rPath];
+ [MMKV initializeMMKV:nil groupDir:rPath logLevel:MMKVLogInfo];
return Value::undefined();
});