From 2006e382d443e0e0fd525781f8c711459bdd4e55 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 5 Jun 2014 22:00:20 -0400 Subject: [PATCH] Hopefully fixed issue with rendering maximum security cells re-used from "new site" cells. [FIXED] When a "new site" cell gets recycled as a "maximum security" entity's cell, we may not be able to scroll to the cell index for the type because the collection view's cell indexes weren't updated yet. --- External/LoveLyndir | 2 +- External/Pearl | 2 +- MasterPassword/ObjC/MPAppDelegate_Key.m | 2 +- MasterPassword/ObjC/MPAppDelegate_Store.m | 2 +- MasterPassword/ObjC/MPEntities.m | 2 +- MasterPassword/ObjC/iOS/MPPasswordTypesCell.m | 8 +++----- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/External/LoveLyndir b/External/LoveLyndir index ceed9e20..c2a728da 160000 --- a/External/LoveLyndir +++ b/External/LoveLyndir @@ -1 +1 @@ -Subproject commit ceed9e20009f2cf3679445e2c60b0f206aaef383 +Subproject commit c2a728dab38101addc645f0a0f34d82a06e34e8d diff --git a/External/Pearl b/External/Pearl index daa260b3..c9000309 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit daa260b3ecaca266ffcfa597e9350900dda6cc56 +Subproject commit c9000309913081119803fdd1c2106e371c1b594a diff --git a/MasterPassword/ObjC/MPAppDelegate_Key.m b/MasterPassword/ObjC/MPAppDelegate_Key.m index f8fe462d..d5bbb7c9 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Key.m +++ b/MasterPassword/ObjC/MPAppDelegate_Key.m @@ -16,7 +16,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) { return [PearlKeyChain createQueryForClass:kSecClassGenericPassword attributes:@{ (__bridge id)kSecAttrService : @"Saved Master Password", - (__bridge id)kSecAttrAccount : IfNotNilElse( user.name, @"" ) + (__bridge id)kSecAttrAccount : user.name?: @"" } matches:nil]; } diff --git a/MasterPassword/ObjC/MPAppDelegate_Store.m b/MasterPassword/ObjC/MPAppDelegate_Store.m index ee238736..cf67c590 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Store.m +++ b/MasterPassword/ObjC/MPAppDelegate_Store.m @@ -430,7 +430,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext @"cause" : @(cause), @"error.code" : @(error.code), @"error.domain" : NilToNSNull( error.domain ), - @"error.reason" : NilToNSNull( IfNotNilElse( [error localizedFailureReason], [error localizedDescription] ) ), + @"error.reason" : NilToNSNull( [error localizedFailureReason]?: [error localizedDescription] ), } ); } diff --git a/MasterPassword/ObjC/MPEntities.m b/MasterPassword/ObjC/MPEntities.m index 8cd60ba3..00d7ee7c 100644 --- a/MasterPassword/ObjC/MPEntities.m +++ b/MasterPassword/ObjC/MPEntities.m @@ -186,7 +186,7 @@ - (MPElementType)defaultType { - return IfElse((MPElementType)[self.defaultType_ unsignedIntegerValue], MPElementTypeGeneratedLong); + return (MPElementType)[self.defaultType_ unsignedIntegerValue]?: MPElementTypeGeneratedLong; } - (void)setDefaultType:(MPElementType)aDefaultType { diff --git a/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m b/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m index b6e85430..51f2220b 100644 --- a/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m +++ b/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m @@ -230,7 +230,8 @@ if (self.transientSite) PearlMainQueue( ^{ - self.activeType = IfElse( [[MPiOSAppDelegate get] activeUserForMainThread].defaultType, MPElementTypeGeneratedLong ); + self.algorithm = MPAlgorithmDefault; + self.activeType = [[MPiOSAppDelegate get] activeUserForMainThread].defaultType?: MPElementTypeGeneratedLong; for (NSInteger section = 0; section < [self.contentCollectionView numberOfSections]; ++section) for (NSInteger item = 0; item < [self.contentCollectionView numberOfItemsInSection:section]; ++item) @@ -242,7 +243,7 @@ [MPiOSAppDelegate managedObjectContextForMainThreadPerformBlockAndWait:^(NSManagedObjectContext *mainContext) { MPElementEntity *mainElement = [self mainElement]; - self.algorithm = IfNotNilElse( mainElement.algorithm, MPAlgorithmDefault ); + self.algorithm = mainElement.algorithm?: MPAlgorithmDefault; self.activeType = mainElement.type; for (NSInteger section = 0; section < [self.contentCollectionView numberOfSections]; ++section) @@ -374,9 +375,6 @@ - (void)setAlgorithm:(id)algorithm { - if ([_algorithm isEqual:algorithm]) - return; - _algorithm = algorithm; [self.contentCollectionView reloadData];