2
0

Don't use Localytics or Crashlytics when disabled.

This commit is contained in:
Maarten Billemont 2013-08-25 18:49:13 -04:00
parent 2399156ee4
commit 72f0d69a71
11 changed files with 205 additions and 372 deletions

View File

@ -139,7 +139,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
[Crashlytics setObjectValue:user.userID forKey:@"username"]; [Crashlytics setObjectValue:user.userID forKey:@"username"];
[Crashlytics setUserName:user.userID]; [Crashlytics setUserName:user.userID];
#endif #endif
#if TARGET_OS_IPHONE #ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] setCustomerName:user.userID]; [[LocalyticsSession sharedLocalyticsSession] setCustomerName:user.userID];
#endif #endif
} }

View File

@ -73,7 +73,9 @@
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Apps"]; [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Apps"];
#endif
[self.pageViewController setViewControllers:@[ [self.pageVCs objectAtIndex:0] ] direction:UIPageViewControllerNavigationDirectionForward [self.pageViewController setViewControllers:@[ [self.pageVCs objectAtIndex:0] ] direction:UIPageViewControllerNavigationDirectionForward
animated:YES completion:nil]; animated:YES completion:nil];

View File

@ -67,7 +67,9 @@
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Guide"]; [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Guide"];
#endif
[super viewDidAppear:animated]; [super viewDidAppear:animated];
} }

View File

@ -180,7 +180,9 @@
} ); } );
}]; }];
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Main"]; [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Main"];
#endif
[super viewDidAppear:animated]; [super viewDidAppear:animated];
} }

View File

@ -80,7 +80,9 @@
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Preferences"]; [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Preferences"];
#endif
[super viewDidAppear:animated]; [super viewDidAppear:animated];
} }

View File

@ -24,7 +24,9 @@
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Setup"]; [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Setup"];
#endif
[super viewDidAppear:animated]; [super viewDidAppear:animated];

View File

@ -43,7 +43,9 @@
} }
}]; }];
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Type Selection"]; [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Type Selection"];
#endif
[super viewDidAppear:animated]; [super viewDidAppear:animated];
} }

View File

@ -231,7 +231,9 @@
[self.marqueeTipTimer invalidate]; [self.marqueeTipTimer invalidate];
self.marqueeTipTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(marqueeTip) userInfo:nil repeats:YES]; self.marqueeTipTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(marqueeTip) userInfo:nil repeats:YES];
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Unlock"]; [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Unlock"];
#endif
[super viewDidAppear:animated]; [super viewDidAppear:animated];
} }

View File

@ -81,6 +81,7 @@
@catch (id exception) { @catch (id exception) {
err(@"Google+: %@", exception); err(@"Google+: %@", exception);
} }
#ifdef CRASHLYTICS
@try { @try {
NSString *crashlyticsAPIKey = [self crashlyticsAPIKey]; NSString *crashlyticsAPIKey = [self crashlyticsAPIKey];
if ([crashlyticsAPIKey length]) { if ([crashlyticsAPIKey length]) {
@ -110,6 +111,8 @@
@catch (id exception) { @catch (id exception) {
err(@"Crashlytics: %@", exception); err(@"Crashlytics: %@", exception);
} }
#endif
#ifdef LOCALYTICS
@try { @try {
NSString *localyticsKey = [self localyticsKey]; NSString *localyticsKey = [self localyticsKey];
if ([localyticsKey length]) { if ([localyticsKey length]) {
@ -134,6 +137,7 @@
@catch (id exception) { @catch (id exception) {
err(@"Localytics exception: %@", exception); err(@"Localytics exception: %@", exception);
} }
#endif
UIImage *navBarImage = [[UIImage imageNamed:@"ui_navbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 5, 0, 5 )]; UIImage *navBarImage = [[UIImage imageNamed:@"ui_navbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 5, 0, 5 )];
[[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault]; [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
@ -193,6 +197,7 @@
if ([PearlLogger get].printLevel > PearlLogLevelInfo) if ([PearlLogger get].printLevel > PearlLogLevelInfo)
[PearlLogger get].printLevel = PearlLogLevelInfo; [PearlLogger get].printLevel = PearlLogLevelInfo;
#ifdef CRASHLYTICS
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"]; [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"];
[[Crashlytics sharedInstance] setBoolValue:[self storeManager].cloudEnabled forKey:@"iCloud"]; [[Crashlytics sharedInstance] setBoolValue:[self storeManager].cloudEnabled forKey:@"iCloud"];
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloudDecided boolValue] forKey:@"iCloudDecided"]; [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloudDecided boolValue] forKey:@"iCloudDecided"];
@ -205,6 +210,7 @@
[[Crashlytics sharedInstance] [[Crashlytics sharedInstance]
setIntValue:[[PearlConfig get].reviewAfterLaunches intValue] forKey:@"reviewAfterLaunches"]; setIntValue:[[PearlConfig get].reviewAfterLaunches intValue] forKey:@"reviewAfterLaunches"];
[[Crashlytics sharedInstance] setObjectValue:[PearlConfig get].reviewedVersion forKey:@"reviewedVersion"]; [[Crashlytics sharedInstance] setObjectValue:[PearlConfig get].reviewedVersion forKey:@"reviewedVersion"];
#endif
#ifdef TESTFLIGHT_SDK_VERSION #ifdef TESTFLIGHT_SDK_VERSION
[TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].rememberLogin ) [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].rememberLogin )
@ -395,24 +401,30 @@
- (void)applicationDidEnterBackground:(UIApplication *)application { - (void)applicationDidEnterBackground:(UIApplication *)application {
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] close]; [[LocalyticsSession sharedLocalyticsSession] close];
[[LocalyticsSession sharedLocalyticsSession] upload]; [[LocalyticsSession sharedLocalyticsSession] upload];
#endif
[super applicationDidEnterBackground:application]; [super applicationDidEnterBackground:application];
} }
- (void)applicationWillEnterForeground:(UIApplication *)application { - (void)applicationWillEnterForeground:(UIApplication *)application {
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] resume]; [[LocalyticsSession sharedLocalyticsSession] resume];
[[LocalyticsSession sharedLocalyticsSession] upload]; [[LocalyticsSession sharedLocalyticsSession] upload];
#endif
[super applicationWillEnterForeground:application]; [super applicationWillEnterForeground:application];
} }
- (void)applicationWillTerminate:(UIApplication *)application { - (void)applicationWillTerminate:(UIApplication *)application {
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] close]; [[LocalyticsSession sharedLocalyticsSession] close];
[[LocalyticsSession sharedLocalyticsSession] upload]; [[LocalyticsSession sharedLocalyticsSession] upload];
#endif
[super applicationWillTerminate:application]; [super applicationWillTerminate:application];
} }
@ -423,8 +435,10 @@
if (![[MPiOSConfig get].rememberLogin boolValue]) if (![[MPiOSConfig get].rememberLogin boolValue])
[self signOutAnimated:NO]; [self signOutAnimated:NO];
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] close]; [[LocalyticsSession sharedLocalyticsSession] close];
[[LocalyticsSession sharedLocalyticsSession] upload]; [[LocalyticsSession sharedLocalyticsSession] upload];
#endif
[super applicationWillResignActive:application]; [super applicationWillResignActive:application];
} }
@ -434,8 +448,10 @@
inf(@"Re-activated"); inf(@"Re-activated");
[[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:application userInfo:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:application userInfo:nil];
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] resume]; [[LocalyticsSession sharedLocalyticsSession] resume];
[[LocalyticsSession sharedLocalyticsSession] upload]; [[LocalyticsSession sharedLocalyticsSession] upload];
#endif
[super applicationDidBecomeActive:application]; [super applicationDidBecomeActive:application];
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body, html {
color: white;
font-family: 'Copperplate', sans-serif;
font-size: smaller;
text-align: center;
}
*:link, *:visited {
color: inherit;
font-weight: bold;
}
</style>
</head>
<body>
<p><a href="mailto:masterpassword@lyndir.com">E-mail us</a> or open <a href="http://masterpasswordapp.com/support.html">support</a> if you have any issues.</p>
</body>
</html>