2
0

MPCheckpoint

[UPDATED]   Refactoring of checkpoints.
This commit is contained in:
Maarten Billemont
2013-04-20 13:51:37 -04:00
parent efcfbe2584
commit c0d57b5561
9 changed files with 96 additions and 161 deletions

View File

@@ -48,10 +48,10 @@
#endif
[TestFlight addCustomEnvironmentInformation:@"Anonymous" forKey:@"username"];
[TestFlight addCustomEnvironmentInformation:[PearlKeyChain deviceIdentifier] forKey:@"deviceIdentifier"];
[TestFlight setOptions:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], @"logToConsole",
[NSNumber numberWithBool:NO], @"logToSTDERR",
nil]];
[TestFlight setOptions:@{
@"logToConsole" : @NO,
@"logToSTDERR" : @NO
}];
[TestFlight takeOff:testFlightToken];
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
PearlLogLevel level = PearlLogLevelWarn;
@@ -120,11 +120,10 @@
[[LocalyticsSession sharedLocalyticsSession] upload];
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
if (message.level >= PearlLogLevelWarn)
[[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Problem"
attributes:@{
@"level": @(PearlLogLevelStr(message.level)),
@"message": message.message
}];
MPCheckpoint( @"Problem", @{
@"level" : @(PearlLogLevelStr( message.level )),
@"message" : message.message
} );
return YES;
}];
@@ -220,22 +219,20 @@
forKey:@"askForReviews"];
[TestFlight addCustomEnvironmentInformation:[[PearlConfig get].reviewAfterLaunches description] forKey:@"reviewAfterLaunches"];
[TestFlight addCustomEnvironmentInformation:[PearlConfig get].reviewedVersion forKey:@"reviewedVersion"];
[TestFlight passCheckpoint:MPCheckpointConfig];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointConfig attributes:@{
@"rememberLogin" : [[MPConfig get].rememberLogin boolValue]? @"YES": @"NO",
@"iCloud" : [self storeManager].cloudEnabled? @"YES": @"NO",
@"iCloudDecided" : [[MPConfig get].iCloudDecided boolValue]? @"YES": @"NO",
@"sendInfo" : [[MPiOSConfig get].sendInfo boolValue]? @"YES": @"NO",
@"helpHidden" : [[MPiOSConfig get].helpHidden boolValue]? @"YES": @"NO",
@"showQuickStart" : [[MPiOSConfig get].showSetup boolValue]? @"YES": @"NO",
@"firstRun" : [[PearlConfig get].firstRun boolValue]? @"YES": @"NO",
@"launchCount" : NilToNSNull([[PearlConfig get].launchCount description]),
@"askForReviews" : [[PearlConfig get].askForReviews boolValue]? @"YES": @"NO",
@"reviewAfterLaunches" : NilToNSNull([[PearlConfig get].reviewAfterLaunches description]),
@"reviewedVersion" : NilToNSNull([PearlConfig get].reviewedVersion)
}];
MPCheckpoint( MPCheckpointConfig, @{
@"rememberLogin" : [[MPConfig get].rememberLogin boolValue]? @"YES": @"NO",
@"iCloud" : [self storeManager].cloudEnabled? @"YES": @"NO",
@"iCloudDecided" : [[MPConfig get].iCloudDecided boolValue]? @"YES": @"NO",
@"sendInfo" : [[MPiOSConfig get].sendInfo boolValue]? @"YES": @"NO",
@"helpHidden" : [[MPiOSConfig get].helpHidden boolValue]? @"YES": @"NO",
@"showQuickStart" : [[MPiOSConfig get].showSetup boolValue]? @"YES": @"NO",
@"firstRun" : [[PearlConfig get].firstRun boolValue]? @"YES": @"NO",
@"launchCount" : NilToNSNull([[PearlConfig get].launchCount description]),
@"askForReviews" : [[PearlConfig get].askForReviews boolValue]? @"YES": @"NO",
@"reviewAfterLaunches" : NilToNSNull([[PearlConfig get].reviewAfterLaunches description]),
@"reviewedVersion" : NilToNSNull([PearlConfig get].reviewedVersion)
} );
}
}];
[[NSNotificationCenter defaultCenter] addObserverForName:kIASKAppSettingChanged object:nil queue:nil
@@ -429,20 +426,14 @@
[self.navigationController performSegueWithIdentifier:@"MP_Guide" sender:self];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointShowGuide];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointShowGuide attributes:nil];
MPCheckpoint( MPCheckpointShowGuide, nil );
}
- (void)showSetup {
[self.navigationController performSegueWithIdentifier:@"MP_Setup" sender:self];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointShowSetup];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointShowSetup attributes:nil];
MPCheckpoint( MPCheckpointShowSetup, nil );
}
- (void)showFeedback {
@@ -452,10 +443,7 @@
- (void)showReview {
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointReview];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointReview attributes:nil];
MPCheckpoint( MPCheckpointReview, nil );
[super showReview];
}
@@ -605,10 +593,7 @@
if (didReset)
didReset();
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointChangeMP];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointChangeMP attributes:nil];
MPCheckpoint( MPCheckpointChangeMP, nil );
}
cancelTitle:[PearlStrings get].commonButtonAbort
otherTitles:[PearlStrings get].commonButtonContinue, nil];

View File

@@ -25,20 +25,18 @@
- (IBAction)gorillas:(UIButton *)sender {
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointAppGorillas];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointAppGorillas attributes:nil];
MPCheckpoint( MPCheckpointApp, @{
@"app" : @"gorillas"
} );
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/app/lyndir/gorillas/id302275459?mt=8"]];
}
- (IBAction)deblock:(UIButton *)sender {
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointAppDeBlock];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointAppDeBlock attributes:nil];
MPCheckpoint( MPCheckpointApp, @{
@"app": @"deblock"
} );
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/app/lyndir/deblock/id325058485?mt=8"]];
}

View File

@@ -66,11 +66,7 @@
- (void)viewWillAppear:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointApps];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointApps attributes:nil];
MPCheckpoint( MPCheckpointApps, nil );
[self.pageViewController setViewControllers:@[ [self.pageVCs objectAtIndex:1] ] direction:UIPageViewControllerNavigationDirectionForward
animated:NO completion:nil];

View File

@@ -289,13 +289,10 @@ forRowAtIndexPath:(NSIndexPath *)indexPath {
[element.managedObjectContext deleteObject:element];
[element.managedObjectContext saveToStore];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointDeleteElement];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointDeleteElement attributes:@{
MPCheckpoint( MPCheckpointDeleteElement, @{
@"type" : element.typeName,
@"version" : @(element.version)
}];
});
}];
}
}

View File

@@ -310,10 +310,9 @@
- (void)setHelpChapter:(NSString *)chapter {
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:PearlString(MPCheckpointHelpChapter @"_%@", chapter)];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointHelpChapter attributes:@{@"chapter": chapter}];
MPCheckpoint( MPCheckpointHelpChapter, @{
@"chapter" : chapter
} );
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *url = [NSURL URLWithString:[@"#" stringByAppendingString:chapter]
@@ -471,11 +470,11 @@
[self showContentTip:@"Copied!" withIcon:nil];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointCopyToPasteboard];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyToPasteboard attributes:@{@"type" : activeElement.typeName,
@"version" : @(activeElement.version)}];
MPCheckpoint( MPCheckpointCopyToPasteboard, @{
@"type" : activeElement.typeName,
@"version" : @(activeElement.version),
@"emergency" : @NO
} );
}
- (IBAction)copyLoginName:(UITapGestureRecognizer *)sender {
@@ -489,12 +488,10 @@
[self showLoginNameTip:@"Copied!"];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointCopyLoginNameToPasteboard];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyLoginNameToPasteboard
attributes:@{@"type" : activeElement.typeName,
@"version" : @(activeElement.version)}];
MPCheckpoint( MPCheckpointCopyLoginNameToPasteboard, @{
@"type" : activeElement.typeName,
@"version" : @(activeElement.version)
} );
}
- (IBAction)incrementPasswordCounter {
@@ -510,16 +507,16 @@
err(@"Cannot increment password counter: Element is not generated: %@", activeElement.name);
return NO;
}
MPElementGeneratedEntity *activeGeneratedElement = (MPElementGeneratedEntity *)activeElement;
inf(@"Incrementing password counter for: %@", activeElement.name);
++((MPElementGeneratedEntity *)activeElement).counter;
inf(@"Incrementing password counter for: %@", activeGeneratedElement.name);
++activeGeneratedElement.counter;
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointIncrementPasswordCounter];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointIncrementPasswordCounter
attributes:@{@"type": activeElement.typeName,
@"version": @(activeElement.version)}];
MPCheckpoint( MPCheckpointIncrementPasswordCounter, @{
@"type" : activeGeneratedElement.typeName,
@"version" : @(activeGeneratedElement.version),
@"counter" : @(activeGeneratedElement.counter)
} );
return YES;
}];
}
@@ -547,12 +544,10 @@
inf(@"Resetting password counter for: %@", activeElement_.name);
((MPElementGeneratedEntity *)activeElement_).counter = 1;
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointResetPasswordCounter];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointResetPasswordCounter
attributes:@{@"type": activeElement_.typeName,
@"version": @(activeElement_.version)}];
MPCheckpoint( MPCheckpointResetPasswordCounter, @{
@"type" : activeElement_.typeName,
@"version" : @(activeElement_.version)
} );
return YES;
}];
}
@@ -570,11 +565,10 @@
self.loginNameField.enabled = YES;
[self.loginNameField becomeFirstResponder];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointEditLoginName];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointEditLoginName attributes:@{@"type" : activeElement.typeName,
@"version" : @(activeElement.version)}];
MPCheckpoint( MPCheckpointEditLoginName, @{
@"type" : activeElement.typeName,
@"version" : @(activeElement.version)
} );
}
- (void)changeActiveElementWithWarning:(NSString *)warning do:(BOOL (^)(MPElementEntity *activeElement))task; {
@@ -644,11 +638,10 @@
self.contentField.enabled = YES;
[self.contentField becomeFirstResponder];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointEditPassword];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointEditPassword attributes:@{@"type" : activeElement.typeName,
@"version" : @(activeElement.version)}];
MPCheckpoint( MPCheckpointEditPassword, @{
@"type" : activeElement.typeName,
@"version" : @(activeElement.version)
} );
}
- (IBAction)upgradePassword {
@@ -670,13 +663,10 @@
inf(@"Explicitly migrating element: %@", activeElement_);
[activeElement_ migrateExplicitly:YES];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointExplicitMigration];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointExplicitMigration attributes:@{
MPCheckpoint( MPCheckpointExplicitMigration, @{
@"type" : activeElement_.typeName,
@"version" : @(activeElement_.version)
}];
} );
return YES;
}];
}
@@ -849,12 +839,11 @@
[self.searchDisplayController setActive:NO animated:YES];
self.searchDisplayController.searchBar.text = activeElement.name;
[[NSNotificationCenter defaultCenter] postNotificationName:MPElementUpdatedNotification object:activeElement.objectID];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:PearlString(MPCheckpointUseType @"_%@", activeElement.typeShortName)];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointUseType attributes:@{@"type" : activeElement.typeName,
@"version" : @(activeElement.version)}];
MPCheckpoint( MPCheckpointUseType, @{
@"type" : activeElement.typeName,
@"version" : @(activeElement.version)
} );
[self updateAnimated:YES];
}

View File

@@ -897,14 +897,11 @@
}
}];
#ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:MPCheckpointCopyToPasteboard];
#endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyToPasteboard attributes:@{
@"type" : [MPAlgorithmDefault nameOfType:self.emergencyType],
@"version" : @MPAlgorithmDefaultVersion,
MPCheckpoint( MPCheckpointCopyToPasteboard, @{
@"type" : [MPAlgorithmDefault nameOfType:self.emergencyType],
@"version" : @MPAlgorithmDefaultVersion,
@"emergency" : @YES,
}];
} );
}
- (void)emergencyCloseAnimated:(BOOL)animated {