Update of iOS code for updated API of UbiquityStoreManager.
[UPDATED] UbiquityStoreManager's new API uses cloudEnabled instead of iCloudEnabled.
This commit is contained in:
@@ -203,11 +203,11 @@ static char managedObjectContextKey;
|
||||
dbg(@"[StoreManager] %@", message);
|
||||
}
|
||||
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)iCloudEnabled {
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToCloud:(BOOL)cloudEnabled {
|
||||
|
||||
// manager.cloudEnabled is more reliable (eg. iOS' MPAppDelegate tampers with didSwitch a bit)
|
||||
iCloudEnabled = manager.cloudEnabled;
|
||||
inf(@"Using iCloud? %@", iCloudEnabled? @"YES": @"NO");
|
||||
cloudEnabled = manager.cloudEnabled;
|
||||
inf(@"Using iCloud? %@", cloudEnabled? @"YES": @"NO");
|
||||
|
||||
#ifdef TESTFLIGHT_SDK_VERSION
|
||||
[TestFlight passCheckpoint:cloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled];
|
||||
@@ -218,7 +218,7 @@ static char managedObjectContextKey;
|
||||
}];
|
||||
#endif
|
||||
|
||||
[MPConfig get].iCloud = @(iCloudEnabled);
|
||||
[MPConfig get].iCloud = @(cloudEnabled);
|
||||
}
|
||||
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause
|
||||
|
||||
@@ -395,8 +395,8 @@
|
||||
|
||||
- (void)checkConfig {
|
||||
|
||||
if ([[MPConfig get].iCloud boolValue] != [self.storeManager iCloudEnabled])
|
||||
[self.storeManager useiCloudStore:[[MPConfig get].iCloud boolValue] alertUser:YES];
|
||||
if ([[MPConfig get].iCloud boolValue] != [self.storeManager cloudEnabled])
|
||||
self.storeManager.cloudEnabled = [[MPConfig get].iCloud boolValue];
|
||||
if ([[MPiOSConfig get].sendInfo boolValue]) {
|
||||
if ([PearlLogger get].printLevel > PearlLogLevelInfo)
|
||||
[PearlLogger get].printLevel = PearlLogLevelInfo;
|
||||
@@ -629,12 +629,12 @@
|
||||
|
||||
#pragma mark - UbiquityStoreManagerDelegate
|
||||
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)iCloudEnabled {
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToCloud:(BOOL)cloudEnabled {
|
||||
|
||||
[super ubiquityStoreManager:manager didSwitchToiCloud:iCloudEnabled];
|
||||
[super ubiquityStoreManager:manager didSwitchToCloud:cloudEnabled];
|
||||
|
||||
if (![[MPConfig get].iCloudDecided boolValue]) {
|
||||
if (!iCloudEnabled) {
|
||||
if (!cloudEnabled) {
|
||||
[PearlAlert showAlertWithTitle:@"iCloud"
|
||||
message:
|
||||
@"iCloud is now disabled.\n\n"
|
||||
@@ -657,7 +657,7 @@
|
||||
@"Apple can never see any of your passwords."
|
||||
viewStyle:UIAlertViewStyleDefault
|
||||
initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
||||
[self ubiquityStoreManager:manager didSwitchToiCloud:iCloudEnabled];
|
||||
[self ubiquityStoreManager:manager didSwitchToCloud:cloudEnabled];
|
||||
}
|
||||
cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil];
|
||||
return;
|
||||
@@ -667,7 +667,7 @@
|
||||
if (buttonIndex == [alert cancelButtonIndex])
|
||||
return;
|
||||
if (buttonIndex == [alert firstOtherButtonIndex] + 1)
|
||||
[manager useiCloudStore:YES alertUser:NO];
|
||||
manager.cloudEnabled = YES;
|
||||
} cancelTitle:@"Leave iCloud Off" otherTitles:@"Explain?", @"Enable iCloud", nil];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,15 +164,15 @@
|
||||
[self initializeWordLabel:wordLabel];
|
||||
} recurse:NO];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:PersistentStoreDidChange object:nil queue:nil usingBlock:
|
||||
^(NSNotification *note) {
|
||||
[self updateUsers];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:PersistentStoreDidMergeChanges object:nil queue:nil usingBlock:
|
||||
^(NSNotification *note) {
|
||||
[self updateUsers];
|
||||
}];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UbiquityManagedStoreDidChangeNotification object:nil queue:nil
|
||||
usingBlock:^(NSNotification *note) {
|
||||
[self updateUsers];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UbiquityManagedStoreDidImportChangesNotification object:nil queue:nil
|
||||
usingBlock:^(NSNotification *note) {
|
||||
[self updateUsers];
|
||||
}];
|
||||
|
||||
[self updateLayoutAnimated:NO allowScroll:YES completion:nil];
|
||||
|
||||
[super viewDidLoad];
|
||||
|
||||
Reference in New Issue
Block a user