2
0

Modernize ObjC syntax.

[IMPROVED]  Migrate to modern ObjC syntax for type boxing.
This commit is contained in:
Maarten Billemont 2012-08-19 20:02:23 +02:00
parent 9d883b6ff7
commit 7921734740
12 changed files with 100 additions and 155 deletions

View File

@ -24,10 +24,10 @@ id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version) {
if (!versionToAlgorithm) if (!versionToAlgorithm)
versionToAlgorithm = [NSMutableDictionary dictionary]; versionToAlgorithm = [NSMutableDictionary dictionary];
id<MPAlgorithm> algorithm = [versionToAlgorithm objectForKey:PearlUnsignedInteger(version)]; id<MPAlgorithm> algorithm = [versionToAlgorithm objectForKey:@(version)];
if (!algorithm) if (!algorithm)
if ((algorithm = [NSClassFromString(PearlString(@"MPAlgorithmV%u", version)) new])) if ((algorithm = [NSClassFromString(PearlString(@"MPAlgorithmV%u", version)) new]))
[versionToAlgorithm setObject:algorithm forKey:PearlUnsignedInteger(version)]; [versionToAlgorithm setObject:algorithm forKey:@(version)];
return algorithm; return algorithm;
} }

View File

@ -16,10 +16,8 @@
static NSDictionary *keyQuery(MPUserEntity *user) { static NSDictionary *keyQuery(MPUserEntity *user) {
return [PearlKeyChain createQueryForClass:kSecClassGenericPassword return [PearlKeyChain createQueryForClass:kSecClassGenericPassword
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{(__bridge id)kSecAttrService: @"Saved Master Password",
@"Saved Master Password", (__bridge id)kSecAttrService, (__bridge id)kSecAttrAccount: user.name}
user.name, (__bridge id)kSecAttrAccount,
nil]
matches:nil]; matches:nil];
} }
@ -81,7 +79,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
if (self.activeUser) { if (self.activeUser) {
self.activeUser = nil; self.activeUser = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationSignedOut object:self userInfo: [[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationSignedOut object:self userInfo:
[NSDictionary dictionaryWithObject:PearlBool(animated) forKey:@"animated"]]; @{@"animated": @(animated)}];
} }
} }

View File

@ -62,8 +62,7 @@
localStoreURL:[[self applicationFilesDirectory] URLByAppendingPathComponent:@"MasterPassword.sqlite"] localStoreURL:[[self applicationFilesDirectory] URLByAppendingPathComponent:@"MasterPassword.sqlite"]
containerIdentifier:@"HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared" containerIdentifier:@"HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared"
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
additionalStoreOptions:[NSDictionary dictionaryWithObject:NSFileProtectionComplete additionalStoreOptions:@{NSPersistentStoreFileProtectionKey: NSFileProtectionComplete}
forKey:NSPersistentStoreFileProtectionKey]
#else #else
additionalStoreOptions:nil additionalStoreOptions:nil
#endif #endif
@ -134,10 +133,9 @@
[TestFlight passCheckpoint:iCloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled]; [TestFlight passCheckpoint:iCloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled];
#endif #endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCloud [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCloud
attributes:[NSDictionary dictionaryWithObject:iCloudEnabled? @"YES": @"NO" attributes:@{@"enabled": iCloudEnabled? @"YES": @"NO"}];
forKey:@"enabled"]];
[MPConfig get].iCloud = [NSNumber numberWithBool:iCloudEnabled]; [MPConfig get].iCloud = @(iCloudEnabled);
} }
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause
@ -312,7 +310,7 @@
dbg(@"Existing sites: %@", existingSites); dbg(@"Existing sites: %@", existingSites);
[elementsToDelete addObjectsFromArray:existingSites]; [elementsToDelete addObjectsFromArray:existingSites];
[importedSiteElements addObject:[NSArray arrayWithObjects:lastUsed, uses, type, version, name, exportContent, nil]]; [importedSiteElements addObject:@[lastUsed, uses, type, version, name, exportContent]];
} }
} }

View File

@ -16,13 +16,11 @@
if (!(self = [super init])) if (!(self = [super init]))
return nil; return nil;
[self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: [self.defaults registerDefaults:@{NSStringFromSelector(@selector(askForReviews)): @YES,
[NSNumber numberWithBool:YES], NSStringFromSelector(@selector(askForReviews)),
[NSNumber numberWithBool:NO], NSStringFromSelector(@selector(rememberLogin)), NSStringFromSelector(@selector(rememberLogin)): @NO,
[NSNumber numberWithBool:NO], NSStringFromSelector(@selector(iCloud)), NSStringFromSelector(@selector(iCloud)): @NO,
[NSNumber numberWithBool:NO], NSStringFromSelector(@selector(iCloudDecided)), NSStringFromSelector(@selector(iCloudDecided)): @NO}];
nil]];
self.delegate = [MPAppDelegate get]; self.delegate = [MPAppDelegate get];

View File

@ -18,7 +18,7 @@
- (void)setType:(MPElementType)aType { - (void)setType:(MPElementType)aType {
self.type_ = PearlUnsignedInteger(aType); self.type_ = @(aType);
} }
- (NSString *)typeName { - (NSString *)typeName {
@ -48,7 +48,7 @@
- (void)setUses:(NSUInteger)anUses { - (void)setUses:(NSUInteger)anUses {
self.uses_ = PearlUnsignedInteger(anUses); self.uses_ = @(anUses);
} }
- (NSUInteger)version { - (NSUInteger)version {
@ -58,7 +58,7 @@
- (void)setVersion:(NSUInteger)version { - (void)setVersion:(NSUInteger)version {
self.version_ = PearlUnsignedInteger(version); self.version_ = @(version);
} }
- (BOOL)requiresExplicitMigration { - (BOOL)requiresExplicitMigration {
@ -68,7 +68,7 @@
- (void)setRequiresExplicitMigration:(BOOL)requiresExplicitMigration { - (void)setRequiresExplicitMigration:(BOOL)requiresExplicitMigration {
self.requiresExplicitMigration_ = PearlBool(requiresExplicitMigration); self.requiresExplicitMigration_ = @(requiresExplicitMigration);
} }
- (id<MPAlgorithm>)algorithm { - (id<MPAlgorithm>)algorithm {
@ -136,7 +136,7 @@
- (void)setCounter:(NSUInteger)aCounter { - (void)setCounter:(NSUInteger)aCounter {
self.counter_ = PearlUnsignedInteger(aCounter); self.counter_ = @(aCounter);
} }
- (id)content { - (id)content {
@ -163,10 +163,8 @@
+ (NSDictionary *)queryForDevicePrivateElementNamed:(NSString *)name { + (NSDictionary *)queryForDevicePrivateElementNamed:(NSString *)name {
return [PearlKeyChain createQueryForClass:kSecClassGenericPassword return [PearlKeyChain createQueryForClass:kSecClassGenericPassword
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{(__bridge id)kSecAttrService: @"DevicePrivate",
@"DevicePrivate", (__bridge id)kSecAttrService, (__bridge id)kSecAttrAccount: name}
name, (__bridge id)kSecAttrAccount,
nil]
matches:nil]; matches:nil];
} }
@ -268,7 +266,7 @@
- (void)setAvatar:(NSUInteger)anAvatar { - (void)setAvatar:(NSUInteger)anAvatar {
self.avatar_ = PearlUnsignedInteger(anAvatar); self.avatar_ = @(anAvatar);
} }
- (BOOL)saveKey { - (BOOL)saveKey {
@ -278,7 +276,7 @@
- (void)setSaveKey:(BOOL)aSaveKey { - (void)setSaveKey:(BOOL)aSaveKey {
self.saveKey_ = [NSNumber numberWithBool:aSaveKey]; self.saveKey_ = @(aSaveKey);
} }
- (MPElementType)defaultType { - (MPElementType)defaultType {
@ -288,7 +286,7 @@
- (void)setDefaultType:(MPElementType)aDefaultType { - (void)setDefaultType:(MPElementType)aDefaultType {
self.defaultType_ = PearlUnsignedInteger(aDefaultType); self.defaultType_ = @(aDefaultType);
} }
- (BOOL)requiresExplicitMigration { - (BOOL)requiresExplicitMigration {
@ -298,7 +296,7 @@
- (void)setRequiresExplicitMigration:(BOOL)requiresExplicitMigration { - (void)setRequiresExplicitMigration:(BOOL)requiresExplicitMigration {
self.requiresExplicitMigration_ = PearlBool(requiresExplicitMigration); self.requiresExplicitMigration_ = @(requiresExplicitMigration);
} }
- (NSString *)userID { - (NSString *)userID {

View File

@ -115,12 +115,8 @@
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
if (message.level >= PearlLogLevelWarn) if (message.level >= PearlLogLevelWarn)
[[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Problem" [[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Problem"
attributes:[NSDictionary attributes:@{@"level": @(PearlLogLevelStr(message.level)),
dictionaryWithObjectsAndKeys: @"message": message.message}];
[NSString stringWithCString:PearlLogLevelStr(message.level)
encoding:NSASCIIStringEncoding], @"level",
message.message, @"message",
nil]];
return YES; return YES;
}]; }];
@ -134,12 +130,10 @@
[[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault]; [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsLandscapePhone]; [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsLandscapePhone];
[[UINavigationBar appearance] setTitleTextAttributes: [[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys: @{UITextAttributeTextColor: [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f],
[UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], UITextAttributeTextColor, UITextAttributeTextShadowColor: [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.8f],
[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.8f], UITextAttributeTextShadowColor, UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, -1)],
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset, UITextAttributeFont: [UIFont fontWithName:@"Exo-Bold" size:20.0f]}];
[UIFont fontWithName:@"Exo-Bold" size:20.0f], UITextAttributeFont,
nil]];
UIImage *navBarButton = [[UIImage imageNamed:@"ui_navbar_button"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)]; UIImage *navBarButton = [[UIImage imageNamed:@"ui_navbar_button"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
UIImage *navBarBack = [[UIImage imageNamed:@"ui_navbar_back"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)]; UIImage *navBarBack = [[UIImage imageNamed:@"ui_navbar_back"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)];
@ -148,12 +142,10 @@
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:navBarBack forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearance] setBackButtonBackgroundImage:navBarBack forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone]; [[UIBarButtonItem appearance] setBackButtonBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone];
[[UIBarButtonItem appearance] setTitleTextAttributes: [[UIBarButtonItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys: @{UITextAttributeTextColor: [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f],
[UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], UITextAttributeTextColor, UITextAttributeTextShadowColor: [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f],
[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f], UITextAttributeTextShadowColor, UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 1)],
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, UITextAttributeFont: [UIFont fontWithName:@"Helvetica-Neue" size:0.0f]}
[UIFont fontWithName:@"Helvetica-Neue" size:0.0f], UITextAttributeFont,
nil]
forState:UIControlStateNormal]; forState:UIControlStateNormal];
UIImage *toolBarImage = [[UIImage imageNamed:@"ui_toolbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake(25, 5, 5, 5)]; UIImage *toolBarImage = [[UIImage imageNamed:@"ui_toolbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake(25, 5, 5, 5)];
@ -408,30 +400,25 @@
[TestFlight passCheckpoint:MPCheckpointConfig]; [TestFlight passCheckpoint:MPCheckpointConfig];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointConfig attributes: [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointConfig attributes:
[NSDictionary dictionaryWithObjectsAndKeys: @{@"rememberLogin": [[MPConfig get].rememberLogin boolValue]
[[MPConfig get].rememberLogin boolValue] ? @"YES": @"NO",
? @"YES": @"NO", @"rememberLogin", @"iCloud": [[MPConfig get].iCloud boolValue]? @"YES"
[[MPConfig get].iCloud boolValue]? @"YES" : @"NO",
: @"NO", @"iCloud", @"iCloudDecided": [[MPConfig get].iCloudDecided boolValue]
[[MPConfig get].iCloudDecided boolValue] ? @"YES": @"NO",
? @"YES": @"NO", @"iCloudDecided", @"sendInfo": [[MPiOSConfig get].sendInfo boolValue]
[[MPiOSConfig get].sendInfo boolValue] ? @"YES": @"NO",
? @"YES": @"NO", @"sendInfo", @"helpHidden": [[MPiOSConfig get].helpHidden boolValue]
[[MPiOSConfig get].helpHidden boolValue] ? @"YES": @"NO",
? @"YES": @"NO", @"helpHidden", @"showQuickStart": [[MPiOSConfig get].showQuickStart boolValue]
[[MPiOSConfig get].showQuickStart boolValue] ? @"YES": @"NO",
? @"YES": @"NO", @"showQuickStart", @"firstRun": [[PearlConfig get].firstRun boolValue]
[[PearlConfig get].firstRun boolValue] ? @"YES": @"NO",
? @"YES": @"NO", @"firstRun", @"launchCount": [[PearlConfig get].launchCount description],
[[PearlConfig get].launchCount description], @"askForReviews": [[PearlConfig get].askForReviews boolValue]
@"launchCount", ? @"YES": @"NO",
[[PearlConfig get].askForReviews boolValue] @"reviewAfterLaunches": [[PearlConfig get].reviewAfterLaunches description],
? @"YES": @"NO", @"askForReviews", @"reviewedVersion": [PearlConfig get].reviewedVersion}];
[[PearlConfig get].reviewAfterLaunches description],
@"reviewAfterLaunches",
[PearlConfig get].reviewedVersion,
@"reviewedVersion",
nil]];
} }
} }
@ -613,7 +600,7 @@
return; return;
} }
[MPConfig get].iCloudDecided = [NSNumber numberWithBool:YES]; [MPConfig get].iCloudDecided = @YES;
if (buttonIndex == [alert cancelButtonIndex]) if (buttonIndex == [alert cancelButtonIndex])
return; return;
if (buttonIndex == [alert firstOtherButtonIndex] + 1) if (buttonIndex == [alert firstOtherButtonIndex] + 1)

View File

@ -43,7 +43,7 @@
inf(@"Guide will disappear."); inf(@"Guide will disappear.");
[super viewWillDisappear:animated]; [super viewWillDisappear:animated];
[MPiOSConfig get].showQuickStart = [NSNumber numberWithBool:NO]; [MPiOSConfig get].showQuickStart = @NO;
} }
- (void)viewDidUnload { - (void)viewDidUnload {

View File

@ -303,7 +303,7 @@
- (void)setHelpHidden:(BOOL)hidden animated:(BOOL)animated { - (void)setHelpHidden:(BOOL)hidden animated:(BOOL)animated {
[MPiOSConfig get].helpHidden = PearlBool(hidden); [MPiOSConfig get].helpHidden = @(hidden);
[self updateHelpHiddenAnimated:animated]; [self updateHelpHiddenAnimated:animated];
} }
@ -481,11 +481,8 @@
[TestFlight passCheckpoint:MPCheckpointCopyToPasteboard]; [TestFlight passCheckpoint:MPCheckpointCopyToPasteboard];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyToPasteboard [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyToPasteboard
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"type", @"version": @(self.activeElement.version)}];
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
} }
- (IBAction)copyLoginName:(UITapGestureRecognizer *)sender { - (IBAction)copyLoginName:(UITapGestureRecognizer *)sender {
@ -500,11 +497,8 @@
[TestFlight passCheckpoint:MPCheckpointCopyLoginNameToPasteboard]; [TestFlight passCheckpoint:MPCheckpointCopyLoginNameToPasteboard];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyLoginNameToPasteboard [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCopyLoginNameToPasteboard
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"type", @"version": @(self.activeElement.version)}];
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
} }
- (IBAction)incrementPasswordCounter { - (IBAction)incrementPasswordCounter {
@ -524,12 +518,8 @@
[TestFlight passCheckpoint:MPCheckpointIncrementPasswordCounter]; [TestFlight passCheckpoint:MPCheckpointIncrementPasswordCounter];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointIncrementPasswordCounter [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointIncrementPasswordCounter
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"version": @(self.activeElement.version)}];
@"type",
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
}]; }];
} }
@ -555,12 +545,8 @@
[TestFlight passCheckpoint:MPCheckpointResetPasswordCounter]; [TestFlight passCheckpoint:MPCheckpointResetPasswordCounter];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointResetPasswordCounter [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointResetPasswordCounter
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"version": @(self.activeElement.version)}];
@"type",
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
}]; }];
} }
@ -577,12 +563,8 @@
[self.loginNameField becomeFirstResponder]; [self.loginNameField becomeFirstResponder];
[TestFlight passCheckpoint:MPCheckpointEditLoginName]; [TestFlight passCheckpoint:MPCheckpointEditLoginName];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointEditLoginName attributes:[NSDictionary dictionaryWithObjectsAndKeys: [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointEditLoginName attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"version": @(self.activeElement.version)}];
@"type",
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
} }
- (void)changeElementWithWarning:(NSString *)warning do:(void (^)(void))task; { - (void)changeElementWithWarning:(NSString *)warning do:(void (^)(void))task; {
@ -624,11 +606,8 @@
[TestFlight passCheckpoint:MPCheckpointEditPassword]; [TestFlight passCheckpoint:MPCheckpointEditPassword];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointEditPassword [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointEditPassword
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"type", @"version": @(self.activeElement.version)}];
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
} }
} }
@ -648,12 +627,8 @@
[TestFlight passCheckpoint:MPCheckpointExplicitMigration]; [TestFlight passCheckpoint:MPCheckpointExplicitMigration];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointExplicitMigration [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointExplicitMigration
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"version": @(self.activeElement.version)}];
@"type",
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
}]; }];
} }
@ -753,7 +728,7 @@
initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) { initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
MFMailComposeViewController *composer = [MFMailComposeViewController new]; MFMailComposeViewController *composer = [MFMailComposeViewController new];
[composer setMailComposeDelegate:self]; [composer setMailComposeDelegate:self];
[composer setToRecipients:[NSArray arrayWithObject:@"Master Password Development <masterpassword@lyndir.com>"]]; [composer setToRecipients:@[@"Master Password Development <masterpassword@lyndir.com>"]];
[composer setSubject:PearlString(@"Feedback for Master Password [%@]", [composer setSubject:PearlString(@"Feedback for Master Password [%@]",
[[PearlKeyChain deviceIdentifier] stringByDeletingMatchesOf:@"-.*"])]; [[PearlKeyChain deviceIdentifier] stringByDeletingMatchesOf:@"-.*"])];
[composer setMessageBody: [composer setMessageBody:
@ -885,12 +860,8 @@
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationElementUpdated object:self.activeElement]; [[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationElementUpdated object:self.activeElement];
[TestFlight passCheckpoint:PearlString(MPCheckpointUseType @"_%@", self.activeElement.typeShortName)]; [TestFlight passCheckpoint:PearlString(MPCheckpointUseType @"_%@", self.activeElement.typeShortName)];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointUseType attributes:[NSDictionary dictionaryWithObjectsAndKeys: [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointUseType attributes:@{@"type": self.activeElement.typeName,
self.activeElement.typeName, @"version": @(self.activeElement.version)}];
@"type",
PearlUnsignedInteger(self.activeElement.version),
@"version",
nil]];
} }
[self.searchDisplayController setActive:NO animated:YES]; [self.searchDisplayController setActive:NO animated:YES];

View File

@ -65,7 +65,7 @@
return nil; return nil;
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])]; NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])];
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"uses_" ascending:NO]]; fetchRequest.sortDescriptors = @[[[NSSortDescriptor alloc] initWithKey:@"uses_" ascending:NO]];
_fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:moc _fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:moc
sectionNameKeyPath:nil cacheName:nil]; sectionNameKeyPath:nil cacheName:nil];
_fetchedResultsController.delegate = self; _fetchedResultsController.delegate = self;
@ -110,7 +110,7 @@
controller.searchBar.prompt = @"Enter the site's name:"; controller.searchBar.prompt = @"Enter the site's name:";
controller.searchBar.showsScopeBar = controller.searchBar.selectedScopeButtonIndex != MPSearchScopeAll; controller.searchBar.showsScopeBar = controller.searchBar.selectedScopeButtonIndex != MPSearchScopeAll;
if (controller.searchBar.showsScopeBar) if (controller.searchBar.showsScopeBar)
controller.searchBar.scopeButtonTitles = [NSArray arrayWithObjects:@"All", @"Outdated", nil]; controller.searchBar.scopeButtonTitles = @[@"All", @"Outdated"];
else else
controller.searchBar.scopeButtonTitles = nil; controller.searchBar.scopeButtonTitles = nil;
@ -168,8 +168,8 @@
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"user == %@", [MPAppDelegate get].activeUser]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"user == %@", [MPAppDelegate get].activeUser];
if (self.query.length) if (self.query.length)
predicate = [NSCompoundPredicate predicate = [NSCompoundPredicate
andPredicateWithSubpredicates:[NSArray arrayWithObjects:[NSPredicate predicateWithFormat:@"name BEGINSWITH[cd] %@", self.query], andPredicateWithSubpredicates:@[[NSPredicate predicateWithFormat:@"name BEGINSWITH[cd] %@", self.query],
predicate, nil]]; predicate]];
switch ((MPSearchScope)self.searchDisplayController.searchBar.selectedScopeButtonIndex) { switch ((MPSearchScope)self.searchDisplayController.searchBar.selectedScopeButtonIndex) {
@ -177,8 +177,8 @@
break; break;
case MPSearchScopeOutdated: case MPSearchScopeOutdated:
predicate = [NSCompoundPredicate predicate = [NSCompoundPredicate
andPredicateWithSubpredicates:[NSArray arrayWithObjects:[NSPredicate predicateWithFormat:@"requiresExplicitMigration_ == YES"], andPredicateWithSubpredicates:@[[NSPredicate predicateWithFormat:@"requiresExplicitMigration_ == YES"],
predicate, nil]]; predicate]];
break; break;
} }
self.fetchedResultsController.fetchRequest.predicate = predicate; self.fetchedResultsController.fetchRequest.predicate = predicate;
@ -405,10 +405,8 @@ forRowAtIndexPath:(NSIndexPath *)indexPath {
[TestFlight passCheckpoint:MPCheckpointDeleteElement]; [TestFlight passCheckpoint:MPCheckpointDeleteElement];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointDeleteElement [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointDeleteElement
attributes:[NSDictionary dictionaryWithObjectsAndKeys: attributes:@{@"type": element.typeName,
element.typeName, @"type", @"version": @(element.version)}];
PearlUnsignedInteger(element.version), @"version",
nil]];
}]; }];
} }
} }

View File

@ -222,7 +222,7 @@
[moc performBlockAndWait:^{ [moc performBlockAndWait:^{
NSError *error = nil; NSError *error = nil;
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPUserEntity class])]; NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPUserEntity class])];
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO]]; fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO]];
users = [moc executeFetchRequest:fetchRequest error:&error]; users = [moc executeFetchRequest:fetchRequest error:&error];
if (!users) if (!users)
err(@"Failed to load users: %@", error); err(@"Failed to load users: %@", error);
@ -633,8 +633,7 @@
pulseShadowOpacityAnimation.repeatCount = MAXFLOAT; pulseShadowOpacityAnimation.repeatCount = MAXFLOAT;
CAAnimationGroup *group = [[CAAnimationGroup alloc] init]; CAAnimationGroup *group = [[CAAnimationGroup alloc] init];
group.animations = [NSArray arrayWithObjects:toShadowColorAnimation, toShadowOpacityAnimation, pulseShadowOpacityAnimation, group.animations = @[toShadowColorAnimation, toShadowOpacityAnimation, pulseShadowOpacityAnimation];
nil];
group.duration = MAXFLOAT; group.duration = MAXFLOAT;
[avatar.layer removeAnimationForKey:@"inactiveShadow"]; [avatar.layer removeAnimationForKey:@"inactiveShadow"];
@ -651,7 +650,7 @@
toShadowOpacityAnimation.duration = 0.5f; toShadowOpacityAnimation.duration = 0.5f;
CAAnimationGroup *group = [[CAAnimationGroup alloc] init]; CAAnimationGroup *group = [[CAAnimationGroup alloc] init];
group.animations = [NSArray arrayWithObjects:toShadowColorAnimation, toShadowOpacityAnimation, nil]; group.animations = @[toShadowColorAnimation, toShadowOpacityAnimation];
group.duration = 0.5f; group.duration = 0.5f;
[avatar.layer removeAnimationForKey:@"targetedShadow"]; [avatar.layer removeAnimationForKey:@"targetedShadow"];

View File

@ -14,16 +14,14 @@
if (!(self = [super init])) if (!(self = [super init]))
return self; return self;
[self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: [self.defaults registerDefaults:@{NSStringFromSelector(@selector(sendInfo)): @NO,
[NSNumber numberWithBool:NO], NSStringFromSelector(@selector(sendInfo)), NSStringFromSelector(@selector(helpHidden)): @NO,
[NSNumber numberWithBool:NO], NSStringFromSelector(@selector(helpHidden)), NSStringFromSelector(@selector(siteInfoHidden)): @YES,
[NSNumber numberWithBool:YES], NSStringFromSelector(@selector(siteInfoHidden)), NSStringFromSelector(@selector(showQuickStart)): @YES,
[NSNumber numberWithBool:YES], NSStringFromSelector(@selector(showQuickStart)), NSStringFromSelector(@selector(iTunesID)): @"510296984",
@"510296984", NSStringFromSelector(@selector(iTunesID)), NSStringFromSelector(@selector(actionsTipShown)): PearlBoolNot(self.firstRun),
PearlBoolNot(self.firstRun), NSStringFromSelector(@selector(actionsTipShown)), NSStringFromSelector(@selector(typeTipShown)): PearlBoolNot(self.firstRun),
PearlBoolNot(self.firstRun), NSStringFromSelector(@selector(typeTipShown)), NSStringFromSelector(@selector(loginNameTipShown)): PearlBool(NO)}];
PearlBool(NO), NSStringFromSelector(@selector(loginNameTipShown)),
nil]];
return self; return self;
} }

View File

@ -30,16 +30,16 @@
- (void)testAlgorithm - (void)testAlgorithm
{ {
NSString *masterPassword = @"test-mp"; //NSString *masterPassword = @"test-mp";
NSString *username = @"test-user"; //NSString *username = @"test-user";
NSString *siteName = @"test-site"; //NSString *siteName = @"test-site";
MPElementType siteType = MPElementTypeGeneratedLong; //MPElementType siteType = MPElementTypeGeneratedLong;
uint32_t siteCounter = 42; //uint32_t siteCounter = 42;
NSString *sitePassword = MPCalculateContent( siteType, siteName, keyForPassword( masterPassword, username ), siteCounter ); //NSString *sitePassword = MPCalculateContent( siteType, siteName, keyForPassword( masterPassword, username ), siteCounter );
inf( @"master password: %@, username: %@\nsite name: %@, site type: %@, site counter: %d\n => site password: %@", //inf( @"master password: %@, username: %@\nsite name: %@, site type: %@, site counter: %d\n => site password: %@",
masterPassword, username, siteName, NSStringFromMPElementType(siteType), siteCounter, sitePassword ); // masterPassword, username, siteName, NSStringFromMPElementType(siteType), siteCounter, sitePassword );
} }
@end @end