diff --git a/MasterPassword/ObjC/MPAppDelegate_Key.m b/MasterPassword/ObjC/MPAppDelegate_Key.m index 74d2abd0..a1917a8e 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Key.m +++ b/MasterPassword/ObjC/MPAppDelegate_Key.m @@ -74,7 +74,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) { - (BOOL)signInAsUser:(MPUserEntity *)user saveInContext:(NSManagedObjectContext *)moc usingMasterPassword:(NSString *)password { if (password) - NSAssert(![NSThread isMainThread], @"Computing key must not happen from the main thread."); + NSAssert(![NSThread isMainThread], @"Computing key must not happen from the main thread."); MPKey *tryKey = nil; diff --git a/MasterPassword/ObjC/MPAppDelegate_Store.m b/MasterPassword/ObjC/MPAppDelegate_Store.m index 121c8b8d..65eb71d2 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Store.m +++ b/MasterPassword/ObjC/MPAppDelegate_Store.m @@ -105,14 +105,15 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext, #if TARGET_OS_IPHONE [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillTerminateNotification object:[UIApplication sharedApplication] queue:[NSOperationQueue mainQueue] usingBlock: - ^(NSNotification *note) { - [[self mainManagedObjectContext] saveToStore]; - }]; - [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication] - queue:[NSOperationQueue mainQueue] usingBlock: - ^(NSNotification *note) { - [[self mainManagedObjectContext] saveToStore]; - }]; + ^(NSNotification *note) { + [[self mainManagedObjectContext] saveToStore]; + }]; + [[NSNotificationCenter defaultCenter] + addObserverForName:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication] + queue:[NSOperationQueue mainQueue] usingBlock: + ^(NSNotification *note) { + [[self mainManagedObjectContext] saveToStore]; + }]; #else [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillTerminateNotification object:NSApp queue:[NSOperationQueue mainQueue] usingBlock: @@ -374,7 +375,7 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext, err(@"[StoreManager] ERROR: cause=%d, context=%@, error=%@", cause, context, error); MPCheckpoint( MPCheckpointMPErrorUbiquity, @{ @"cause" : @(cause), - @"error.domain" : error.domain, + @"error.domain" : NilToNSNull(error.domain), @"error.code" : @(error.code) } ); } @@ -413,7 +414,8 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext, NSManagedObjectID *elementOID = [element objectID]; dispatch_async( dispatch_get_main_queue(), ^{ - completion( (MPElementEntity *)[[MPAppDelegate_Shared managedObjectContextForMainThreadIfReady] objectRegisteredForID:elementOID] ); + completion( + (MPElementEntity *)[[MPAppDelegate_Shared managedObjectContextForMainThreadIfReady] objectRegisteredForID:elementOID] ); } ); }]; } diff --git a/MasterPassword/ObjC/iOS/MPElementListController.m b/MasterPassword/ObjC/iOS/MPElementListController.m index 1e20d626..56d5a3b0 100644 --- a/MasterPassword/ObjC/iOS/MPElementListController.m +++ b/MasterPassword/ObjC/iOS/MPElementListController.m @@ -271,7 +271,7 @@ forRowAtIndexPath:(NSIndexPath *)indexPath { [context saveToStore]; MPCheckpoint( MPCheckpointDeleteElement, @{ - @"type" : element.typeName, + @"type" : NilToNSNull(element.typeName), @"version" : @(element.version) } ); }]; diff --git a/MasterPassword/ObjC/iOS/MPMainViewController.m b/MasterPassword/ObjC/iOS/MPMainViewController.m index 863d14e2..df69a105 100644 --- a/MasterPassword/ObjC/iOS/MPMainViewController.m +++ b/MasterPassword/ObjC/iOS/MPMainViewController.m @@ -319,7 +319,7 @@ - (void)setHelpChapter:(NSString *)chapter { MPCheckpoint( MPCheckpointHelpChapter, @{ - @"chapter" : chapter + @"chapter" : NilToNSNull(chapter) } ); dispatch_async( dispatch_get_main_queue(), ^{ @@ -479,7 +479,7 @@ [self showContentTip:@"Copied!" withIcon:nil]; MPCheckpoint( MPCheckpointCopyToPasteboard, @{ - @"type" : activeElement.typeName, + @"type" : NilToNSNull(activeElement.typeName), @"version" : @(activeElement.version), @"emergency" : @NO } ); @@ -497,7 +497,7 @@ [self showLoginNameTip:@"Copied!"]; MPCheckpoint( MPCheckpointCopyLoginNameToPasteboard, @{ - @"type" : activeElement.typeName, + @"type" : NilToNSNull(activeElement.typeName), @"version" : @(activeElement.version) } ); } @@ -521,7 +521,7 @@ ++activeGeneratedElement.counter; MPCheckpoint( MPCheckpointIncrementPasswordCounter, @{ - @"type" : activeGeneratedElement.typeName, + @"type" : NilToNSNull(activeGeneratedElement.typeName), @"version" : @(activeGeneratedElement.version), @"counter" : @(activeGeneratedElement.counter) } ); @@ -553,7 +553,7 @@ ((MPElementGeneratedEntity *)activeElement_).counter = 1; MPCheckpoint( MPCheckpointResetPasswordCounter, @{ - @"type" : activeElement_.typeName, + @"type" : NilToNSNull(activeElement_.typeName), @"version" : @(activeElement_.version) } ); return YES; @@ -574,7 +574,7 @@ [self.loginNameField becomeFirstResponder]; MPCheckpoint( MPCheckpointEditLoginName, @{ - @"type" : activeElement.typeName, + @"type" : NilToNSNull(activeElement.typeName), @"version" : @(activeElement.version) } ); } @@ -601,7 +601,7 @@ NSString *oldPassword = [activeElement.content description]; if (!task( activeElement, context )) return; - + activeElement = [self activeElementInContext:context]; NSString *newPassword = [activeElement.content description]; @@ -655,7 +655,7 @@ [self.contentField becomeFirstResponder]; MPCheckpoint( MPCheckpointEditPassword, @{ - @"type" : activeElement.typeName, + @"type" : NilToNSNull(activeElement.typeName), @"version" : @(activeElement.version) } ); } @@ -680,7 +680,7 @@ [activeElement_ migrateExplicitly:YES]; MPCheckpoint( MPCheckpointExplicitMigration, @{ - @"type" : activeElement_.typeName, + @"type" : NilToNSNull(activeElement_.typeName), @"version" : @(activeElement_.version) } ); return YES; @@ -831,11 +831,11 @@ } ); } }]; - + MPCheckpoint( MPCheckpointUseType, @{ - @"type" : element.typeName, - @"version" : @(element.version) - } ); + @"type" : NilToNSNull(element.typeName), + @"version" : @(element.version) + } ); } [self.searchDisplayController setActive:NO animated:YES]; diff --git a/MasterPassword/ObjC/iOS/MPPreferencesViewController.m b/MasterPassword/ObjC/iOS/MPPreferencesViewController.m index 58b0a621..be5e958d 100644 --- a/MasterPassword/ObjC/iOS/MPPreferencesViewController.m +++ b/MasterPassword/ObjC/iOS/MPPreferencesViewController.m @@ -6,7 +6,6 @@ // Copyright (c) 2012 Lyndir. All rights reserved. // -#import #import "MPPreferencesViewController.h" #import "MPiOSAppDelegate.h" #import "MPAppDelegate_Key.h" @@ -99,7 +98,7 @@ if (motion == UIEventSubtypeMotionShake) { MPCheckpoint( MPCheckpointLogs, @{ - @"trace": [MPiOSConfig get].traceMode + @"trace" : [MPiOSConfig get].traceMode } ); [self performSegueWithIdentifier:@"MP_Logs" sender:self]; } diff --git a/MasterPassword/ObjC/iOS/MPUnlockViewController.m b/MasterPassword/ObjC/iOS/MPUnlockViewController.m index c5e8ae0f..90522309 100644 --- a/MasterPassword/ObjC/iOS/MPUnlockViewController.m +++ b/MasterPassword/ObjC/iOS/MPUnlockViewController.m @@ -6,16 +6,13 @@ // Copyright (c) 2012 Lyndir. All rights reserved. // -#import #import -#import #import "MPUnlockViewController.h" #import "MPiOSAppDelegate.h" #import "MPAppDelegate_Key.h" #import "MPAppDelegate_Store.h" - @interface MPUnlockViewController() @property(strong, nonatomic) NSMutableDictionary *avatarToUserOID; @@ -30,7 +27,6 @@ @property(nonatomic, strong) NSArray *marqueeTipTexts; @end - @implementation MPUnlockViewController { NSManagedObjectID *_selectedUserOID; } @@ -932,7 +928,7 @@ }]; MPCheckpoint( MPCheckpointCopyToPasteboard, @{ - @"type" : [MPAlgorithmDefault nameOfType:self.emergencyType], + @"type" : NilToNSNull([MPAlgorithmDefault nameOfType:self.emergencyType]), @"version" : @MPAlgorithmDefaultVersion, @"emergency" : @YES, } ); diff --git a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m index 7a1e5147..b99d651d 100644 --- a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m +++ b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m @@ -124,7 +124,7 @@ if (message.level >= PearlLogLevelWarn) MPCheckpoint( @"Problem", @{ @"level" : @(PearlLogLevelStr( message.level )), - @"message" : message.message + @"message" : NilToNSNull(message.message) } ); return YES; @@ -207,25 +207,25 @@ [[Crashlytics sharedInstance] setObjectValue:[PearlConfig get].reviewedVersion forKey:@"reviewedVersion"]; #ifdef TESTFLIGHT_SDK_VERSION - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPConfig get].rememberLogin) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].rememberLogin ) forKey:@"rememberLogin"]; - [TestFlight addCustomEnvironmentInformation:PearlStringB([self storeManager].cloudEnabled) + [TestFlight addCustomEnvironmentInformation:PearlStringB( [self storeManager].cloudEnabled ) forKey:@"iCloud"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPConfig get].iCloudDecided) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPConfig get].iCloudDecided ) forKey:@"iCloudDecided"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPiOSConfig get].sendInfo) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].sendInfo ) forKey:@"sendInfo"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPiOSConfig get].helpHidden) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].helpHidden ) forKey:@"helpHidden"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([MPiOSConfig get].showSetup) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [MPiOSConfig get].showSetup ) forKey:@"showQuickStart"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].firstRun) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].firstRun ) forKey:@"firstRun"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].launchCount) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].launchCount ) forKey:@"launchCount"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].askForReviews) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].askForReviews ) forKey:@"askForReviews"]; - [TestFlight addCustomEnvironmentInformation:PearlStringNSB([PearlConfig get].reviewAfterLaunches) + [TestFlight addCustomEnvironmentInformation:PearlStringNSB( [PearlConfig get].reviewAfterLaunches ) forKey:@"reviewAfterLaunches"]; [TestFlight addCustomEnvironmentInformation:[PearlConfig get].reviewedVersion forKey:@"reviewedVersion"]; @@ -271,17 +271,17 @@ [[MPiOSAppDelegate get] showSetup]; } ); - MPCheckpoint(MPCheckpointStarted, @{ - @"simulator" : PearlStringB([PearlDeviceUtils isSimulator]), - @"encrypted" : PearlStringB([PearlDeviceUtils isAppEncrypted]), - @"jailbroken" : PearlStringB([PearlDeviceUtils isJailbroken]), - @"platform" : [PearlDeviceUtils platform], + MPCheckpoint( MPCheckpointStarted, @{ + @"simulator" : PearlStringB( [PearlDeviceUtils isSimulator] ), + @"encrypted" : PearlStringB( [PearlDeviceUtils isAppEncrypted] ), + @"jailbroken" : PearlStringB( [PearlDeviceUtils isJailbroken] ), + @"platform" : [PearlDeviceUtils platform], #ifdef APPSTORE @"legal" : PearlStringB([PearlDeviceUtils isAppEncrypted]), #else - @"legal" : @"YES", + @"legal" : @"YES", #endif - }); + } ); return YES; } @@ -737,7 +737,7 @@ NSString *testFlightToken = NSNullToNil([[self testFlightInfo] valueForKeyPath:@"Application Token"]); if (![testFlightToken length]) wrn(@"TestFlight token not set. Test Flight won't be aware of this test."); - + return testFlightToken; } @@ -785,7 +785,7 @@ #endif if (![localyticsKey length]) wrn(@"Localytics key not set. Demographics won't be collected."); - + return localyticsKey; }