From d77cde192994a3411409b099a51f18f9d54bde4e Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Wed, 27 Jun 2012 23:44:37 +0200 Subject: [PATCH] Moved MPSearchDelegate to code. [FIXED] Another potential crash because of an over-released top-level object in storyboard. --- .../MasterPassword (Development).xcscheme | 2 +- MasterPassword/MPTypes.m | 4 ++-- MasterPassword/iOS/MPMainViewController.h | 4 ++-- MasterPassword/iOS/MPMainViewController.m | 13 +++++++++++-- MasterPassword/iOS/MPSearchDelegate.m | 1 - .../iOS/MainStoryboard_iPhone.storyboard | 15 +-------------- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword (Development).xcscheme b/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword (Development).xcscheme index 59535f3b..f9dc805b 100644 --- a/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword (Development).xcscheme +++ b/MasterPassword-iOS.xcodeproj/xcshareddata/xcschemes/MasterPassword (Development).xcscheme @@ -44,7 +44,7 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" useCustomWorkingDirectory = "NO" - buildConfiguration = "AppStore" + buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" allowLocationSimulation = "YES"> diff --git a/MasterPassword/MPTypes.m b/MasterPassword/MPTypes.m index c418e67f..c2be0baa 100644 --- a/MasterPassword/MPTypes.m +++ b/MasterPassword/MPTypes.m @@ -9,9 +9,9 @@ #import "MPEntities.h" -#define MP_N 131072 +#define MP_N 32768 #define MP_r 8 -#define MP_p 1 +#define MP_p 2 #define MP_dkLen 64 #define MP_hash PearlHashSHA256 diff --git a/MasterPassword/iOS/MPMainViewController.h b/MasterPassword/iOS/MPMainViewController.h index daf51db9..d2345a71 100644 --- a/MasterPassword/iOS/MPMainViewController.h +++ b/MasterPassword/iOS/MPMainViewController.h @@ -14,7 +14,8 @@ @interface MPMainViewController : UIViewController @property (strong, nonatomic) MPElementEntity *activeElement; -@property (strong, nonatomic) IBOutlet MPSearchDelegate *searchResultsController; +@property (strong, nonatomic) IBOutlet MPSearchDelegate *searchDelegate; +@property (strong, nonatomic) IBOutlet UILongPressGestureRecognizer *resetPasswordCounterGesture; @property (weak, nonatomic) IBOutlet UITextField *contentField; @property (weak, nonatomic) IBOutlet UIButton *typeButton; @property (weak, nonatomic) IBOutlet UIWebView *helpView; @@ -33,7 +34,6 @@ @property (weak, nonatomic) IBOutlet UIView *searchTipContainer; @property (weak, nonatomic) IBOutlet UIView *actionsTipContainer; @property (weak, nonatomic) IBOutlet UIView *typeTipContainer; -@property (strong, nonatomic) IBOutlet UILongPressGestureRecognizer *resetPasswordCounterGesture; @property (copy) void (^contentTipCleanup)(BOOL finished); diff --git a/MasterPassword/iOS/MPMainViewController.m b/MasterPassword/iOS/MPMainViewController.m index d9c1fe42..220fcdcf 100644 --- a/MasterPassword/iOS/MPMainViewController.m +++ b/MasterPassword/iOS/MPMainViewController.m @@ -25,7 +25,7 @@ @implementation MPMainViewController @synthesize activeElement = _activeElement; -@synthesize searchResultsController = _searchResultsController; +@synthesize searchDelegate = _searchDelegate; @synthesize typeButton = _typeButton; @synthesize helpView = _helpView; @synthesize siteName = _siteName; @@ -67,6 +67,15 @@ } - (void)viewDidLoad { + + self.searchDelegate = [MPSearchDelegate new]; + self.searchDelegate.delegate = self; + self.searchDelegate.searchDisplayController = self.searchDisplayController; + self.searchDelegate.searchTipContainer = self.searchTipContainer; + self.searchDisplayController.searchBar.delegate = self.searchDelegate; + self.searchDisplayController.delegate = self.searchDelegate; + self.searchDisplayController.searchResultsDelegate = self.searchDelegate; + self.searchDisplayController.searchResultsDataSource = self.searchDelegate; self.resetPasswordCounterGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(resetPasswordCounter:)]; [self.passwordIncrementer addGestureRecognizer:self.resetPasswordCounterGesture]; @@ -136,7 +145,6 @@ [self setContentField:nil]; [self setTypeButton:nil]; - [self setSearchResultsController:nil]; [self setHelpView:nil]; [self setSiteName:nil]; [self setPasswordCounter:nil]; @@ -153,6 +161,7 @@ [self setSearchTipContainer:nil]; [self setActionsTipContainer:nil]; [self setTypeTipContainer:nil]; + [self setSearchDelegate:nil]; [self setResetPasswordCounterGesture:nil]; [super viewDidUnload]; } diff --git a/MasterPassword/iOS/MPSearchDelegate.m b/MasterPassword/iOS/MPSearchDelegate.m index 9bfe727b..419db494 100644 --- a/MasterPassword/iOS/MPSearchDelegate.m +++ b/MasterPassword/iOS/MPSearchDelegate.m @@ -110,7 +110,6 @@ - (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller { - dbg(@"Search ended with: %@", controller.searchBar.text); controller.searchBar.prompt = nil; controller.searchBar.searchResultsButtonSelected = NO; } diff --git a/MasterPassword/iOS/MainStoryboard_iPhone.storyboard b/MasterPassword/iOS/MainStoryboard_iPhone.storyboard index f4c63c6c..c89884d1 100644 --- a/MasterPassword/iOS/MainStoryboard_iPhone.storyboard +++ b/MasterPassword/iOS/MainStoryboard_iPhone.storyboard @@ -416,20 +416,10 @@ Your passwords will be AES-encrypted with your master password. - - - - - - - - - - @@ -621,9 +611,6 @@ L4m3P4sSw0rD - - - @@ -734,7 +721,6 @@ L4m3P4sSw0rD - @@ -1379,6 +1365,7 @@ L4m3P4sSw0rD +