2
0

Checkpoints update and tag in Localytics too.

This commit is contained in:
Maarten Billemont 2012-06-11 23:39:50 +02:00
parent 83bdb9d626
commit 13bca309ba
6 changed files with 105 additions and 62 deletions

View File

@ -10,6 +10,7 @@
#import "MPAppDelegate_Key.h"
#import "MPAppDelegate_Store.h"
#import "ATConnect.h"
#import "LocalyticsSession.h"
@implementation MPAppDelegate_Shared (Key)
@ -66,7 +67,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointForgetSavedKey];
[TestFlight passCheckpoint:MPCheckpointForgetSavedKey];
#endif
}
}
@ -108,8 +109,10 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
[self forgetSavedKeyFor:user];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch];
[TestFlight passCheckpoint:MPCheckpointSignInFailed];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointSignInFailed
attributes:nil];
}
}
@ -121,8 +124,10 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
tryKey = nil;
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch];
[TestFlight passCheckpoint:MPCheckpointSignInFailed];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointSignInFailed
attributes:nil];
}
}
@ -153,8 +158,10 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationSignedIn object:self];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointSignedIn];
[TestFlight passCheckpoint:MPCheckpointSignedIn];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointSignedIn
attributes:nil];
return YES;
}

View File

@ -7,6 +7,7 @@
//
#import "MPAppDelegate_Store.h"
#import "LocalyticsSession.h"
@implementation MPAppDelegate_Shared (Store)
@ -139,8 +140,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
iCloudEnabled = manager.iCloudEnabled;
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:iCloudEnabled? MPTestFlightCheckpointCloudEnabled: MPTestFlightCheckpointCloudDisabled];
[TestFlight passCheckpoint:iCloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:iCloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled
attributes:nil];
inf(@"Using iCloud? %@", iCloudEnabled? @"YES": @"NO");
[MPConfig get].iCloud = [NSNumber numberWithBool:iCloudEnabled];
@ -150,7 +153,7 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
context:(id)context {
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:PearlString(@"MPTestFlightCheckpointMPErrorUbiquity_%d", cause)];
[TestFlight passCheckpoint:PearlString(@"MPCheckpointMPErrorUbiquity_%d", cause)];
#endif
err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error);
@ -162,8 +165,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
break;
case UbiquityStoreManagerErrorCauseOpenLocalStore: {
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointLocalStoreIncompatible];
[TestFlight passCheckpoint:MPCheckpointLocalStoreIncompatible];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointLocalStoreIncompatible
attributes:nil];
wrn(@"Local store could not be opened, resetting it.");
manager.hardResetEnabled = YES;
[manager hardResetLocalStorage];
@ -173,8 +178,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
}
case UbiquityStoreManagerErrorCauseOpenCloudStore: {
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointCloudStoreIncompatible];
[TestFlight passCheckpoint:MPCheckpointCloudStoreIncompatible];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCloudStoreIncompatible
attributes:nil];
wrn(@"iCloud store could not be opened, resetting it.");
manager.hardResetEnabled = YES;
[manager hardResetCloudStorage];
@ -339,8 +346,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
[self saveContext];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointSitesImported];
[TestFlight passCheckpoint:MPCheckpointSitesImported];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointSitesImported
attributes:nil];
return MPImportResultSuccess;
}
@ -394,8 +403,10 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
}
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPTestFlightCheckpointSitesExported];
[TestFlight passCheckpoint:MPCheckpointSitesExported];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointSitesExported
attributes:nil];
return export;
}

View File

@ -42,40 +42,38 @@ typedef enum {
MPElementTypeStoredDevicePrivate = 0x1 | MPElementTypeClassStored | MPElementFeatureDevicePrivate,
} MPElementType;
// TODO: Review checkpoints
#define MPTestFlightCheckpointAction @"MPTestFlightCheckpointAction"
#define MPTestFlightCheckpointHelpChapter @"MPTestFlightCheckpointHelpChapter_%@"
#define MPTestFlightCheckpointCopyToPasteboard @"MPTestFlightCheckpointCopyToPasteboard"
#define MPTestFlightCheckpointResetPasswordCounter @"MPTestFlightCheckpointResetPasswordCounter"
#define MPTestFlightCheckpointIncrementPasswordCounter @"MPTestFlightCheckpointIncrementPasswordCounter"
#define MPTestFlightCheckpointEditPassword @"MPTestFlightCheckpointEditPassword"
#define MPTestFlightCheckpointCloseAlert @"MPTestFlightCheckpointCloseAlert"
#define MPTestFlightCheckpointUseType @"MPTestFlightCheckpointUseType_%@"
#define MPTestFlightCheckpointDeleteElement @"MPTestFlightCheckpointDeleteElement"
#define MPTestFlightCheckpointCancelSearch @"MPTestFlightCheckpointCancelSearch"
#define MPTestFlightCheckpointExternalLink @"MPTestFlightCheckpointExternalLink"
#define MPTestFlightCheckpointLaunched @"MPTestFlightCheckpointLaunched"
#define MPTestFlightCheckpointActivated @"MPTestFlightCheckpointActivated"
#define MPTestFlightCheckpointDeactivated @"MPTestFlightCheckpointDeactivated"
#define MPTestFlightCheckpointTerminated @"MPTestFlightCheckpointTerminated"
#define MPTestFlightCheckpointShowGuide @"MPTestFlightCheckpointShowGuide"
#define MPTestFlightCheckpointForgetSavedKey @"MPTestFlightCheckpointForgetSavedKey"
#define MPTestFlightCheckpointChangeMP @"MPTestFlightCheckpointChangeMP"
#define MPTestFlightCheckpointMPMismatch @"MPTestFlightCheckpointMPMismatch"
#define MPTestFlightCheckpointMPValid @"MPTestFlightCheckpointMPValid"
#define MPTestFlightCheckpointLocalStoreIncompatible @"MPTestFlightCheckpointLocalStoreIncompatible"
#define MPTestFlightCheckpointCloudStoreIncompatible @"MPTestFlightCheckpointCloudStoreIncompatible"
#define MPTestFlightCheckpointSignedIn @"MPTestFlightCheckpointSignedIn"
#define MPTestFlightCheckpointCloudEnabled @"MPTestFlightCheckpointCloudEnabled"
#define MPTestFlightCheckpointCloudDisabled @"MPTestFlightCheckpointCloudDisabled"
#define MPTestFlightCheckpointSitesImported @"MPTestFlightCheckpointSitesImported"
#define MPTestFlightCheckpointSitesExported @"MPTestFlightCheckpointSitesExported"
#define MPCheckpointAction @"MPCheckpointAction"
#define MPCheckpointHelpChapter @"MPCheckpointHelpChapter"
#define MPCheckpointCopyToPasteboard @"MPCheckpointCopyToPasteboard"
#define MPCheckpointResetPasswordCounter @"MPCheckpointResetPasswordCounter"
#define MPCheckpointIncrementPasswordCounter @"MPCheckpointIncrementPasswordCounter"
#define MPCheckpointEditPassword @"MPCheckpointEditPassword"
#define MPCheckpointCloseAlert @"MPCheckpointCloseAlert"
#define MPCheckpointUseType @"MPCheckpointUseType"
#define MPCheckpointDeleteElement @"MPCheckpointDeleteElement"
#define MPCheckpointCancelSearch @"MPCheckpointCancelSearch"
#define MPCheckpointExternalLink @"MPCheckpointExternalLink"
#define MPCheckpointLaunched @"MPCheckpointLaunched"
#define MPCheckpointActivated @"MPCheckpointActivated"
#define MPCheckpointDeactivated @"MPCheckpointDeactivated"
#define MPCheckpointTerminated @"MPCheckpointTerminated"
#define MPCheckpointShowGuide @"MPCheckpointShowGuide"
#define MPCheckpointForgetSavedKey @"MPCheckpointForgetSavedKey"
#define MPCheckpointChangeMP @"MPCheckpointChangeMP"
#define MPCheckpointLocalStoreIncompatible @"MPCheckpointLocalStoreIncompatible"
#define MPCheckpointCloudStoreIncompatible @"MPCheckpointCloudStoreIncompatible"
#define MPCheckpointSignInFailed @"MPCheckpointSignInFailed"
#define MPCheckpointSignedIn @"MPCheckpointSignedIn"
#define MPCheckpointCloudEnabled @"MPCheckpointCloudEnabled"
#define MPCheckpointCloudDisabled @"MPCheckpointCloudDisabled"
#define MPCheckpointSitesImported @"MPCheckpointSitesImported"
#define MPCheckpointSitesExported @"MPCheckpointSitesExported"
#define MPNotificationStoreUpdated @"MPNotificationStoreUpdated"
#define MPNotificationSignedIn @"MPNotificationKeySet"
#define MPNotificationSignedOut @"MPNotificationKeyUnset"
#define MPNotificationKeyForgotten @"MPNotificationKeyForgotten"
#define MPNotificationElementUsed @"MPNotificationElementUsed"
#define MPNotificationStoreUpdated @"MPNotificationStoreUpdated"
#define MPNotificationSignedIn @"MPNotificationKeySet"
#define MPNotificationSignedOut @"MPNotificationKeyUnset"
#define MPNotificationKeyForgotten @"MPNotificationKeyForgotten"
#define MPNotificationElementUsed @"MPNotificationElementUsed"
NSData *keyForPassword(NSString *password, NSString *username);
NSData *keyIDForPassword(NSString *password, NSString *username);

View File

@ -72,7 +72,7 @@
[self.navigationController performSegueWithIdentifier:@"MP_Guide" sender:self];
[TestFlight passCheckpoint:MPTestFlightCheckpointShowGuide];
[TestFlight passCheckpoint:MPCheckpointShowGuide];
}
- (void)export {
@ -138,7 +138,9 @@
self.activeUser.keyID = nil;
[self signOut];
[TestFlight passCheckpoint:MPTestFlightCheckpointChangeMP];
[TestFlight passCheckpoint:MPCheckpointChangeMP];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointChangeMP
attributes:nil];
}
cancelTitle:[PearlStrings get].commonButtonAbort
otherTitles:[PearlStrings get].commonButtonContinue, nil];
@ -186,7 +188,7 @@
return YES;
}];
[TestFlight passCheckpoint:MPTestFlightCheckpointLaunched];
[TestFlight passCheckpoint:MPCheckpointLaunched];
}
}
@catch (id exception) {
@ -410,7 +412,7 @@ UIImage *segmentUnselectedUnselected = [UIImage imageNamed:@"segcontrol_uns-uns.
if ([[MPiOSConfig get].showQuickStart boolValue])
[self showGuide];
[TestFlight passCheckpoint:MPTestFlightCheckpointActivated];
[TestFlight passCheckpoint:MPCheckpointActivated];
[super applicationDidBecomeActive:application];
}
@ -435,7 +437,7 @@ UIImage *segmentUnselectedUnselected = [UIImage imageNamed:@"segcontrol_uns-uns.
[self saveContext];
[TestFlight passCheckpoint:MPTestFlightCheckpointTerminated];
[TestFlight passCheckpoint:MPCheckpointTerminated];
[[LocalyticsSession sharedLocalyticsSession] close];
[[LocalyticsSession sharedLocalyticsSession] upload];
@ -450,7 +452,7 @@ UIImage *segmentUnselectedUnselected = [UIImage imageNamed:@"segcontrol_uns-uns.
if (![[MPiOSConfig get].rememberLogin boolValue])
[self signOut];
[TestFlight passCheckpoint:MPTestFlightCheckpointDeactivated];
[TestFlight passCheckpoint:MPCheckpointDeactivated];
}
#pragma mark - MFMailComposeViewControllerDelegate

View File

@ -11,7 +11,7 @@
#import "MPAppDelegate_Key.h"
#import "MPAppDelegate_Store.h"
#import "ATConnect.h"
#import "MPUnlockViewController.h"
#import "LocalyticsSession.h"
@interface MPMainViewController (Private)
@ -209,7 +209,7 @@
- (void)setHelpChapter:(NSString *)chapter {
[TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointHelpChapter, chapter]];
[TestFlight passCheckpoint:PearlString(MPCheckpointHelpChapter @"_%@", chapter)];
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *url = [NSURL URLWithString:[@"#" stringByAppendingString:chapter]
@ -282,7 +282,11 @@
[self showContentTip:@"Copied!" withIcon:nil];
[TestFlight passCheckpoint:MPTestFlightCheckpointCopyToPasteboard];
[TestFlight passCheckpoint:MPCheckpointCopyToPasteboard];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyToPasteboard
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
NSStringFromMPElementType(self.activeElement.type), @"type",
nil]];
}
- (IBAction)incrementPasswordCounter {
@ -300,7 +304,11 @@
++((MPElementGeneratedEntity *)self.activeElement).counter;
}];
[TestFlight passCheckpoint:MPTestFlightCheckpointIncrementPasswordCounter];
[TestFlight passCheckpoint:MPCheckpointIncrementPasswordCounter];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointIncrementPasswordCounter
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
NSStringFromMPElementType(self.activeElement.type), @"type",
nil]];
}
- (IBAction)resetPasswordCounter:(UILongPressGestureRecognizer *)sender {
@ -323,7 +331,11 @@
((MPElementGeneratedEntity *)self.activeElement).counter = 1;
}];
[TestFlight passCheckpoint:MPTestFlightCheckpointResetPasswordCounter];
[TestFlight passCheckpoint:MPCheckpointResetPasswordCounter];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointResetPasswordCounter
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
NSStringFromMPElementType(self.activeElement.type), @"type",
nil]];
}
- (void)changeElementWithWarning:(NSString *)warning do:(void (^)(void))task; {
@ -364,7 +376,11 @@
[self.contentField becomeFirstResponder];
}
[TestFlight passCheckpoint:MPTestFlightCheckpointEditPassword];
[TestFlight passCheckpoint:MPCheckpointEditPassword];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointEditPassword
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
NSStringFromMPElementType(self.activeElement.type), @"type",
nil]];
}
- (IBAction)closeAlert {
@ -376,7 +392,7 @@
self.alertBody.text = nil;
}];
[TestFlight passCheckpoint:MPTestFlightCheckpointCloseAlert];
[TestFlight passCheckpoint:MPCheckpointCloseAlert];
}
- (IBAction)action:(id)sender {
@ -424,7 +440,7 @@
}
}
[TestFlight passCheckpoint:MPTestFlightCheckpointAction];
[TestFlight passCheckpoint:MPCheckpointAction];
}
cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil otherTitles:
[self isHelpVisible]? @"Hide Help": @"Show Help", @"FAQ", @"Tutorial", @"Preferences", @"Feedback", @"Sign Out", nil];
@ -460,7 +476,7 @@
self.activeElement.type = type;
[TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointSelectType, NSStringFromMPElementType(
[TestFlight passCheckpoint:[NSString stringWithFormat:MPCheckpointSelectType, NSStringFromMPElementType(
type)]];
if (type & MPElementTypeClassStored && ![[self.activeElement.content description] length])
@ -499,8 +515,12 @@
[self.searchDisplayController setActive:NO animated:YES];
self.searchDisplayController.searchBar.text = self.activeElement.name;
[TestFlight passCheckpoint:PearlString(MPTestFlightCheckpointUseType, NSStringFromMPElementType(self.activeElement.type))];
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationElementUsed object:self.activeElement];
[TestFlight passCheckpoint:PearlString(MPCheckpointUseType @"_%@", NSStringFromMPElementType(self.activeElement.type))];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointUseType
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
NSStringFromMPElementType(self.activeElement.type), @"type",
nil]];
}
[self updateAnimated:YES];
@ -536,7 +556,7 @@
navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
[TestFlight passCheckpoint:MPTestFlightCheckpointExternalLink];
[TestFlight passCheckpoint:MPCheckpointExternalLink];
[[UIApplication sharedApplication] openURL:[request URL]];
return NO;

View File

@ -9,6 +9,7 @@
#import "MPSearchDelegate.h"
#import "MPAppDelegate.h"
#import "MPAppDelegate_Store.h"
#import "LocalyticsSession.h"
@interface MPSearchDelegate (Private)
@ -77,7 +78,7 @@
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
[TestFlight passCheckpoint:MPTestFlightCheckpointCancelSearch];
[TestFlight passCheckpoint:MPCheckpointCancelSearch];
[self.delegate didSelectElement:nil];
}
@ -346,7 +347,11 @@ forRowAtIndexPath:(NSIndexPath *)indexPath {
MPElementEntity *element = [self.fetchedResultsController objectAtIndexPath:indexPath];
[self.fetchedResultsController.managedObjectContext deleteObject:element];
[TestFlight passCheckpoint:MPTestFlightCheckpointDeleteElement];
[TestFlight passCheckpoint:MPCheckpointDeleteElement];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointDeleteElement
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
NSStringFromMPElementType(element.type), @"type",
nil]];
}];
}
}