Files
notesnook/apps/mobile/patches/react-native-mmkv-storage+0.9.1.patch
Ammar Ahmed 4843d1c39e mobile: update mobile app to react-native 0.72.0 (#2814)
* mobile: upgrade to react-native 0.71

* mobile: update to react-native 0.72.0

* mobile: fix release build on android

* mobile: fix editor stuck in loading state

* mobile: fix bootsplash logo in dark mode

* mobile: update patch files

* mobile: cleanup

* mobile: increase delay

* mobile: add logs on upload

* mobile: ensure editor is ready before note loading

* mobile: fix ui

* mobile: fix

* ci: update workflow

* ci: undo workflow changes

---------

Signed-off-by: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com>
2023-06-26 21:50:20 +05:00

43 lines
2.1 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 9af089d..f64a04a 100644
--- a/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
+++ b/node_modules/react-native-mmkv-storage/ios/MMKVNative.mm
@@ -30,13 +30,23 @@ - (instancetype)init
{
self = [super init];
RCTExecuteOnMainQueue(^{
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
- NSUserDomainMask, YES);
- NSString *libraryPath = (NSString *)[paths firstObject];
- NSString *rootDir = [libraryPath stringByAppendingPathComponent:@"mmkv"];
+// NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
+// NSUserDomainMask, YES);
+// NSString *libraryPath = (NSString *)[paths firstObject];
+
+ NSString *myGroupID = @"group.org.streetwriters.notesnook"; // the group dir that can be accessed by App & extensions
+
+ NSString *groupDir = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:myGroupID].path;
+ NSString *rootDir = [groupDir stringByAppendingPathComponent:@"mmkv"];
+
+ // Do not include this directory in cloud backups.
+ NSError *error = nil;
+ NSURL *url = [NSURL fileURLWithPath:rootDir isDirectory:YES];
+ [url setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
rPath = rootDir;
+ // Set the groupDir
_secureStorage = [[SecureStorage alloc] init];
- [MMKV initializeMMKV:rootDir];
+ [MMKV initializeMMKV:nil groupDir:rootDir logLevel:MMKVLogInfo];
});
@@ -706,7 +716,7 @@ static void install(jsi::Runtime &jsiRuntime) {
}
- (void)migrate {
- MMKV *kv = [MMKV mmkvWithID:@"mmkvIdStore"];
+ MMKV *kv = [MMKV mmkvWithID:@"mmkvIdStore" mode:MMKVMultiProcess];
[mmkvInstances setObject:kv forKey:@"mmkvIdStore"];
if ([kv containsKey:@"mmkvIdData"]) {
NSMutableDictionary *oldStore =