From 72f0d69a719dee446f594107a04fd354ae3f4281 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sun, 25 Aug 2013 18:49:13 -0400 Subject: [PATCH] Don't use Localytics or Crashlytics when disabled. --- MasterPassword/ObjC/MPAppDelegate_Key.m | 2 +- .../ObjC/iOS/MPAppsViewController.m | 4 +- .../ObjC/iOS/MPGuideViewController.m | 2 + .../ObjC/iOS/MPMainViewController.m | 2 + .../ObjC/iOS/MPPreferencesViewController.m | 2 + .../ObjC/iOS/MPSetupViewController.m | 2 + .../ObjC/iOS/MPTypeViewController.m | 2 + .../ObjC/iOS/MPUnlockViewController.m | 2 + MasterPassword/ObjC/iOS/MPiOSAppDelegate.m | 16 + .../ObjC/iOS/MainStoryboard_iPhone.storyboard | 522 +++++------------- Site/2013-05/news-dev.html | 21 + 11 files changed, 205 insertions(+), 372 deletions(-) create mode 100644 Site/2013-05/news-dev.html diff --git a/MasterPassword/ObjC/MPAppDelegate_Key.m b/MasterPassword/ObjC/MPAppDelegate_Key.m index a1917a8e..fd09f616 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Key.m +++ b/MasterPassword/ObjC/MPAppDelegate_Key.m @@ -139,7 +139,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) { [Crashlytics setObjectValue:user.userID forKey:@"username"]; [Crashlytics setUserName:user.userID]; #endif -#if TARGET_OS_IPHONE +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] setCustomerName:user.userID]; #endif } diff --git a/MasterPassword/ObjC/iOS/MPAppsViewController.m b/MasterPassword/ObjC/iOS/MPAppsViewController.m index 26dd6373..17c23db1 100644 --- a/MasterPassword/ObjC/iOS/MPAppsViewController.m +++ b/MasterPassword/ObjC/iOS/MPAppsViewController.m @@ -73,8 +73,10 @@ - (void)viewDidAppear:(BOOL)animated { +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Apps"]; - +#endif + [self.pageViewController setViewControllers:@[ [self.pageVCs objectAtIndex:0] ] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; diff --git a/MasterPassword/ObjC/iOS/MPGuideViewController.m b/MasterPassword/ObjC/iOS/MPGuideViewController.m index eeccb476..499a5986 100644 --- a/MasterPassword/ObjC/iOS/MPGuideViewController.m +++ b/MasterPassword/ObjC/iOS/MPGuideViewController.m @@ -67,7 +67,9 @@ - (void)viewDidAppear:(BOOL)animated { +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Guide"]; +#endif [super viewDidAppear:animated]; } diff --git a/MasterPassword/ObjC/iOS/MPMainViewController.m b/MasterPassword/ObjC/iOS/MPMainViewController.m index df69a105..791922cf 100644 --- a/MasterPassword/ObjC/iOS/MPMainViewController.m +++ b/MasterPassword/ObjC/iOS/MPMainViewController.m @@ -180,7 +180,9 @@ } ); }]; +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Main"]; +#endif [super viewDidAppear:animated]; } diff --git a/MasterPassword/ObjC/iOS/MPPreferencesViewController.m b/MasterPassword/ObjC/iOS/MPPreferencesViewController.m index 57fb7a7d..f9144b4e 100644 --- a/MasterPassword/ObjC/iOS/MPPreferencesViewController.m +++ b/MasterPassword/ObjC/iOS/MPPreferencesViewController.m @@ -80,7 +80,9 @@ - (void)viewDidAppear:(BOOL)animated { +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Preferences"]; +#endif [super viewDidAppear:animated]; } diff --git a/MasterPassword/ObjC/iOS/MPSetupViewController.m b/MasterPassword/ObjC/iOS/MPSetupViewController.m index 23de9e26..7c0623d4 100644 --- a/MasterPassword/ObjC/iOS/MPSetupViewController.m +++ b/MasterPassword/ObjC/iOS/MPSetupViewController.m @@ -24,7 +24,9 @@ - (void)viewDidAppear:(BOOL)animated { +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Setup"]; +#endif [super viewDidAppear:animated]; diff --git a/MasterPassword/ObjC/iOS/MPTypeViewController.m b/MasterPassword/ObjC/iOS/MPTypeViewController.m index 7d50a234..74667272 100644 --- a/MasterPassword/ObjC/iOS/MPTypeViewController.m +++ b/MasterPassword/ObjC/iOS/MPTypeViewController.m @@ -43,7 +43,9 @@ } }]; +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Type Selection"]; +#endif [super viewDidAppear:animated]; } diff --git a/MasterPassword/ObjC/iOS/MPUnlockViewController.m b/MasterPassword/ObjC/iOS/MPUnlockViewController.m index 4ccaab16..644d209d 100644 --- a/MasterPassword/ObjC/iOS/MPUnlockViewController.m +++ b/MasterPassword/ObjC/iOS/MPUnlockViewController.m @@ -231,7 +231,9 @@ [self.marqueeTipTimer invalidate]; self.marqueeTipTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(marqueeTip) userInfo:nil repeats:YES]; +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Unlock"]; +#endif [super viewDidAppear:animated]; } diff --git a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m index b99d651d..2198755c 100644 --- a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m +++ b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m @@ -81,6 +81,7 @@ @catch (id exception) { err(@"Google+: %@", exception); } +#ifdef CRASHLYTICS @try { NSString *crashlyticsAPIKey = [self crashlyticsAPIKey]; if ([crashlyticsAPIKey length]) { @@ -110,6 +111,8 @@ @catch (id exception) { err(@"Crashlytics: %@", exception); } +#endif +#ifdef LOCALYTICS @try { NSString *localyticsKey = [self localyticsKey]; if ([localyticsKey length]) { @@ -134,6 +137,7 @@ @catch (id exception) { err(@"Localytics exception: %@", exception); } +#endif UIImage *navBarImage = [[UIImage imageNamed:@"ui_navbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 5, 0, 5 )]; [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault]; @@ -193,6 +197,7 @@ if ([PearlLogger get].printLevel > PearlLogLevelInfo) [PearlLogger get].printLevel = PearlLogLevelInfo; +#ifdef CRASHLYTICS [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"]; [[Crashlytics sharedInstance] setBoolValue:[self storeManager].cloudEnabled forKey:@"iCloud"]; [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloudDecided boolValue] forKey:@"iCloudDecided"]; @@ -205,6 +210,7 @@ [[Crashlytics sharedInstance] setIntValue:[[PearlConfig get].reviewAfterLaunches intValue] forKey:@"reviewAfterLaunches"]; [[Crashlytics sharedInstance] setObjectValue:[PearlConfig get].reviewedVersion forKey:@"reviewedVersion"]; +#endif #ifdef TESTFLIGHT_SDK_VERSION [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].rememberLogin ) @@ -395,24 +401,30 @@ - (void)applicationDidEnterBackground:(UIApplication *)application { +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] close]; [[LocalyticsSession sharedLocalyticsSession] upload]; +#endif [super applicationDidEnterBackground:application]; } - (void)applicationWillEnterForeground:(UIApplication *)application { +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] resume]; [[LocalyticsSession sharedLocalyticsSession] upload]; +#endif [super applicationWillEnterForeground:application]; } - (void)applicationWillTerminate:(UIApplication *)application { +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] close]; [[LocalyticsSession sharedLocalyticsSession] upload]; +#endif [super applicationWillTerminate:application]; } @@ -423,8 +435,10 @@ if (![[MPiOSConfig get].rememberLogin boolValue]) [self signOutAnimated:NO]; +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] close]; [[LocalyticsSession sharedLocalyticsSession] upload]; +#endif [super applicationWillResignActive:application]; } @@ -434,8 +448,10 @@ inf(@"Re-activated"); [[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:application userInfo:nil]; +#ifdef LOCALYTICS [[LocalyticsSession sharedLocalyticsSession] resume]; [[LocalyticsSession sharedLocalyticsSession] upload]; +#endif [super applicationDidBecomeActive:application]; } diff --git a/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard b/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard index 94fe5514..5a7c02f0 100644 --- a/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard +++ b/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -9,11 +10,11 @@ - + - + @@ -21,10 +22,10 @@ - + - - + + - - + - + - - + + - + - - + - + - - + + - + - - + - + - - + + - + - - + - + - - + + - + - - + - + - - + + - + - - + - + - - + + - + - - + - + - - + + - - + @@ -336,10 +329,10 @@ It's an estimate of the amount of time necessary for a hacker with a powerful co - + - - + + - - + - + - + @@ -397,17 +389,16 @@ Your passwords will be AES-encrypted with your master password. - - + - + - + @@ -433,17 +424,16 @@ Your passwords will be AES-encrypted with your master password. - - + - + - + @@ -458,8 +448,7 @@ Your passwords will be AES-encrypted with your master password. - - + @@ -481,15 +470,15 @@ Your passwords will be AES-encrypted with your master password. - + - + - + 119-20:51:52 MPiOSAppDelegate.m:36 | INFO : Initializing TestFlight @@ -519,7 +508,7 @@ Your passwords will be AES-encrypted with your master password. - + @@ -535,7 +524,7 @@ Your passwords will be AES-encrypted with your master password. - + @@ -574,11 +563,11 @@ Your passwords will be AES-encrypted with your master password. - + - + @@ -758,7 +747,7 @@ Your passwords will be AES-encrypted with your master password. - + @@ -921,7 +910,7 @@ Your passwords will be AES-encrypted with your master password. - + @@ -1448,7 +1437,7 @@ You can use the words in the background for inspiration in finding a memorable m - +