react-native-mytatva-rn-sdk 1.2.74 → 1.2.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -57,11 +57,9 @@
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// Create the coordinator and store
|
|
60
|
-
|
|
61
60
|
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
|
|
62
61
|
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"KaiLiTe.sqlite"];
|
|
63
62
|
NSError *error = nil;
|
|
64
|
-
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
|
|
65
63
|
NSDictionary *optionsDictionary = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],
|
|
66
64
|
NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES],
|
|
67
65
|
NSInferMappingModelAutomaticallyOption, nil];
|
|
@@ -534,16 +534,18 @@ RCT_EXPORT_METHOD(openHelpSupport)
|
|
|
534
534
|
|
|
535
535
|
RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token isForClearData:(BOOL)isForClearData envType:(NSString *)envType)
|
|
536
536
|
{
|
|
537
|
-
if (isForClearData == YES) {
|
|
538
|
-
[[KLTDatabaseHandler shared].appDelegate deleteAllCoreData];
|
|
539
|
-
}
|
|
540
|
-
|
|
541
537
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
542
538
|
[defaults setObject:token forKey:@"authToken"];
|
|
543
539
|
[defaults setObject:envType forKey:@"envType"];
|
|
544
540
|
[defaults synchronize];
|
|
545
541
|
|
|
542
|
+
// CRITICAL: CoreData context is NSMainQueueConcurrencyType, so ALL CoreData operations
|
|
543
|
+
// must happen on the main thread. React Native native modules are often called from
|
|
544
|
+
// background threads, so we must dispatch to main queue.
|
|
546
545
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
546
|
+
if (isForClearData == YES) {
|
|
547
|
+
[[KLTDatabaseHandler shared].appDelegate deleteAllCoreData];
|
|
548
|
+
}
|
|
547
549
|
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
548
550
|
UIViewController *rootVC = keyWindow.rootViewController;
|
|
549
551
|
|