Skip to content
Snippets Groups Projects
Commit 02651fa3 authored by juanf's avatar juanf
Browse files

SP-782 BIS-497 iPad Bug 3 and search results feedback improved.

SVN: 29576
parent d056c071
No related branches found
No related tags found
No related merge requests found
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
- (void)showActivityIndicatorOnView:(UIView *)view - (void)showActivityIndicatorOnView:(UIView *)view
{ {
self.activityIndicator.center = view.center; self.activityIndicator.center = CGPointMake(view.center.x, view.center.y - 242 - 90);
[self.activityIndicator startAnimating]; [self.activityIndicator startAnimating];
[view addSubview: self.activityIndicator]; [view addSubview: self.activityIndicator];
} }
...@@ -328,30 +328,39 @@ ...@@ -328,30 +328,39 @@
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption
{ {
CISDOBTableDisplayState *oldDisplayState = self.searchFilterState; // BUGFIX - Avoid application crash
self.openBisModel.selectedSearchScopeIndex = searchOption; if (self.openBisModel.searchString == nil) {
NSString* searchTitle = [self scopeButtonTitles][self.openBisModel.selectedSearchScopeIndex];
self.searchFilterState = [self.openBisModel isSelectedSearchScopeIndexSearch] ? self.searchState : self.filterState;
if (self.openBisModel.searchString == nil) { //Avoid application crash
self.openBisModel.searchString = @""; self.openBisModel.searchString = @"";
} }
// BUGFIX
//Updating the state controller if the user presses a scope buttion
self.openBisModel.selectedSearchScopeIndex = searchOption;
self.searchFilterState = [self.openBisModel isSelectedSearchScopeIndexSearch] ? self.searchState : self.filterState;
//Searching for barcodes or normal search
NSString* searchTitle = [self scopeButtonTitles][searchOption];
if ([searchTitle isEqualToString:@"Barcode"]) { if ([searchTitle isEqualToString:@"Barcode"]) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
CISDOBBarcodeViewController *barcodeController = [storyboard instantiateViewControllerWithIdentifier:@"Barcode"]; CISDOBBarcodeViewController *barcodeController = [storyboard instantiateViewControllerWithIdentifier:@"Barcode"];
barcodeController.modalPresentationStyle = UIModalPresentationFullScreen; barcodeController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:barcodeController animated:YES]; [self presentModalViewController:barcodeController animated:YES];
return NO; return NO;
} else { //Search String should have a minimum size } else {
return (oldDisplayState != self.searchFilterState) ? return [self.searchFilterState searchDisplayController: controller shouldReloadTableForSearchString: self.openBisModel.searchString];
[self.searchFilterState searchDisplayController: controller shouldReloadTableForSearchString: self.openBisModel.searchString] :
YES;
} }
} }
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller
{ {
// BUGFIX - Avoid inconsistent selected button when moving through sections that change the state
if ([self.searchFilterState class] == [CISDOBTableSearchState class]) {
controller.searchBar.selectedScopeButtonIndex = 0;
} else if ([self.searchFilterState class] == [CISDOBTableFilterState class]) {
controller.searchBar.selectedScopeButtonIndex = [self scopeButtonTitles].count - 1;
}
// BUGFIX
controller.searchBar.scopeButtonTitles = [self scopeButtonTitles]; controller.searchBar.scopeButtonTitles = [self scopeButtonTitles];
controller.searchBar.showsScopeBar = YES; controller.searchBar.showsScopeBar = YES;
} }
...@@ -594,9 +603,13 @@ static NSTimer *timer = nil; ...@@ -594,9 +603,13 @@ static NSTimer *timer = nil;
[invocation setArgument:&searchString atIndex:3]; [invocation setArgument:&searchString atIndex:3];
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 invocation:invocation repeats:NO]; timer = [NSTimer scheduledTimerWithTimeInterval:1.0 invocation:invocation repeats:NO];
return NO; // Do not refresh the table yet, wait until the server returns
} else {
__weak CISDOBTableSearchState *weakSelf = self;
NSMutableArray *emptyResult = [NSMutableArray arrayWithCapacity:0];
weakSelf.filteredResults = emptyResult;
return YES;
} }
return NO; // Do not refresh the table yet, wait until the server returns
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment