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:
parent
7d9131cdca
commit
6bbd183ac9
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
||||
Subproject commit a8346d6715eb258d11d41a4775e8f1abee620312
|
||||
Subproject commit 489ac3004875581ebd0f46256ad6a45e6172b92a
|
@ -43,7 +43,7 @@ static NSDictionary *keyHashQuery() {
|
||||
[PearlKeyChain deleteItemForQuery:keyHashQuery()];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self];
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointMPForgotten];
|
||||
#endif
|
||||
}
|
||||
@ -64,7 +64,7 @@ static NSDictionary *keyHashQuery() {
|
||||
// Key should not be stored in keychain. Delete it.
|
||||
if ([PearlKeyChain deleteItemForQuery:keyQuery()] != errSecItemNotFound)
|
||||
dbg(@"Deleted key from key chain.");
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointMPUnstored];
|
||||
#endif
|
||||
}
|
||||
@ -86,14 +86,14 @@ static NSDictionary *keyHashQuery() {
|
||||
if (![keyHash isEqual:tryKeyHash]) {
|
||||
dbg(@"Key phrase hash mismatch. Expected: %@, answer: %@.", keyHash, tryKeyHash);
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch];
|
||||
#endif
|
||||
return NO;
|
||||
}
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointMPAsked];
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointMPEntered];
|
||||
#endif
|
||||
|
||||
[self updateKey:tryKey];
|
||||
@ -117,7 +117,7 @@ static NSDictionary *keyHashQuery() {
|
||||
[PearlKeyChain addOrUpdateItemForQuery:keyHashQuery()
|
||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
self.keyHash, (__bridge id)kSecValueData,
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
||||
#endif
|
||||
nil]];
|
||||
@ -126,14 +126,14 @@ static NSDictionary *keyHashQuery() {
|
||||
[PearlKeyChain addOrUpdateItemForQuery:keyQuery()
|
||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
key, (__bridge id)kSecValueData,
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
||||
#endif
|
||||
nil]];
|
||||
}
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
[TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointSetKeyphraseLength, key.length]];
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointSetKey];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
+ (MPAppDelegate *)get {
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
return (MPAppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
#elif defined (__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||
return (MPAppDelegate *)[NSApplication sharedApplication].delegate;
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
- (NSURL *)applicationFilesDirectory {
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
|
||||
#else
|
||||
NSURL *appSupportURL = [[[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask] lastObject];
|
||||
|
@ -182,7 +182,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
||||
}
|
||||
|
||||
- (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);
|
||||
|
||||
switch (cause) {
|
||||
@ -192,6 +195,9 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
||||
case UbiquityStoreManagerErrorCauseClearStore:
|
||||
break;
|
||||
case UbiquityStoreManagerErrorCauseOpenLocalStore: {
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointLocalStoreIncompatible];
|
||||
#endif
|
||||
wrn(@"Local store could not be opened, resetting it.");
|
||||
manager.hardResetEnabled = YES;
|
||||
[manager hardResetLocalStorage];
|
||||
@ -200,10 +206,12 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
||||
return;
|
||||
}
|
||||
case UbiquityStoreManagerErrorCauseOpenCloudStore: {
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointCloudStoreIncompatible];
|
||||
#endif
|
||||
wrn(@"iCloud store could not be opened, resetting it.");
|
||||
manager.hardResetEnabled = YES;
|
||||
[manager hardResetCloudStorage];
|
||||
[manager useiCloudStore:YES alertUser:NO];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -347,6 +355,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
||||
}
|
||||
[self saveContext];
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointSitesImported];
|
||||
#endif
|
||||
|
||||
return MPImportResultSuccess;
|
||||
}
|
||||
|
||||
@ -403,6 +415,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
||||
[rfc3339DateFormatter stringFromDate:[NSDate dateWithTimeIntervalSinceReferenceDate:lastUsed]], uses, type, [name cStringUsingEncoding:NSUTF8StringEncoding], content? content: @""];
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
[TestFlight passCheckpoint:MPTestFlightCheckpointSitesExported];
|
||||
#endif
|
||||
|
||||
return export;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
[PearlKeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
|
||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
encryptedContent, (__bridge id)kSecValueData,
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#if TARGET_OS_IPHONE
|
||||
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
|
||||
#endif
|
||||
nil]];
|
||||
|
@ -62,9 +62,14 @@ typedef enum {
|
||||
#define MPTestFlightCheckpointMPChanged @"MPTestFlightCheckpointMPChanged"
|
||||
#define MPTestFlightCheckpointMPUnstored @"MPTestFlightCheckpointMPUnstored"
|
||||
#define MPTestFlightCheckpointMPMismatch @"MPTestFlightCheckpointMPMismatch"
|
||||
#define MPTestFlightCheckpointMPAsked @"MPTestFlightCheckpointMPAsked"
|
||||
#define MPTestFlightCheckpointStoreIncompatible @"MPTestFlightCheckpointStoreIncompatible"
|
||||
#define MPTestFlightCheckpointSetKeyphraseLength @"MPTestFlightCheckpointSetKeyphraseLength_%d"
|
||||
#define MPTestFlightCheckpointMPEntered @"MPTestFlightCheckpointMPEntered"
|
||||
#define MPTestFlightCheckpointLocalStoreIncompatible @"MPTestFlightCheckpointLocalStoreIncompatible"
|
||||
#define MPTestFlightCheckpointCloudStoreIncompatible @"MPTestFlightCheckpointCloudStoreIncompatible"
|
||||
#define MPTestFlightCheckpointSetKey @"MPTestFlightCheckpointSetKey"
|
||||
#define MPTestFlightCheckpointCloudEnabled @"MPTestFlightCheckpointCloudEnabled"
|
||||
#define MPTestFlightCheckpointCloudDisabled @"MPTestFlightCheckpointCloudDisabled"
|
||||
#define MPTestFlightCheckpointSitesImported @"MPTestFlightCheckpointSitesImported"
|
||||
#define MPTestFlightCheckpointSitesExported @"MPTestFlightCheckpointSitesExported"
|
||||
|
||||
#define MPNotificationStoreUpdated @"MPNotificationStoreUpdated"
|
||||
#define MPNotificationKeySet @"MPNotificationKeySet"
|
||||
|
@ -398,7 +398,28 @@
|
||||
|
||||
- (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
|
||||
|
Loading…
Reference in New Issue
Block a user