diff --git a/MasterPassword/MPAppDelegate_Store.m b/MasterPassword/MPAppDelegate_Store.m index 70237366..f98fea68 100644 --- a/MasterPassword/MPAppDelegate_Store.m +++ b/MasterPassword/MPAppDelegate_Store.m @@ -182,14 +182,17 @@ static NSDateFormatter *rfc3339DateFormatter = nil; dbg(@"[StoreManager] %@", message); } -- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)didSwitch { +- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)iCloudEnabled { + + // manager.iCloudEnabled is more reliable (eg. iOS tampers with didSwitch a bit) + iCloudEnabled = manager.iCloudEnabled; #ifdef TESTFLIGHT_SDK_VERSION - [TestFlight passCheckpoint:didSwitch? MPTestFlightCheckpointCloudEnabled: MPTestFlightCheckpointCloudDisabled]; + [TestFlight passCheckpoint:iCloudEnabled? MPTestFlightCheckpointCloudEnabled: MPTestFlightCheckpointCloudDisabled]; #endif - inf(@"Using iCloud? %@", didSwitch? @"YES": @"NO"); - [MPConfig get].iCloud = [NSNumber numberWithBool:didSwitch]; + inf(@"Using iCloud? %@", iCloudEnabled? @"YES": @"NO"); + [MPConfig get].iCloud = [NSNumber numberWithBool:iCloudEnabled]; } - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context { diff --git a/MasterPassword/iOS/MPAppDelegate.m b/MasterPassword/iOS/MPAppDelegate.m index 0e584f9e..6128bc7f 100644 --- a/MasterPassword/iOS/MPAppDelegate.m +++ b/MasterPassword/iOS/MPAppDelegate.m @@ -432,12 +432,7 @@ @"iCloud is now disabled.\n\n" @"It is highly recommended you enable iCloud." viewStyle:UIAlertViewStyleDefault tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) { - [MPConfig get].iCloudDecided = [NSNumber numberWithBool:YES]; - - if (buttonIndex == [alert cancelButtonIndex]) - return; - - if (buttonIndex == [alert firstOtherButtonIndex] + 0) + if (buttonIndex == [alert firstOtherButtonIndex] + 0) { [PearlAlert showAlertWithTitle:@"About iCloud" message: @"iCloud is Apple's solution for saving your data in \"the cloud\" " @@ -456,6 +451,12 @@ [self ubiquityStoreManager:manager didSwitchToiCloud:iCloudEnabled]; } cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil]; + return; + } + + [MPConfig get].iCloudDecided = [NSNumber numberWithBool:YES]; + if (buttonIndex == [alert cancelButtonIndex]) + return; if (buttonIndex == [alert firstOtherButtonIndex] + 1) [manager useiCloudStore:YES alertUser:NO]; } cancelTitle:@"Leave iCloud Off" otherTitles:@"Explain?", @"Enable iCloud", nil]; diff --git a/MasterPassword/iOS/MPiOSConfig.m b/MasterPassword/iOS/MPiOSConfig.m index e76121b3..4e37992f 100644 --- a/MasterPassword/iOS/MPiOSConfig.m +++ b/MasterPassword/iOS/MPiOSConfig.m @@ -19,6 +19,7 @@ [self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], NSStringFromSelector(@selector(helpHidden)), [NSNumber numberWithBool:YES], NSStringFromSelector(@selector(showQuickStart)), + @"510296984", NSStringFromSelector(@selector(iTunesID)), nil]]; return self;