2
0

TestFlight checkpoint update + iCloud warning.

[UPDATED]   Check TARGET_OS_IPHONE instead of
            __IPHONE_OS_VERSION_MIN_REQUIRED.
[UPDATED]   A few TestFlight checkpoints names have been updated.
[ADDED]     A few new TestFlight checkpoints for new features.
[ADDED]     Warn the user when he's not using iCloud and allow him to
            switch back to iCloud.
This commit is contained in:
Maarten Billemont 2012-05-11 17:04:51 +02:00
parent 7d9131cdca
commit 6bbd183ac9
7 changed files with 61 additions and 19 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit a8346d6715eb258d11d41a4775e8f1abee620312 Subproject commit 489ac3004875581ebd0f46256ad6a45e6172b92a

View File

@ -43,7 +43,7 @@ static NSDictionary *keyHashQuery() {
[PearlKeyChain deleteItemForQuery:keyHashQuery()]; [PearlKeyChain deleteItemForQuery:keyHashQuery()];
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self];
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointMPForgotten]; [TestFlight passCheckpoint:MPTestFlightCheckpointMPForgotten];
#endif #endif
} }
@ -64,7 +64,7 @@ static NSDictionary *keyHashQuery() {
// Key should not be stored in keychain. Delete it. // Key should not be stored in keychain. Delete it.
if ([PearlKeyChain deleteItemForQuery:keyQuery()] != errSecItemNotFound) if ([PearlKeyChain deleteItemForQuery:keyQuery()] != errSecItemNotFound)
dbg(@"Deleted key from key chain."); dbg(@"Deleted key from key chain.");
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointMPUnstored]; [TestFlight passCheckpoint:MPTestFlightCheckpointMPUnstored];
#endif #endif
} }
@ -86,14 +86,14 @@ static NSDictionary *keyHashQuery() {
if (![keyHash isEqual:tryKeyHash]) { if (![keyHash isEqual:tryKeyHash]) {
dbg(@"Key phrase hash mismatch. Expected: %@, answer: %@.", keyHash, tryKeyHash); dbg(@"Key phrase hash mismatch. Expected: %@, answer: %@.", keyHash, tryKeyHash);
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch]; [TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch];
#endif #endif
return NO; return NO;
} }
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointMPAsked]; [TestFlight passCheckpoint:MPTestFlightCheckpointMPEntered];
#endif #endif
[self updateKey:tryKey]; [self updateKey:tryKey];
@ -117,7 +117,7 @@ static NSDictionary *keyHashQuery() {
[PearlKeyChain addOrUpdateItemForQuery:keyHashQuery() [PearlKeyChain addOrUpdateItemForQuery:keyHashQuery()
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys: withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
self.keyHash, (__bridge id)kSecValueData, self.keyHash, (__bridge id)kSecValueData,
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible, kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
#endif #endif
nil]]; nil]];
@ -126,14 +126,14 @@ static NSDictionary *keyHashQuery() {
[PearlKeyChain addOrUpdateItemForQuery:keyQuery() [PearlKeyChain addOrUpdateItemForQuery:keyQuery()
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys: withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
key, (__bridge id)kSecValueData, key, (__bridge id)kSecValueData,
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible, kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
#endif #endif
nil]]; nil]];
} }
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
[TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointSetKeyphraseLength, key.length]]; [TestFlight passCheckpoint:MPTestFlightCheckpointSetKey];
#endif #endif
} }
} }

View File

@ -12,7 +12,7 @@
+ (MPAppDelegate *)get { + (MPAppDelegate *)get {
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
return (MPAppDelegate *)[UIApplication sharedApplication].delegate; return (MPAppDelegate *)[UIApplication sharedApplication].delegate;
#elif defined (__MAC_OS_X_VERSION_MIN_REQUIRED) #elif defined (__MAC_OS_X_VERSION_MIN_REQUIRED)
return (MPAppDelegate *)[NSApplication sharedApplication].delegate; return (MPAppDelegate *)[NSApplication sharedApplication].delegate;
@ -23,7 +23,7 @@
- (NSURL *)applicationFilesDirectory { - (NSURL *)applicationFilesDirectory {
#if __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
#else #else
NSURL *appSupportURL = [[[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask] lastObject]; NSURL *appSupportURL = [[[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask] lastObject];

View File

@ -183,6 +183,9 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context { - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context {
#if TARGET_OS_IPHONE
[TestFlight passCheckpoint:str(@"MPTestFlightCheckpointMPErrorUbiquity_%d", cause)];
#endif
err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error); err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error);
switch (cause) { switch (cause) {
@ -192,6 +195,9 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
case UbiquityStoreManagerErrorCauseClearStore: case UbiquityStoreManagerErrorCauseClearStore:
break; break;
case UbiquityStoreManagerErrorCauseOpenLocalStore: { case UbiquityStoreManagerErrorCauseOpenLocalStore: {
#if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointLocalStoreIncompatible];
#endif
wrn(@"Local store could not be opened, resetting it."); wrn(@"Local store could not be opened, resetting it.");
manager.hardResetEnabled = YES; manager.hardResetEnabled = YES;
[manager hardResetLocalStorage]; [manager hardResetLocalStorage];
@ -200,10 +206,12 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
return; return;
} }
case UbiquityStoreManagerErrorCauseOpenCloudStore: { case UbiquityStoreManagerErrorCauseOpenCloudStore: {
#if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointCloudStoreIncompatible];
#endif
wrn(@"iCloud store could not be opened, resetting it."); wrn(@"iCloud store could not be opened, resetting it.");
manager.hardResetEnabled = YES; manager.hardResetEnabled = YES;
[manager hardResetCloudStorage]; [manager hardResetCloudStorage];
[manager useiCloudStore:YES alertUser:NO];
break; break;
} }
} }
@ -347,6 +355,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
} }
[self saveContext]; [self saveContext];
#if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointSitesImported];
#endif
return MPImportResultSuccess; return MPImportResultSuccess;
} }
@ -403,6 +415,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
[rfc3339DateFormatter stringFromDate:[NSDate dateWithTimeIntervalSinceReferenceDate:lastUsed]], uses, type, [name cStringUsingEncoding:NSUTF8StringEncoding], content? content: @""]; [rfc3339DateFormatter stringFromDate:[NSDate dateWithTimeIntervalSinceReferenceDate:lastUsed]], uses, type, [name cStringUsingEncoding:NSUTF8StringEncoding], content? content: @""];
} }
#if TARGET_OS_IPHONE
[TestFlight passCheckpoint:MPTestFlightCheckpointSitesExported];
#endif
return export; return export;
} }

View File

@ -53,7 +53,7 @@
[PearlKeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name] [PearlKeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys: withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
encryptedContent, (__bridge id)kSecValueData, encryptedContent, (__bridge id)kSecValueData,
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED #if TARGET_OS_IPHONE
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible, kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
#endif #endif
nil]]; nil]];

View File

@ -62,9 +62,14 @@ typedef enum {
#define MPTestFlightCheckpointMPChanged @"MPTestFlightCheckpointMPChanged" #define MPTestFlightCheckpointMPChanged @"MPTestFlightCheckpointMPChanged"
#define MPTestFlightCheckpointMPUnstored @"MPTestFlightCheckpointMPUnstored" #define MPTestFlightCheckpointMPUnstored @"MPTestFlightCheckpointMPUnstored"
#define MPTestFlightCheckpointMPMismatch @"MPTestFlightCheckpointMPMismatch" #define MPTestFlightCheckpointMPMismatch @"MPTestFlightCheckpointMPMismatch"
#define MPTestFlightCheckpointMPAsked @"MPTestFlightCheckpointMPAsked" #define MPTestFlightCheckpointMPEntered @"MPTestFlightCheckpointMPEntered"
#define MPTestFlightCheckpointStoreIncompatible @"MPTestFlightCheckpointStoreIncompatible" #define MPTestFlightCheckpointLocalStoreIncompatible @"MPTestFlightCheckpointLocalStoreIncompatible"
#define MPTestFlightCheckpointSetKeyphraseLength @"MPTestFlightCheckpointSetKeyphraseLength_%d" #define MPTestFlightCheckpointCloudStoreIncompatible @"MPTestFlightCheckpointCloudStoreIncompatible"
#define MPTestFlightCheckpointSetKey @"MPTestFlightCheckpointSetKey"
#define MPTestFlightCheckpointCloudEnabled @"MPTestFlightCheckpointCloudEnabled"
#define MPTestFlightCheckpointCloudDisabled @"MPTestFlightCheckpointCloudDisabled"
#define MPTestFlightCheckpointSitesImported @"MPTestFlightCheckpointSitesImported"
#define MPTestFlightCheckpointSitesExported @"MPTestFlightCheckpointSitesExported"
#define MPNotificationStoreUpdated @"MPNotificationStoreUpdated" #define MPNotificationStoreUpdated @"MPNotificationStoreUpdated"
#define MPNotificationKeySet @"MPNotificationKeySet" #define MPNotificationKeySet @"MPNotificationKeySet"

View File

@ -398,7 +398,28 @@
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)didSwitch { - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)didSwitch {
inf(@"didSwitchToiCloud: %d", didSwitch); #if TARGET_OS_IPHONE
[TestFlight passCheckpoint:didSwitch? MPTestFlightCheckpointCloudEnabled: MPTestFlightCheckpointCloudDisabled];
#endif
inf(@"Using iCloud? %@", didSwitch? @"YES": @"NO");
if (!didSwitch) {
[PearlAlert showAlertWithTitle:@"iCloud"
message:
@"iCloud is now disabled.\n"
@"It is highly recommended you enable iCloud. "
@"Doing so will let you easily access all your sites from any of your devices. "
@"It will also make it easier to recover from the loss of a device.\n\n"
@"iCloud only backs up your site names. If you use stored passwords, "
@"those are always encrypted with your master password. "
@"Apple cannot see any of your private information."
viewStyle:UIAlertViewStyleDefault tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
if (buttonIndex == [alert cancelButtonIndex])
return;
[manager useiCloudStore:YES alertUser:YES];
} cancelTitle:@"Leave Off" otherTitles:@"Enable iCloud", nil];
}
} }
#pragma mark - TestFlight #pragma mark - TestFlight